[Documentation] [TitleIndex] [WordIndex

ROSPod

ROSPod is what we've dubbed our effort to get ROS running on the iPod Touch/iPhone (iROS is already taken). This is still an work in progress/proof of concept, but we hope in the coming months to make it a stable platform for ROS development. The iPod Touch and iPhone combine a high-quality display with different modes of interaction that make it appealing for robotics interfaces. This page documents our current efforts, for those who wish to try it at home. You will of course need to familiarize yourself first with Apple's iPhone/iPod Touch development process.

We don't really have much of a cross-compilation framework in place yet for ROS, so most of the time spent getting things working was due to figuring out how that worked with the iPhone, CMake, etc. The largest chunk of time by far though was getting our 3rdparty dependencies built (APR and boost were the big offenders). Total time to cross-compile was a couple days worth of part-time work.

Once we had things compiled it took about 30 minutes and twenty lines of code on top of the accelerometer demo to get tilt-based control working on the iPhone.

Below are some notes on the details of how we got things working.

Experimental Setup

Simulator

Environment

export CPPFLAGS=-B/Developer/Platforms/iPhoneSimulator.platform/Developer/usr
export CXXFLAGS=-B/Developer/Platforms/iPhoneSimulator.platform/Developer/usr
export CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/cpp
export CXX=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++
export CFLAGS=-B/Developer/Platforms/iPhoneSimulator.platform/Developer/usr
export CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc
export INSTALL_DIR=$HOME/iphonedev/simulator/install

Compilation

APR

./configure --prefix=$INSTALL_DIR --disable-shared

APR-util

./configure --prefix=$INSTALL_DIR --disable-shared --with-apr=$INSTALL_DIR

log4cxx

./configure --prefix=$INSTALL_DIR --disable-shared --with-apr=$INSTALL_DIR --with-apr-util=$INSTALL_DIR

boost

Note that this is not actually correct, see the iphone device instructions for what is more likely correct

bjam --toolset=darwin macosx-version=iphonesim-2.2 --prefix=$INSTALL_DIR install

Device

Environment

export CXXFLAGS="-B/Developer/Platforms/iPhoneOS.platform/Developer/usr -arch armv6 -miphoneos-version-min=2.2 -gdwarf-2 -mthumb -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk -pipe"
export CFLAGS="$CXXFLAGS"
export CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp
export CXXCPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp
export CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-g++-4.0.1
export CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.0.1
export RANLIB=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib
export AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar
export STRIP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/strip
export LIBTOOL=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool
export INSTALL_DIR=$HOME/iphonedev/iphone/install
export CPATH=$INSTALL_DIR/include:$CPATH
export LIBRARY_PATH=$INSTALL_DIR/lib:$LIBRARY_PATH

Compilation

APR

Edit line 84 of include/apr_general.h to be: #if defined(CRAY) || (defined(__arm) && !(defined(LINUX) || defined(__APPLE__)))

./configure --prefix=$INSTALL_DIR --disable-shared --enable-static --host=arm-apple-darwin ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=no apr_cv_process_shared_works=no apr_cv_mutex_robust_shared=no ac_cv_sizeof_struct_iovec=8 apr_cv_mutex_recursive=yes 

APR-util

./configure --prefix=$INSTALL_DIR --disable-shared --enable-static --host=arm-apple-darwin ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=no apr_cv_process_shared_works=no apr_cv_mutex_robust_shared=no ac_cv_sizeof_struct_iovec=8 --with-apr=$INSTALL_DIR --with-expat=builtin

log4cxx

Edit lines 480 and 488 of src/main/cpp/charsetdecoder.cpp and src/main/cpp/charsetencoder.cpp respectively to be: #if APR_HAS_XLATE

/configure --prefix=$INSTALL_DIR --disable-shared --enable-static --host=arm-apple-darwin ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=no apr_cv_process_shared_works=no apr_cv_mutex_robust_shared=no ac_cv_sizeof_struct_iovec=8 --with-apr=$INSTALL_DIR --with-apr-util=$INSTALL_DIR

Boost

Use the experimental CMake build system (first in 1.38)

rm -rf libs/mpi
rm -rf libs/wave
rm -rf libs/program_options
(these don't compile for the iphone)

mkdir build && cd build
ccmake ..

Set it up to only build static libs, set the install dir as you like, 'c' then 'g' to save an exit

make modularize

edit libs/detail/include/boost/detail/spinlock.hpp, replace line 35 with:
#if defined(__APPLE__) && defined(__arm__)
#  include <boost/detail/spinlock_pt.hpp>
#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ )


make
make install

ROS

On the ROS side, I got things working by building them in order (and also only building static libs). The executables won't link correctly, but it doesn't matter because there's no way to run them anyway. I also had to copy various tools (all the executables in genmsg_cpp for example) from a native ROS build, and kept the native ROS build in my path rather than the cross-compile one (for rospack). I also had to disable python message generation with ROS_LANG_DISABLE=rospy

In XCode I set up all the necessary include dirs (to each ROS package) and added the static libraries directly to the project.


2024-11-09 17:35