Hands on hardware

While keeping the colaboration with the meta-ros project I started interfacing hardware with the BB.

The schedule for the following weeks is:

* week 6 (22nd July - 28th July)       : Get started with capes & ROS. There's no real need to rewrite drivers for ROS. Assuming that there're already drivers for the capes, it will be required just to publish that information to a ROS topic. In the following weeks I'm expecting one by one to create ROS interfaces to access the different capes.

* week 7 (29th July - 4th August)      : Audio Cape

* week 8 (5th August - 11th August)    : Same.

* week 9 (12th August - 18th August)   : Motors and IMU.

* week 10 (19th August - 25th August)  : Same. 

* week 11 (26th August - 1st Septemb)  : Documentation.

* week 12 (2nd Septemb - 8th Septemb)  : Documentation. Overall review. 

* week 13 (9th Septemb - 15th Septemb) : Overall review and analysis of the Beagle-ROS integration.

Unfortunately, since i haven’t received yet the Audio cape, I decided to start with the “Motors and IMU* (MPU-9150)”:

20130719_111027 20130719_111009

I used the I2C-2 in the P9 expansion block(which actually turns out to be mapped to I2C-1) and the userspace linux-mpu9150 driver (I did try the MPU-6050 cross-compiled kernel driver but i haven’t been able to make it work yet).

The linux-mpu9150 driver provides a nice and simple code that can be easily customized (in the image Euler angles are printed but there’re other possibilities).

The next steps are to interface the motors with the BB and publish the IMU data to a ROS topic.

*It’s actually an AHRS (Attitude and Heading Reference System)

Advertisements
Standard

Cross-compiling ROS packages

Several bitbake recipes have been written to cross-compile different ROS (tutorial) packages. These recipes are available here.

The following ones have been created:

recipes/
├── beginner-tutorials
│   └── beginner-tutorials_git.bb
├── common-tutorials
│   ├── actionlib-tutorials_git.bb
│   ├── nodelet-tutorial-math_git.bb
│   ├── pluginlib-tutorials_git.bb
│   └── turtle-actionlib_git.bb
├── README.md
└── ros-tutorials
    ├── roscpp-tutorials_git.bb
    ├── rospy-tutorials_git.bb
    └── turtlesim_git.bb

However for now common-tutorials and ros-tutorials/turtlesim* don’t cross-compile.

Refer to previous post for instructions about how to install beagle-ros as an Angstrom layer and then use these recipes to cross-compile your own packages. There’re also instructions about how to create your own package and cross-compile it in the beginner-tutorials example (HOW TO REPLICATE section).

Standard

ROS Tutorials II

The ROS tutorials have been updated. New issues appeared and they’ve been annoteated in the code.

This is the current state:

Issues with ROS Tutorials (http://www.ros.org/wiki/ROS/Tutorials)

Tutorial 1. Installing and Configuring Your ROS Environment 
==========
(http://www.ros.org/wiki/ROS/Tutorials/InstallingandConfiguringROSEnvironment):

    - Initial issues with catkin_make
    - Completed

Tutorial 2. Navigating the ROS Filesystem
==========
(http://www.ros.org/wiki/ROS/Tutorials/NavigatingTheFilesystem)

    - In order to work with rosbash suite, it's necessary to source setup.bash (surprisingly if setup.sh is sourced it doesn't get in the PATH)
    - Necessary to set up ROS_WORKSPACE
         export ROS_WORKSPACE="/home/root/catkin_ws/devel/"
    -  $ROS_PACKAGE_PATH correctly set if the setup.bash sourced is the one in the workspace
    - Completed

Tutorial 3. Creating a ROS Package
==========
(http://www.ros.org/wiki/ROS/Tutorials/CreatingPackage)

    - rospack depends1 beginner_tutorials (or roscpp) not working properly
    - error. see issue https://github.com/bmwcarit/meta-ros/issues/108
    - Answered at https://github.com/bmwcarit/meta-ros/issues/108
    rosdep is a tool for managing the package dependencies in various distributions uniformly. To get rosdep working, you would have to know which package manager your distribution uses (I think Angstrom uses ipkg), and them add support for that tool in rosdep. Furtermore, you would have to provide a mapping from ubuntu package names to ipkg package names in the yaml file.
    I consider this a lot of work for just a minor point, namely to use rosdep instead of using ipkg, which works nicely anyway. Maybe, it is better when you look into the more advanced ROS application tutorials and try to cross-compile those and make a documentation how to write recipes for those. The system/developer tools, like catkin_make and rosdep, do not need to run on the beagleboard anyway when you cross-compile.

Tutorial 4. Creating a workspace for catkin
==========
(http://www.ros.org/wiki/catkin/Tutorials/create_a_workspace)

    - Completed

Tutorial 5. Building a ROS Package
==========
(http://www.ros.org/wiki/ROS/Tutorials/BuildingPackages)

    - Error. See issue https://github.com/bmwcarit/meta-ros/issues/109
    - Answer at https://github.com/bmwcarit/meta-ros/issues/109
    This is a clone of #103. As I said there, it is difficult and of low priority. You do not want to compile on the target anyway, but you want to compile the beginner tutorials on the host system for the target and then only run the tutorials on the target system. How about creating a recipe for the beginner_tutorials?

Tutorial 6. Creating a ROS Package (seems to be same as Tutorial 3)
==========

Tutorial 7. Understanding ROS Nodes
==========
(http://www.ros.org/wiki/ROS/Tutorials/UnderstandingNodes)
    - Completed.
        Turtlesim has been run in a Desktop machine agains the core running in the beaglebone. It's necessary to set the hosts at /etc/hosts
    - The nodes that have been launched even after stopping them "rosnode list" shows them. This is an issue that also appears in the Desktop version of ROS. (this seems to happen with turtlesim)

Tutorial 8. Building and using catkin packages in a workspace
==========
(http://www.ros.org/wiki/catkin/Tutorials/using_a_workspace)
    - Since building (for now) will be done using the cross-compiler (see issues with Tutorial 5) the deployment of the packages built won't be done through "catkin_make" install
        but it will be decided through the bitbake recipes.

Tutorial 9. Understanding ROS Topics
==========
(http://www.ros.org/wiki/ROS/Tutorials/UnderstandingTopics)
    - Completed (the turtlesim and rqt_graph were run in a Desktop machine)

Tutorial 15. Using rosed to edit files in ROS
==========
(http://www.ros.org/wiki/ROS/Tutorials/UsingRosEd)
    - Completed

Tutorial 16-19. Writing a Simple Publisher and Subscriber
==========
    - Completed. The code has been published at https://github.com/vmayoral/beginner_tutorials

ros_tutorials:
=============
    - recipes for ros_tutorials have been created (http://ros.org/wiki/ros_tutorials). Check the beagle-ros "recipes" directory.
    - turtlesim doesn't compile.

common_tutorials:
================
    - same with the common_tutorials (http://www.ros.org/wiki/common_tutorials). The recipes don't compile.
Standard

Beagle-ROS as an Angstrom layer

In order to be easier to keep track of the progress and updates, beagle-ros can now be added as an Angstrom layer. This will allow you to cross-compile all the examples through the bitbake recipes created.

The instructions to add the beagle-ros code as a layer:

The easiest way to install the recipes is to git clone 
the beagle-ros code directly into the Angstrom sources/ 
directory and add the beagle-ros as a layer:
  • Edit conf/bblayers.conf
  • add ${TOPDIR}/sources/beagle-ros \ to the BASELAYERS variable
It's also possible to add the recipes inside of the meta-ros code. There're instructions in https://github.com/vmayoral/beginner_tutorials/blob/master/README.md  of how to put these recipes in the meta-ros file structure.
Standard

ROS Tutorials I

For the next two weeks, according to the schedule i’ll try to complete the ROS Tutorials.

Tutorial 1. Installing and Configuring Your ROS Environment 
==========
(http://www.ros.org/wiki/ROS/Tutorials/InstallingandConfiguringROSEnvironment):

    - Initial issues with catkin_make
    - Completed

Tutorial 2. Navigating the ROS Filesystem
==========
(http://www.ros.org/wiki/ROS/Tutorials/NavigatingTheFilesystem)

    - In order to work with rosbash suite, it's necessary to source setup.bash (surprisingly if setup.sh is sourced it doesn't get in the PATH)
    - Necessary to set up ROS_WORKSPACE
         export ROS_WORKSPACE="/home/root/catkin_ws"
    -  $ROS_PACKAGE_PATH correctly set if the setup.bash sourced is the one in the workspace
    - Completed

Tutorial 3. Creating a ROS Package
==========
(http://www.ros.org/wiki/ROS/Tutorials/CreatingPackage)

    - rospack depends1 beginner_tutorials (or roscpp) not working properly
    - error. see issue https://github.com/bmwcarit/meta-ros/issues/108
    - Answered at https://github.com/bmwcarit/meta-ros/issues/108
    rosdep is a tool for managing the package dependencies in various distributions uniformly. To get rosdep working, you would have to know which package manager your distribution uses (I think Angstrom uses ipkg), and them add support for that tool in rosdep. Furtermore, you would have to provide a mapping from ubuntu package names to ipkg package names in the yaml file.
    I consider this a lot of work for just a minor point, namely to use rosdep instead of using ipkg, which works nicely anyway. Maybe, it is better when you look into the more advanced ROS application tutorials and try to cross-compile those and make a documentation how to write recipes for those. The system/developer tools, like catkin_make and rosdep, do not need to run on the beagleboard anyway when you cross-compile.

Tutorial 4. Creating a workspace for catkin
==========
(http://www.ros.org/wiki/catkin/Tutorials/create_a_workspace)

    - Completed

Tutorial 5. Building a ROS Package
==========
(http://www.ros.org/wiki/ROS/Tutorials/BuildingPackages)

    - Error. See issue https://github.com/bmwcarit/meta-ros/issues/109
    - Answer at https://github.com/bmwcarit/meta-ros/issues/109
    This is a clone of #103. As I said there, it is difficult and of low priority. 
You do not want to compile on the target anyway, but you want to compile the 
beginner tutorials on the host system for the target and then only run the tutorials o
n the target system. How about creating a recipe for the beginner_tutorials?

Tutorial 6. Creating a ROS Package (seems to be same as Tutorial 3)
==========

Tutorial 7. Understanding ROS Nodes
==========
(http://www.ros.org/wiki/ROS/Tutorials/UnderstandingNodes)
If you wish to keep posted about the updates check the beagle-ros repository.
Standard

roscore and rosnodes working

Up until now the nodes launched from the meta-ros code weren’t working (they hang) but after the work at the issue #68 they seem to work properly.

I created a patch that fixes this situation. If you’re interested you can just apply it to oe-core but hopefully this patch get be pushed to the Angstrom oe-core.

From 30b73ddd1c3ddbd03a083c2ad9c4fcedf7749d32 Mon Sep 17 00:00:00 2001
From: victor 
Date: Mon, 1 Jul 2013 14:46:42 +0200
Subject: [PATCH] apr_cv_mutex_recursive=yes added to apr_1.4.6.bb to make
 rosnodes work
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Working with the meta-ros project we detected that the ROS nodes didn't launch properly
the reason was that by default apr_cv_mutex_recursive in apr is set to no and this leads
to the APRENOTIMPL return value of apr_thread_mutex_create in thread_mutex.c when
APR_THREAD_MUTEX_NESTED is requested via flags.

Added CACHED_CONFIGUREVARS += "apr_cv_mutex_recursive=yes" to sources/openembedded-core/meta/recipes-support/apr/apr_1.4.6.bb
to fix this issue. It has also been removed the mention of this variable in
meta/site/powerpc32-linux.

Signed-off-by: Víctor Mayoral Vilches 
---
 meta/recipes-support/apr/apr_1.4.6.bb |    3 +++
 meta/site/powerpc32-linux             |    1 -
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-support/apr/apr_1.4.6.bb b/meta/recipes-support/apr/apr_1.4.6.bb
index 896f79f..ba59639 100644
--- a/meta/recipes-support/apr/apr_1.4.6.bb
+++ b/meta/recipes-support/apr/apr_1.4.6.bb
@@ -23,6 +23,9 @@ inherit autotools lib_package binconfig multilib_header
 
 OE_BINCONFIG_EXTRA_MANGLE = " -e 's:location=source:location=installed:'"
 
+# Added to fix some issues with cmake. Refer to https://github.com/bmwcarit/meta-ros/issues/68#issuecomment-19896928
+CACHED_CONFIGUREVARS += "apr_cv_mutex_recursive=yes"
+
 do_configure_prepend() {
 	cd ${S}
 	./buildconf
diff --git a/meta/site/powerpc32-linux b/meta/site/powerpc32-linux
index 4550df3..b3973c9 100644
--- a/meta/site/powerpc32-linux
+++ b/meta/site/powerpc32-linux
@@ -203,7 +203,6 @@ apr_cv_use_lfs64=${apr_cv_use_lfs64=yes}
 apr_cv_epoll=${apr_cv_epoll=yes}
 apr_cv_pthreads_cflags=${apr_cv_pthreads_cflags=-pthread}
 apr_cv_pthreads_lib=${apr_cv_pthreads_lib=-lpthread}
-apr_cv_mutex_recursive=${apr_cv_mutex_recursive=yes}
 ac_cv_func_mmap=${ac_cv_func_mmap=yes}
 ac_cv_file__dev_zero=${ac_cv_file__dev_zero=yes}
 ac_cv_sizeof_off_t=${ac_cv_sizeof_off_t=4}
-- 
1.7.9.5

Update: Make sure you check the source to get the latest version of the patch https://github.com/vmayoral/beagle-ros.

Standard