Create your own RoboKudo packageΒΆ

RoboKudo offers methods to separate your own perception routines, analysis engines and much more into separate ROS packages. Let us start by creating a package calledrk_tutorial. Make sure you are in the source folder of a catkin workspace and run:

rosrun robokudo rk_create_package rk_tutorial
ros2 run robokudo rk_create_package rk_tutorial 

pip install -e ./rk_tutorial

The script will create a new ROS package that has the structure needed for RoboKudo:

'rk_tutorial'
|-src                       -> code and configuration base
   |-rk_tutorial            -> name of your package
      |-annotators
      |-descriptors
         |-analysis_engines -> Pipeline/Analysis Engine definitions (Behaviour Trees)
|-package.xml               -> catkin package xml
|-setup.py                  -> python install information
|-CMakeLists.txt            -> CMake file
'rk_tutorial'
|-rk_tutorial                   -> code and configuration base
  |-annotators
  |-descriptors
     |-analysis_engines -> Pipeline/Analysis Engine definitions (Behaviour Trees)
|-package.xml                   -> package metadata
|-setup.py                      -> python install information
|-setup.cfg                     -> python executable information for ros2 run

You can now add your own annotators and analysis engines(also called pipelines) that can use any component defined in the RoboKudo core package. If you want rk_tutorial to depend on other RoboKudo packages add them to the package.xml (ROS1 & ROS2) and CMakeLists.txt (ROS1 only).

To verify your new package, let us create your very first own analysis engine. Copy over the demo analysis engine from the RoboKudo core package (note the renaming of the file):

cd ~/robokudo_ws/src/
cp ./robokudo/robokudo/src/robokudo/descriptors/analysis_engines/demo.py \
    ./rk_tutorial/src/rk_tutorial/descriptors/analysis_engines/my_demo.py
cd ~/robokudo_ws/src/
cp ./robokudo/robokudo/src/robokudo/descriptors/analysis_engines/demo.py \
    ./rk_tutorial/rk_tutorial/descriptors/analysis_engines/my_demo.py

Open my_demo.py and adapt in the name method the return value to 'mydemo' instead of 'demo'.

Please make sure to rebuild and source your workspace as described below:

cd ~/robokudo_ws
catkin build
source ~/robokudo_ws/devel/setup.bash
cd ~/robokudo_ws
python3 -m colcon build --symlink-install
source ~/robokudo_ws/install/setup.bash

After that, you can start your own analysis engine by executing:

rosrun robokudo main.py _ae=my_demo _ros_pkg=rk_tutorial
ros2 run robokudo main _ae=my_demo _ros_pkg=rk_tutorial

It should show the same result as in the previous tutorial.