Tuesday, 12 July 2011

Compiling ROS stack openni_kinect/openni_tracker

While compiling openni_tracker, the compiler cannot find the OpenNI headers.

Append the following line to openni_tracker's CMakeLists.txt

include_directories(/usr/include/ni)

ROS kdl patch failure

While compiling kdl, *make* tries to apply total.patch. However, it is already patched.

  Makefile:61: warning: overriding recipe for target `clean'
  /usr/local/opt/ros/ros/core/mk/cmake.mk:24: warning: ignoring old recipe for target `clean'
  cd build/kdl-tar && patch -p0 < ../../total.patch
  patching file src/bindings/python/CMakeLists.txt
  Reversed (or previously applied) patch detected!  Assume -R? [n] 
  Apply anyway? [n] 
  Skipping patch.
  1 out of 1 hunk ignored -- saving rejects to file src/bindings/python/CMakeLists.txt.rej
  patching file src/tree.cpp
  Reversed (or previously applied) patch detected!  Assume -R? [n] 
  Apply anyway? [n] 
  Skipping patch.
  1 out of 1 hunk ignored -- saving rejects to file src/tree.cpp.rej
  patching file tests/kinfamtest.cpp
  Reversed (or previously applied) patch detected!  Assume -R? [n] 
  Apply anyway? [n] 
  Skipping patch.
  1 out of 1 hunk ignored -- saving rejects to file tests/kinfamtest.cpp.rej
Comment out the following line in *Makefile*. Like so:
#cd $(SOURCE_DIR) && patch -p0 < ../../$(PATCH)

Then kdl should compile.

ROS pcl_ros fails to compile with GCC 4.6

Error:
/usr/local/opt/ros/perception_pcl/pcl/include/pcl/ros/conversions.h:284:9: error: taking address of temporary [-fpermissive]

Code fix:
First assign the temporary variable to a local variable. Then reference the address of the local variable. However, this is more complicated with arrays being copied with memcpy. One way is to use a for-loop to replace memcpy.
See patch for a similar error in another library.

Since the change is somewhat drastic, I compiled pcl_ros with gcc-4.5 instead.

# install gcc-4.5
yaourt -S gcc45

Edit perception_pcl/pcl_ros/CMakeLists.txt.
Add the following lines (prefixed with +) near the top, *after* the rosbuild directives.

rosbuild_init()
...

+set (CMAKE_C_COMPILER gcc-4.5)
+set (CMAKE_CXX_COMPILER g++-4.5)

(If the compilers are set before the rosbuild directives, cmake will enter an infinite loop during configuration!)

Then pcl_ros should compile.

Compiling ROS pcl package

The pcl package depends on libhdf5_cpp.so.
However, Archlinux hdf5 does not include libhdf5_cpp.so. See reason.

Therefore, you will need to download and compile hdf5 with the --enable-cxx configure flag.

Download hdf5 source package.

tar -xjf hdf5-1.8.7.tar.bz2
cd hdf5-1.8.7
./configure --prefix=/usr/local --enable-cxx
make
make install

A number of other patches are also necessary when compiling with GCC 4.6.
5057
5054

Saturday, 9 July 2011

Compiling ROS pluginlib with boost 1.4.6

pluginlib cannot be compiled with boost 1.4.6, due to changes in API.
Patch can be found at ros-pkg ticket.

Automatic patching will fail, due to later changes to boost_fs_wrapper.cpp.
Apply the patch manually.

Wednesday, 6 July 2011

Installing irobot_create

The driver is available from the Brown University brown-ros-pkg site.

Download, extract, and compile using ROS.
You should work in a user ROS project directory (such as ~/projects/ros), which as been added to $ROS_PACKAGE_PATH.

cd [ROS project directory]
wget http://brown-ros-pkg.googlecode.com/files/irobot_create_2_1.tar.bz2
tar -xjf irobot_create_2_1.tar.bz2
rosmake irobot_create_2_1

Plug iRobot Create through USB, which should show up as /dev/ttyUSB0
Make ensure you have access to /dev/ttyUSB0.

sudo chmod 666 /dev/ttyUSB0

To test, start roscore and run irobot_create/driver.py

roscore
rosrun irobot_create_2_1 driver.py

In a separate terminal,

# Examine the service
rosservice type tank | rossrv show
# Publish to the service; make the robot spin
rosservice call tank -- 0 -10 10

The last command will instruct the robot to drive the left wheel at -10 mm/s and the right wheel at 10 mm/s, which causes the robot to spin.

Installing ROS bullet

The bullet library does not compile out of the box with GCC 4.6.
The patch is available at:
http://code.google.com/p/bullet/issues/detail?id=284

Download zero_initialize.patch to $ROS_ROOT/../geometry/bullet/
Apply patch and compile.

cd $ROS_ROOT/../geometry/bullet
patch build/bullet_svn/src/BulletSoftBody/btSoftBodyInternals.h -i zero_initialize.patch
rosmake bullet