This workspace is dedicated to cross-compile ROS packages targeting a Raspberry Pi and using a toolchain generated using the Yocto Project build tools.
- Thomas Fuhrmann (@furmi), Heudiasyc Laboratory : [email protected]
The first thing to do is to download the SDK containing ROS :
wget https://uav.hds.utc.fr/src/toolchain/robomap3-glibc-x86_64-meta-toolchain-flair-ros-cortexa7hf-neon-vfpv4-2.1.3.sh
Note : this toolchain has been built to work with particular ROS packages, it does not contain all ROS packages, but just a few of them.
Or to use a similar toolchain that you may have generated yourself.
Once the SDK is downloaded, make it executable and launch it. This will install the environment.
Please do not change the default path, otherwise you will have to change a lot of things to make it work.
sudo chmod +x robomap3-glibc-x86_64-meta-toolchain-flair-ros-cortexa7hf-neon-vfpv4-2.1.3.sh
./robomap3-glibc-x86_64-meta-toolchain-flair-ros-cortexa7hf-neon-vfpv4-2.1.3.sh
An other thing to do is to remove all ROS linked things in your ~/.bashrc file (sourcing your computer ROS environment, exporting anu ROS variable, ...), as the cross-compilation process needs it's own ROS environment variables.
When all is setup correctly, you can start cross-compilation. Create a src directory in your workspace and put there the nodes you want to cross-compile.
Then launch the compilation process :
./make.sh
If you try to compile a simple ROS node which does not depends on multiple other ROS packages, it should compile...
If you try to compile some ROS packages with a lot of dependencies with other ROS packages, the toolchain may not have them already compiled and installed. You have to generate a new toolchain on your own. See the robomap3-rt project
Before uploading, you should read the ROS node modification for uploading section.
Once all your nodes are compiled, a simple script enables you to send them to the Raspberry Pi :
./upload.sh IP_RASPBERRY_PI
Warning : for now the script only uploads the share and the lib folders, generated by a catkin_make install process. It may lack of some files (plugin.xml for instance). Consider sending them on the Raspberry Pi by hand or be modifying the script.
In order to let the upload.sh script work, you have to make sure to use the INSTALL facilities in your nodes.
In the CMakeLists.txt file, add the following lines to indicate what files you want to install (these files will be uploaded on the Raspberry Pi). Don't forget to replace 'name_of_ros_node' and 'my_file' names.
install(TARGETS name_of_ros_node DESTINATION${CATKIN_PACKAGE_BIN_DESTINATION})
install(FILES my_file DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
These instructions are the minimal ones. If you want to send other files on the Raspberry Pi, add them in the install directive.