Autonomous 2WD Robot - ROS Packages and Nodes

On the file system level, ROS uses Packages which are part of every ROS distribution such as ROS Melodic and defined as follows:

Packages are the main unit for organizing software in ROS. A package may contain ROS runtime processes (nodes), a ROS-dependent library, datasets, configuration files, or anything else that is usefully organized together. Packages are the most atomic build item and release item in ROS. Meaning that the most granular thing you can build and release is a package.

Best Practices

The project follows ROS best practices and uses catkin-tools, the successor of catkin_make. See also the history of ROS build tool catkin and the workspace mechanics. see also overview of catkin.

Naming Conventions

ROS provides naming conventions for packages (REP-144) and nodes which we will use as guidance to name the packages and nodes for the 2WD robot.

When possible, the default name of a node should follow from the name of the executable used to launch the node. This default name can be remapped at startup to something unique.

To follow REP-144, each sensor will get its own package with one or more nodes to be executed. Following this scheme it will be possible to use the sensors in other projects and work with existing packages such as packages from the navigation stack.

Standard Units of Measure and Coordinate Conventions

Please see REP 103 for documentation on the standard units of measure and coordinate conventions followed here.

Packages and Nodes

Category Package Nodes topic
actuator/control grove_motor_driver motor_driver /cmd
sensor/localization grove_motor_driver speedsensor /odom
sensor/perception grove_ultrasonic_driver ranger /distance
sensor/perception rpi_camera_driver camera /2wdrobotcam/image_raw

Create a new Catkin package

To create a new Catkin package when in the src folder of your ROS workspace use the catkin create pkg command:

$ catkin create pkg PKG_NAME [--catkin-deps [DEP [DEP ...]]]

For example the grove_ultrasonic_ranger package is created with the following command:

fjp@ubuntu:~/git/diffbot/ros/src$ catkin create pkg grove_ultrasonic_ranger --catkin-deps rospy roscpp sensor_msgs
Creating package "grove_ultrasonic_ranger" in "/home/fjp/git/diffbot/ros/src"...
Created file grove_ultrasonic_ranger/CMakeLists.txt
Created file grove_ultrasonic_ranger/package.xml
Created folder grove_ultrasonic_ranger/include/grove_ultrasonic_ranger
Created folder grove_ultrasonic_ranger/src

Leave a comment