ROS 2¶
First steps¶
Install Ubuntu 24.04, upgrade all packages and reboot.
Install ROS 2 Jazzy following the official instructions. Please use
ros-jazzy-desktop
and install the dev tools.-
Install RoboKudo apt dependencies and tooling:
sudo apt install ros-jazzy-py-trees ros-jazzy-py-trees-ros ros-jazzy-py-trees-ros-viewer
-
Creating a ROS 2 workspace:
-
Source the ROS 2 installation:
source /opt/ros/jazzy/setup.bash
Do this once per shell instance or automate this by adding the above line at the end of your
~/.bashrc
. -
Create a ROS 2 workspace for RK development
mkdir -p ~/robokudo_ws/src cd ~/robokudo_ws colcon build --symlink-install source ~/robokudo_ws/install/setup.bash
The workspace has to be sourced after re-building it. However, by using the
--symlink-install
option all python scripts are symlinked instead of copied. This means that changes to python scripts will not require a rebuild of the workspace and thus also does not require sourcing it again. When changing C++ code, you will still have to rebuild and source the workspace.
-
-
Clone the RoboKudo repository into the workspace:
cd ~/robokudo_ws/src # as a user: git clone --recurse-submodules -b ros2_jazzy https://gitlab.informatik.uni-bremen.de/robokudo/robokudo.git # or as a contributing developer with privileged access to the repo: git clone --recurse-submodules -b ros2_jazzy git@gitlab.informatik.uni-bremen.de:robokudo/robokudo.git
-
Install python dependencies using pip:
sudo apt install virtualenvwrapper python3-pip echo "export WORKON_HOME=~/venvs" >> ~/.bashrc echo "source /usr/share/virtualenvwrapper/virtualenvwrapper.sh" >> ~/.bashrc source ~/.bashrc mkdir -p $WORKON_HOME mkvirtualenv robokudo --system-site-packages workon robokudo pip install -r ~/robokudo_ws/src/robokudo/requirements.txt
Execute
workon robokudo
in every new shell to activate the virtual environment before running robokudo commands. -
Build the Workspace again to get RK components compiled and source workspace:
cd ~/robokudo_ws python3 -m colcon build --symlink-install
Using
python3 -m colcon
is necessary so that the correct python interpreter is used for ROS commands.
If you want to setup a development environment with our recommended settings, continue with the following section. You can also do this step later.
Note: ROS2 comes with new commands and roscore
no longer exists. To follow the tutorials replace rosrun
with ros2 run
, roslaunch
with ros2 launch
and rosbag
with ros2 bag
.
IDE Setup¶
Download Pycharm for Linux from Jetbrains into your home directory.
-
Extract the archive to
~/pycharm-<version>
:tar -xzf ~/pycharm-<version>.tar.gz -C ~/
-
Create a symlink to
~/pycharm.sh
for convenience:ln -s ~/pycharm-<version>/bin/pycharm.sh ~/pycharm.sh
-
Start Pycharm:
source /opt/ros/iron/setup.bash # if you don't source it automatically in your .bashrc source ~/robokudo_ws/install/setup.bash ~/pycharm.sh
Open the workspace as by clicking
Open
on the welcome screen and selecting~/robokudo_ws
.In the folder view, right-click on
build
and select Mark Directory as → Excluded. Repeat this forinstall
andlog
.-
Make pycharm use the venv if created in step 6 of First steps:
Go to File → Settings → Project → Python Interpreter.
Click on Add Interpreter and select Add local interpreter.
Select Select Existing, click on the small folder icon next to the current python path and select
~/venvs/robokudo/bin/python3
.Make sure to select the virtualenv interpreter as the default for the project.
Restart PyCharm before continuing.
Get data for development¶
Currently, we are working with the standard RoboSherlock tutorial bag file.
Please download the ROS bag file from here to you ~/Downloads/
folder and unpack the archive:
cd ~/Downloads
wget "<link>"
tar -xzf test.tar.gz -C ~/Downloads/test
Start development¶
-
Start PyCharm as explained above:
source ~/robokudo_ws/install/setup.bash ~/pycharm.sh
-
Open a new terminal and execute:
ros2 bag play ~/Downloads/test --loop
-
Open a new terminal and execute:
ros2 run robokudo main _ae=demo
PyCharm Plugins¶
Just a list of PyCharm plugins that might be useful for development:
Grep Console
IdeaVim (for all the vim lovers)
Line Profiler