Difference between revisions of "Package creation and building"

From Lofaro Lab Wiki
Jump to: navigation, search
(Package creation and building)
 
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
 
To create a package, go to you catkin workspace, source folder by commanding   
 
To create a package, go to you catkin workspace, source folder by commanding   
  
<nowiki>$ cd ~/catkin_ws/src
+
  <nowiki>$ cd ~/catkin_ws/src</nowiki>
  
  
<nowiki>$ catkin_create_pkg robo_package std_msgs rospy roscpp</nowiki>
+
  <nowiki>$ catkin_create_pkg robo_package std_msgs rospy roscpp</nowiki>
  
  
Line 17: Line 17:
 
We can check the direct and indirect dependencies of the package by commanding  
 
We can check the direct and indirect dependencies of the package by commanding  
  
<nowiki>$ rospack depends1 robo_package</nowiki>
+
  <nowiki>$ rospack depends1 robo_package</nowiki>
  
 
And  
 
And  
  
<nowiki>$ rospack depends1 rospy</nowiki>
+
  <nowiki>$ rospack depends1 rospy</nowiki>
  
  
Line 27: Line 27:
  
 
# In a catkin workspace
 
# In a catkin workspace
<nowiki>$ catkin_make --source my_src</nowiki>
+
<nowiki>$ catkin_make </nowiki>
<nowiki>$ catkin_make install --source my_src</nowiki>  # (optionally)
+
<nowiki>$ catkin_make install --source my_src</nowiki>  # (optionally)

Latest revision as of 19:04, 19 October 2014

When you start your new robotics project you will need to create nodes to run your sensors and actuators. You might need to make it in a large number. You will need to create and build ros packages first where you can put you node files and other libraries/tools.

Before creating a ros package you need to have a ros workspace. In our case a catkin workspace has been made. We can use the workspace to reside our packages. When you make a package it will give you a catkin complaint xml file and a cmake.txt file where the package information will be written. Let’s assume you have made a package named robo_package. If you command for file listing of the package instantly after creating it will show two files.

 CMakeLists.txt
 package.xml

To create a package, go to you catkin workspace, source folder by commanding

 $ cd ~/catkin_ws/src


 $ catkin_create_pkg robo_package std_msgs rospy roscpp


The above command will make a package named beginner-tutorial which have dependencies over std_msg, rospy and roscpp.

We can check the direct and indirect dependencies of the package by commanding

 $ rospack depends1 robo_package

And

 $ rospack depends1 rospy


If all dependencies are installed you can build your package

  1. In a catkin workspace
$ catkin_make 
$ catkin_make install --source my_src  # (optionally)