RoboWare Studio provides a wizard procedure to create C++ and Python classes and ROS nodes. To create a ROS node, do the following:
- Right-click on the package name and select either Add C++ ROS Node or Add Python ROS Node.
- Type the name of the package.
- By default, two source files will be created: an example of a publisher and a subscriber node. For example, if you inserted chatter as a package name, a chatter_pub.cpp file and a chatter_sub.cpp file will be created.
- Compile the package. The CMakeLists.txt file has already been updated according to the newly created nodes. You can remove the publisher or the subscriber in case you don't need them; the CMakeLists.txt file will be automatically updated.
As well as ROS nodes, we can create C++ classes using the following method:
- Right-click on the package name
- Choose Add C++ Class
- Type the name of the class—for example, roboware_class
- A header file will be created in the include directory of the package named roboware_class.h, while a CPP file named roboware_class.cpp will be added to the src directory
- Select an executable to link the class just created, in order to import the class into another ROS node of the package
- The CMakeLists.txt will be updated automatically