Skip to content

Development workflow of drag&bot custom components

Summary

The page gives an overview on how to develop a component for drag&bot using tools of drag&bot and the KemroX system of KEBA.

Moreover knowledge of developing a ROS package is required. Get started here: ROS Tutorials.

drag&bot Components

Components you develop for drag&bot are based on ROS packages. The drag&bot ROS system runs in a docker container, which is mounted by the drag&bot Runtime. The container is called dnb_runtime and can be handled as a normal Docker container. The developed components needs to be deployed in a mounted workspace to this container.

Deploy components

The access the file system of a KemroX system you will need SSH. The SSH setup for a KemroX system can be found in the user manual of the KemroX system. To copy data from you host system to the KEBA controller you can use the following tools:

SSH/SCP Tool Description
PuTTy (Recommended) A SSH client for accessing servers like the KEBA C5 controller.
WinSCP (Recommended) A graphical SFTP/SCP client and file manager for Windows.
PowerShell SCP A command-line tool on Windows to copy files to a remote device/server.

Location for custom components

To be able to compile and execute components, they need to be placed in the overlay buildsystem of ROS. This is a regular ROS catkin workspace. On a KemroX system the overlay is located at the following directory:

/workspace/application/dragandbot/dnb_catkin_ws/src

Use WinSCP to copy your developed drag&bot Component to the system into the mentioned location.

Executable rights for python scripts

Make sure to use chmod +x on your *.py script files which are started by a ROS launch-file. When copied from a Windows filesystem those executable rights can be lost and needs to be set again on the controller side.

Example:

cd /workspace/application/dragandbot/dnb_catkin_ws/src/
chmod +x dnb_component_example/scripts/program.py

Auto-build of dnb_runtime

At startup the dnb_runtime docker container all components are build automatically. Further packages in the overlay have priority over ROS packages in the docker container.

Improve build speed

To improve build performance the automatic catkin clean needs to be disabled on container startup. This can be done with the following steps:

  1. Make sure you system is up and running.
  2. Access the KemroX system: ssh <user>@192.168.100.100 (where user is the admin user of a system e.g. root, admin. The IP may vary on your setup.)
  3. Access the drag&bot console: dnb-console
  4. Open the docker entryfile: nano /docker-entrypoint.sh
  5. Modify line 8 from: catkin clean -y && catkin build to catkin build.
  6. Save and exit file by Ctrl + X and hit y and Enter.

Now on start only build will be executed. The build will skip already built packages, which improves speed significantly. When you now delete packages from the overlay you need to execute catkin clean manually.

drag&bot Console

For accessing the ROS environment with known commands you have to switch into the docker container. This can be done with the following command when on the controller:

dnb-console
This is a short command for docker exec -it dnb_runtime /bin/bash which is basically an interactive shell in the running ROS container.

ROS commands

In the docker container you can enter the known ROS environment commands like the following:

ROS command Description
rostopic list A list of published ROS topics to subscribe
rostopic echo <topic> Subscribe to a published topic from the system, where <topic> is the topic name to subscribe to.
rosnode list A list of running ROS nodes. A component usually consist of at least one node.
rosservice list A list of running ROS services.
rosservice call <service_name> <data> A service can be called manually like this to test existing or self-build service. Where <service_name> needs you service name and data is the input data for a service.

Building ROS packages in the overlay

Building the ROS packages in the overlay is possible in several ways. The first approach is to restart the drag&bot Runtime. This will stop the ROS core and all running ROS nodes, rebuild the overlay and restart everything. This can be achieved with the following command on the controller:

docker restart dnb_runtime

The second way is especially meant for ROS packages under development. To rebuild the ROS packages in the overlay, enter the docker container by dnb-console and call the following command, which will rebuild the overlay on the fly.

catkin build

Running ROS packages in the overlay

Assuming that the docker container built the overlay successfully it will automatically start the drag&bot system. If your ROS packages is already a drag&bot Component with a correct component definition as described here, you can add it to your robot system in the Component Manager and use it like a regular component.

If your ROS packages is not yet a drag&bot component, because it is still under development, it has to be started manually. For this enter the docker container and start your ROS packages with one of the following known ROS commands:

rosrun <package_name> <node_name>
roslaunch <package_name> <launchfile_name>

Installing dependencies for component

In the special case you need rosdep dependencies to run your ROS packages, enter the docker container and type the following commands:

source /root/dnb_catkin_ws/devel/setup.bash
rosdep install -a -y -r --ignore-src --os=ubuntu:xenial

After this restart the drag&bot Runtime. Please note, that these dependencies will get lost each time you update the drag&bot Runtime, as an update actually replaces the used docker container.

Logging of ROS

To identify everything was built correctly you can view the log files of the catkin build process and the ROS startup entrypoint. To open the logs there are two possibilities:

Option A: Open the last 2000 lines of the latest logs of the dnb_runtime container.

dnb-logs

Option B: Open and follow the most recent logs of the dnb_runtime container.

dnb-logs-live