Many of the coolest and most useful capabilities of ROS already exist somewhere in its community. Often, stable resources exist as easily downloadable debian packages. Alternately, some resources are less tested or more “cutting edge” and have not reached a stable release state; you can still access many of these resources by downloading them from their repository (usually housed on Github). Getting these git packages takes a few more steps than the debian packages. In this module we will access both types of packages and install them on our system.
Scan-N-Plan Application: Problem Statement¶
We have a good installation of ROS, and we have an idea of some packages that exist in ROS that we would like to use within our program. We have found a package which is stable and has a debian package we can download. We’ve also found a less stable git package that we are interested in. Go out into the ROS world and download these packages!
- A certain message type exists which you want to use. The stable ROS package is called: calibration_msgs
- You are using an AR tag, but for testing purposes you would like a node to publish similar info : fake_ar_publisher
Your goal is to have access to both of these packages’ resources within your package/workspace:
- calibration_msgs (using apt-get)
- fake_ar_publisher (from git)
Scan-N-Plan Application: Guidance¶
Install Package from apt Repository¶
Open a terminal window. Type roscd calibration_msgs.
- This command changes the working directory to the directory of the ROS calibration_msgs package.
- You should see an error message `No such package/stack ‘calibration_msgs’ .
- This package is not installed on the system, so we will install it.
Type apt install ros-kinetic-calibration-msgs.
apt install ros-kinetic-calibration-msgs
- The program will say it cannot install the package, and suggests that we must run the program as root.
- Try pressing the TAB key while typing the package name.
- The system will try to automatically complete the package name, if possible.
- Frequent use of the TAB key will help speed up entry of many typed commands.
Type sudo apt install ros-kinetic-calibration-msgs.
sudo apt install ros-kinetic-calibration-msgs
- Note the use of the sudo command to run a command with “root” (administrator) privileges.
- Enter your password, and (if asked) confirm you wish to install the program.
Type roscd calibration_msgs again.
- This time, you will see the working directory change to /opt/ros/kinetic/share/calibration_msgs.
Type sudo apt remove ros-kinetic-calibration-msgs to remove the package.
sudo apt remove ros-kinetic-calibration-msgs
- Don’t worry. We won’t be needing this package for any future exercises, so it’s safe to remove.
Type cd ~ to return to your home directory.
Download and Build a Package from Source¶
Identify the source repository for the desired package:
- Go to github.
- Search for fake_ar_publisher.
- Click on this repository, and look to the right for the Clone or Download, then copy to clipboard.
Clone the fake_ar_publisher repository into the catkin workspace’s src directory.
cd ~/catkin_ws/src git clone https://github.com/jmeyer1292/fake_ar_publisher.git
- Use Ctrl-Shift-V to paste within the terminal, or use your mouse to right-click and select paste
- Git commands are outside of the scope of this class, but there are good tutorials available here
Build the new package using
The build command can be issued from anywhere inside the catkin workspace
Once the build completes, notice the instruction to “re-source setup files to use them”.
In the previous exercise, we added a line to our
~/.bashrcfile to automatically re-source the catkin setup files in each new terminal.
This is sufficient for most development activities, but you may sometimes need to re-execute the
sourcecommand in your current terminal (e.g. when adding new packages):
Once the build completes, explore the build and devel directories to see what files were created.
Run rospack find fake_ar_publisher to verify the new packages are visible to ROS.
rospack find fake_ar_publisher
- This is a helpful command to troubleshoot problems with a ROS workspace.
- If ROS can’t find your package, try re-building the workspace and then re-sourcing the workspace’s