Embedded Motion Control/Tutorials/Building a ROS package

From Control Systems Technology Group
Jump to navigation Jump to search

Description: This tutorial covers the toolchain to build a package.

Contents Building Packages Using rosmake rosmake multiple packages Review


Building Packages

Once all the system dependencies are installed, we can build our package that we just created.

Using rosmake

rosmake is just like the make command, but it does some special ROS magic. When you type rosmake beginner_tutorials_<YOUR_NAME>, it builds your package, plus every package that it depends on, in the correct order. Since we listed rospy, roscpp, and std_msgs as dependencies when creating our ROS package, these packages (and their dependencies, and so on) will be built by rosmake as well.

Usage:

rosmake [package]

Try:

rosmake beginner_tutorials_<YOUR_NAME>

This previous command may take a while to finish. As it is running you should see some output like:

[ rosmake ] rosmake starting...                                                                                                                                                  
[ rosmake ] Packages requested are: ['beginner_tutorials_sjoerd']                                                                                                                
[ rosmake ] Logging to directory /home/sdries/.ros/rosmake/rosmake_output-20140424-092909                                                                                        
[ rosmake ] Expanded args ['beginner_tutorials_sjoerd'] to:
['beginner_tutorials_sjoerd']                                                                                        
[rosmake-0] Starting >>> catkin [ make ]                                                                                                                                         
[rosmake-0] Finished <<< catkin ROS_NOBUILD in package catkin
 No Makefile in package catkin                                                                                     
[rosmake-0] Starting >>> genmsg [ make ]                                                                                                                                         
[rosmake-2] Starting >>> cpp_common [ make ] 
...
...
...
[ rosmake ] [ 22 of 23  Completed ]
[rosmake-0] Starting >>> beginner_tutorials_sjoerd [ make ]                                                                                                                      
[rosmake-0] Finished <<< beginner_tutorials_sjoerd [PASS] [ 5.17 seconds ]                                                                                                       
[ rosmake ] Results:                                                                                                                                                             
[ rosmake ] Built 23 packages with 0 failures.                                                                                                                                   
[ rosmake ] Summary output to directory                                                                                                                                          
[ rosmake ] /home/sdries/.ros/rosmake/rosmake_output-20140424-092909 

rosmake multiple packages

We can also use rosmake to build multiple packages at once.

Usage:

rosmake [package1] [package2] [package3]

Review

Lets just list some of the commands we've used so far:

  • rosdep = ros+dep(endencies) : a tool to install package dependencies
  • rosmake = ros+make : makes (compiles) a ROS package

Now that you have built your ROS package, it is good to get some insight into what ROS nodes, topics and parameters are. Head back to the Tutorials Overview page and start the ROS tutorials.