Creating an ROS package and metapackage

As explained before, creating packages can be done manually, but to avoid the tedious work involved, we will use the catkin_create_pkg command-line tool.

We will create the new package in our recently initialized workspace using the following commands:

    $ cd ~/dev/catkin_ws/src
    $ catkin_create_pkg chapter2_tutorials std_msgs roscpp  

The format of this command includes the name of the package and the dependencies that will have the package, in our case, std_msgs and roscpp. This is shown in the following command:

    catkin_create_pkg [package_name] [dependency1] ... [dependencyN]  

The following dependencies are included:

  • std_msgs: This contains common message types representing primitive data types and other basic message constructs, such as multiarray.
  • roscpp: This is a C++ implementation of ROS. It provides a client library that enables C++ programmers to quickly interface with ROS topics, services, and parameters.

If all the parameters are correct, the output will look as follows:

As we saw earlier, you can use the rospack, roscd, and rosls commands to retrieve information about the new package. The following are some of the operations which can be performed:

  • rospack profile: This command informs you about the newly-added packages to the ROS system. It is useful after installing any new package.
  • rospack find chapter2_tutorials: This command helps us find
    the path.
  • rospack depends chapter2_tutorials: This command helps us see the dependencies.
  • rosls chapter2_tutorials: This command helps us see the content.
  • roscd chapter2_tutorials: This command changes the actual path.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.56.114