Creating Packages

In this exercise, we will create our own ROS package which we continuously improve during this training. Eventually it will become a driver package for a sonar device.

We’ve verified ROS installation, created a workspace, and even built a few times. Now we want to create our own package and our own node some custom code.

  1. Visit the ROS Wiki: Create a Package section and catkin_tools documentation to find out how to create a catkin package.

  2. Your goal is to create a catkin package that:

    • has a name: fake_sonar_driver

    • has the following dependencies:

      • roscpp
      • sensor_msgs
      • geometry_msgs

    Note

    Remember that all packages should be created inside a workspace src directory.

  3. If you succeeded there will be a folder named fake_sonar_driver. Change into that folder and open the package.xml file for editing.

  4. Change the description, version, author, etc., as you like.

  5. Finally, build the package with:

    catkin build
    

    Note

    Further reading on building packages is available here: Building Packages.

  6. Show your successes to the instructor.

Hint

If you forget to add a dependency when creating a package, you can add additional dependencies in the package.xml file.