ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# Revision history [back]

Did you check errata to the book?

It says:

... Assuming (as in Chapter 2) your workspace is ~/catkin_ws, the following commands would create a basics package in that workspace that depends on rospy:

user@hostname$cd ~/catkin_ws/src user@hostname$ catkin_create_pkg basics rospy


The examples and discussion in Chapter 3 should then work as expected, in the ~/catkin_ws/src/basics directory. The other way to make the examples work in this chapter, besides typing them in manually, is to clone this entire repository; then you will have the basics directory (with all the examples) that you can symlink into your workspace. For example, assuming there is an existing workspace in ~/catkin_ws

user@hostname$git clone https://github.com/osrf/rosbook ~/rosbook user@hostname$ ln -s ~/rosbook/code/basics ~/catkin_ws/src
user@hostname$cd ~/catkin_ws user@hostname$ catkin_make


(that last step will ensure there is a valid setup file for this workspace created in ~/catkin_ws/devel/setup.bash) Then you can source the setup file of that workspace: user@hostname$. ~/catkin_ws/devel/setup.bash and the examples should work. Personally I would advise following the first snippet with creating a catkin package as it is way cleaner than the other approach. Did you check errata to the book?book? It says: ... Assuming (as in Chapter 2) your workspace is ~/catkin_ws, the following commands would create a basics package in that workspace that depends on rospy: user@hostname$ cd ~/catkin_ws/src
user@hostname$catkin_create_pkg basics rospy  The examples and discussion in Chapter 3 should then work as expected, in the ~/catkin_ws/src/basics directory. The other way to make the examples work in this chapter, besides typing them in manually, is to clone this entire repository; then you will have the basics directory (with all the examples) that you can symlink into your workspace. For example, assuming there is an existing workspace in ~/catkin_ws user@hostname$ git clone https://github.com/osrf/rosbook ~/rosbook
user@hostname$ln -s ~/rosbook/code/basics ~/catkin_ws/src user@hostname$ cd ~/catkin_ws
user@hostname$catkin_make  (that last step will ensure there is a valid setup file for this workspace created in ~/catkin_ws/devel/setup.bash) Then you can source the setup file of that workspace: user@hostname$ . ~/catkin_ws/devel/setup.bash and the examples should work.

Personally I would advise following the first snippet with creating a catkin package as it is way cleaner than the other approach.