Note: This tutorial assumes that you have completed the previous tutorials: Yocto setup on the Galileo. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Adding Packages from the host
Description: Build a package file on the host, then install it on the Galileo.Tutorial Level: INTERMEDIATE
Next Tutorial: Adding your own code
Introduction
This tutorial will create a package file on the host, transfer it to the Galileo card, and install it there. This assumes you already have a ~/catkin_ws workspace set up as per the beginner tutorials.
Create the package
Create the package on the host machine:
$ source ~/catkin_ws/devel/setup.bash $ cd ~/catkin_ws/src $ catkin_create_pkg clanton_tutorial std_msgs rospy $ cd ~/catkin_ws $ catkin_make $ cd - $ mkdir scripts $ cd scripts $ wget https://raw.github.com/ros/ros_tutorials/groovy-devel/rospy_tutorials/001_talker_listener/talker.py $ wget https://raw.github.com/ros/ros_tutorials/groovy-devel/rospy_tutorials/001_talker_listener/listener.py $ chmod +x *.py $ cd ..
Edit CMakeLists
Edit CMakeLists.txt, find the install section, and make sure the install clause looks like this:
install(PROGRAMS scripts/talker.py scripts/listener.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} )
Run:
$ cd ~/catkin_ws $ catkin_make
Try it out on the host to make sure it works. In one window:
source ~/catkin_ws/install/setup.bash roscore
In another window:
source ~/catkin_ws/install/setup.bash rosrun clanton_tutorial talker.py
In another window:
source ~/catkin_ws/install/setup.bash rosrun clanton_tutorial listener.py
If everything is working right, you should see "I heard hello world" in the last window. Now kill them all.
== Make the package ==
$ cd ~/devel_gal/meta-clanton_v0.7.5/meta-ros/recipes-ros $ mkdir clanton-tutorial $ cd clanton-tutorial $ cp -r ~/catkin_ws/src/clanton_tutorial .
Edit a new file called "clanton-tutorial.bb" and make it look like this:
LICENSE="GPLv2" SRC_URI = "file:///home/jfstepha/catkin_ws/src/clanton_tutorial" SECTION = "devel" LIC_FILES_CHKSUM = "file:///home/jfstepha/foobar/lic.txt;md5=d440307f45f8d0776b0ce3be6de70d48" DEPENDS = "catkin rospy std-msgs" RDEPENDS = "rospy std-msgs" S = "${WORKDIR}/clanton_tutorial" inherit pkgconfig catkin ROS_SPN = "ros_foobar" FILES_${PN} += "/usr/share/clanton_tutorial/package.xml" FILES_${PN} += "/usr/share/clanton_tutorial/cmake/clanton_tutorialConfig.cmake" FILES_${PN} += "/usr/share/clanton_tutorial/cmake/clanton_tutorialConfig-version.cmake" do_fetch () { cp -r /home/jfstepha/catkin_ws/src/clanton_tutorial ${WORKDIR} }
TODO: finish these steps:
- Find the generated .pkg file
- Copy it to the clanton card
- Install it with opkg.