osrf / rosbook

Example code to accompany the book Programming Robots with ROS
Apache License 2.0
477 stars 238 forks source link

"basics" directory in the topics chapter. #5

Closed carlberry closed 8 years ago

carlberry commented 8 years ago

There's a line in the book on topics, page 34, it states "Remember that the basics directory has to be in your catkin workspace...". However as far as I can tell this is the first mention of the basics directory, previously the user was directed to create a directory to store code in called "my_awesome_code" (p.15). I believe these are equivalent but it can cause confusion (well it confused me).

codebot commented 8 years ago

Thank you for pointing out this issue. Indeed, there are a few steps missing. The examples in Chapter 3 are intended to be in a directory/package called basics , but the text does not describe the required terminal command to create this package.

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.

We will add this to the official errata for the book. Thank you for pointing it out.

codebot commented 8 years ago

Maybe this is redundant now because you've found this repository already to post the issue, but 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... but I'm just noticing that the markup used to publish the text prevents the shebang from being interpreted correctly by the shell. We'll find a solution for that soon.

codebot commented 8 years ago

Closing this issue for now; feel free to re-open if there are still problems.

gerkey commented 8 years ago

Did this change make it into the errata? (Just checking to make sure that we don't lose track of it.)

codebot commented 8 years ago

Yes, I added it just now.