Skip to content

How to create a new component?


  • Information about how to create a new component.
  • module.yaml definition

What can be integrated as a component?

Technically, each ROS package is susceptible to be integrated as a component in drag&bot. Components are thought to provide an interface to hardware or software algorithms, e.g. a robot driver, a computer vision component or a program library.

Component structure

Each drag&bot component requires to have a module_config directory containing at least one module_X.yaml. Those YAML files describe which ROS launch script will be initialized, its description and the different parameters which can be configured. Some components can have different variations and therefore if more than one module_X.yaml exists, all of them will be selectable in the component manager tab of drag&bot Studio. This is for example the case of the UR driver, where the same component allows to use UR3, UR5 and UR10 robots.

Fields in the .yaml file are:

  • package: the name of the corresponding ROS package
  • name: displaying name in drag&bot
  • description: extra information about the component
  • type: semantic categorization of the component. This follows an hierarchical description like a directory in linux. Typical categorization is driver/robot/name_of_the_robot
  • roslaunch: name of the ROS launch file which will be started with the component.
  • rosshutdown (optional): name of the ROS launch file which will be started when the component is stopped or before the configuration is updated. It's purpose is to clear the components ROS parameters from the ROS Parameter Server.
  • configuration: a list of variables which can be configured. These variables are passed to the ROS launch file as input arguments (arg).
  • nodes: ROS nodes which are started and monitored with the component.
  • status_topic: name of the topic which publishes the status of the component.

Configuration variables contained in configuration tag follow this structure:

  • id: name of the variable
  • namespace: left empty
  • name: displaying name in drag&bot
  • description: extra information
  • datatype: drag&bot uses this tag to parse and limit the entered values for this variable. Accepted values are: string, int, float, bool, select.
  • default: default value of the variable. This is defined as string.


  • node_callerid: name of the node in ROS
  • type: ROS node file name

For example, the module_ur3.yaml contains the following data:

package: ur_driver
name: "Universal Robot Model 3"
description: "Universal Robot Model 3"
type: driver/robot/ur/3
roslaunch: ur3.launch
rosshutdown: stop.launch
  - id: ip
    namespace: ''
    name: 'Robot IP'
    description: 'The IP address of the robot'
    datatype: string
    default: ''
  - id: sim
    namespace: ''
    name: 'Simulation'
    description: 'True when using the UR simulation'
    datatype: bool
    default: 'true'
  - node_callerid: /ur_driver
    type: ur_driver
status_topic: /ur_driver/status

A component should publish a ROS topic peridically indicating its health status. The message can be found in this public github repository (ComponentStatus.msg). Please check the following examples to see how status is published. Also be aware, that the status topic indicated in module_x.yaml must be the same.


drag&bot provides two components as public examples. You need to clone each of them in your ~/dnb_catkin_ws/src directory in order to install them in drag&bot. During restart of drag&bot the components will be compiled and included automatically in the component list.

In order to understand the examples some ROS and programming knowledge is recommended.

dnb_component_example - Add two numbers


This component can be found here in the drag&bot public Github 💾.

The dnb_component_example was created for teaching purposes. A ROS node programmed in Python provides a ROS service for adding two numbers. It also includes a packaged function block in the fnb directory, which can be imported in drag&bot Studio.

The component has a couple of configuration variables. Only Sum offset and Use offset are relevant for the calculation.

  • Sum offset: a third value to add together with the inputs of the function block.
  • Float example: unused
  • String example: unused
  • Selector example: unused
  • Use offset: activates or deactivates the offset for the sum result.

The ROS launch file start.launch passes the arguments as parameters to the ROS node. The ROS node also publishes its status through the status topic. This is not compulsory, but recommended for letting drag&bot know the health of a component.

The included function block called AddTwoNumbers has two floats as inputs and produces a float number as output. These two numbers are added together with the offset to produce the result.

usb_cam - Generic USB camera driver


This component can be found here in the drag&bot public Github 💾.

The usb_cam component is the generic USB camera driver forked from the official ROS repository. It is programmed in C++. Now, the component includes a yaml file which makes it visible to drag&bot when located in dnb_catkin_ws/src directory.

Component configuration variables included in the module_usb_cam.yaml:

  • Video device: the linux video device file located in /dev
  • Width: pixel width
  • Height: pixel height

Once the component is running, it publishes a topic containing the picture. This topic is visible in drag&bot Studio, for example, in the Camera tab. Also localization vision function blocks can use this topic for the localization.