Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jazzy migration #628

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 40 additions & 26 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM ros:iron
FROM ros:jazzy

ARG user=bitbots
ARG uid=1000
ARG gid=1000

# Basic Utilities
ENV DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -54,41 +58,51 @@ RUN apt update -y \
RUN apt-get install -y \
python3-rosdep \
python3-vcstool \
ros-iron-camera-calibration \
ros-iron-desktop \
ros-iron-joint-state-publisher-gui \
ros-iron-plotjuggler \
ros-iron-plotjuggler-msgs \
ros-iron-plotjuggler-ros \
ros-iron-rmw-cyclonedds-cpp \
ros-iron-rqt-robot-monitor \
ros-iron-soccer-vision-3d-rviz-markers

# Update pip and install colcon-clean
RUN pip3 install pip -U

# Install colcon extensions / patches
RUN python3 -m pip install \
git+https://github.com/ruffsl/colcon-clean \
git+https://github.com/timonegk/colcon-core.git@colors \
git+https://github.com/timonegk/colcon-notification.git@colors \
git+https://github.com/timonegk/colcon-output.git@colors
python3-virtualenv \
ros-jazzy-camera-calibration \
ros-jazzy-desktop \
ros-jazzy-joint-state-publisher-gui \
ros-jazzy-plotjuggler \
ros-jazzy-plotjuggler-msgs \
ros-jazzy-plotjuggler-ros \
ros-jazzy-rmw-cyclonedds-cpp \
ros-jazzy-rqt-robot-monitor \
ros-jazzy-soccer-vision-3d-rviz-markers

# Set zsh as default shell
SHELL ["/bin/zsh", "-c"]

# Create home directory and colcon workspace
RUN mkdir -p "/root/colcon_ws"
# Remove the users group, because when it exists on the host system
# the devcontainer will not dynamically update the containerUser GID,
# when the host user is part of the users group.
# Then create a bitbots user with home directory and add allow it to use sudo
RUN groupdel users \
&& userdel -r ubuntu \
&& useradd -m -U -u "$uid" -G sudo -s /bin/zsh $user \
&& groupmod -g "$gid" $user \
&& echo "$user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

USER $user

# Install pip colcon extensions / patches as user
RUN python3 -m pip install --user --break-system-packages \
git+https://github.com/ruffsl/colcon-clean \
git+https://github.com/timonegk/colcon-core.git@colors \
git+https://github.com/timonegk/colcon-notification.git@colors \
git+https://github.com/timonegk/colcon-output.git@colors

# Create colcon workspace
RUN mkdir -p /home/$user/colcon_ws/src

# Install oh-my-zsh for pretty terminal
RUN sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions"

# Add zshrc
COPY zshrc "/root/.zshrc"
# Add zshrc to bitbots home directory
COPY --chown=$user:$user zshrc /home/$user/.zshrc

# This is required for sharing Xauthority
ENV QT_X11_NO_MITSHM=1

# Switch to the workspace directory
WORKDIR "/root/colcon_ws"
WORKDIR /home/$user/colcon_ws
10 changes: 6 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Bit-Bots Iron Dev",
"name": "Bit-Bots Jazzy Dev",

"build": { "dockerfile": "Dockerfile" },

Expand All @@ -14,14 +14,16 @@
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": { "zsh": { "path": "/bin/zsh" } }
"terminal.integrated.profiles.linux": { "zsh": { "path": "/bin/zsh" } },
"dev.containers.copyGitConfig": false,
"dev.containers.gitCredentialHelperConfigLocation": "none"
},
"extensions": ["ms-iot.vscode-ros"]
}
},

"workspaceMount": "type=bind,source=${localWorkspaceFolder},target=/root/colcon_ws/src/bitbots_main",
"workspaceFolder": "/root/colcon_ws/src/bitbots_main",
"workspaceMount": "type=bind,source=${localWorkspaceFolder},target=/home/bitbots/colcon_ws/src/bitbots_main",
"workspaceFolder": "/home/bitbots/colcon_ws/src/bitbots_main",

"mounts": [
"type=bind,source=${localEnv:HOME},target=/srv/host_home,consistency=cached"
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bindkey "^[[1;5D" backward-word


# Settings for the prompt to show that we are in a docker container
export PROMPT="%K{black} 🐋 %K{blue}%F{black}%/ %f%k%F{blue}%f " # Prefix the prompt with DOCKER
export PROMPT="%K{black} 🐋 %K{blue}%F{black} %~ %f%k%F{blue}%f " # Prefix the prompt with DOCKER

# >>> bit-bots initialize >>>

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ jobs:

- name: Build packages
run: |
. /opt/ros/iron/setup.sh
. /opt/ros/jazzy/setup.sh
colcon build --symlink-install
working-directory: /colcon_ws

- name: Test packages
run: |
# Source workspace
. /opt/ros/iron/setup.sh
. /opt/ros/jazzy/setup.sh
. install/setup.sh
# Run tests for all packages
colcon test --event-handlers console_direct+ --return-code-on-test-failure --parallel-workers 1
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
- id: cppcheck
args:
- "--inline-suppr"
- "--suppress=missingInclude"
- "--suppress=missingIncludeSystem"
- "--suppress=unmatchedSuppression"
- "--suppress=unusedFunction"
- "--suppress=unusedStructMember"
Expand Down
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@
},
// Tell the ROS extension where to find the setup.bash
// This also utilizes the COLCON_WS environment variable, which needs to be set
"ros.distro": "iron",
"ros.distro": "jazzy",
"search.useIgnoreFiles": false,
"python.autoComplete.extraPaths": [
"/opt/ros/iron/lib/python3.10/site-packages"
"/opt/ros/jazzy/lib/python3.10/site-packages"
],
"python.analysis.extraPaths": [
"/opt/ros/iron/lib/python3.10/site-packages"
"/opt/ros/jazzy/lib/python3.10/site-packages"
],
"cmake.configureOnOpen": false,
"editor.formatOnSave": true,
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ install-no-root: pull-init update-no-root

pip:
# Install and upgrade pip dependencies
pip install --upgrade -r requirements/dev.txt --user
pip install --upgrade -r requirements/dev.txt --user --break-system-packages

pre-commit:
# Install pre-commit hooks for all submodules that have a .pre-commit-config.yaml file
Expand Down Expand Up @@ -91,7 +91,7 @@ rosdep:
[ -f /etc/ros/rosdep/sources.list.d/20-default.list ] || sudo rosdep init
# Update rosdep and install dependencies from meta directory
rosdep update
rosdep install --from-paths . --ignore-src --rosdistro iron -y
rosdep install --from-paths . --ignore-src --rosdistro jazzy -y

status:
# Show status of all repositories
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build & Test](https://github.com/bit-bots/bitbots_main/actions/workflows/ci.yml/badge.svg)](https://github.com/bit-bots/bitbots_main/actions/workflows/ci.yml)
[![Code style checks](https://github.com/bit-bots/bitbots_main/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/bit-bots/bitbots_main/actions/workflows/pre-commit.yml)
[![ROS Version Iron](https://img.shields.io/badge/ROS%20Version-Iron-ab8c71)](https://docs.ros.org/en/iron/index.html)
[![ROS Version Jazzy](https://img.shields.io/badge/ROS%20Version-Jazzy-00b8ff)](https://docs.ros.org/en/jazzy/index.html)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for also changing the color :D


This git repository contains all RoboCup-related code and documentation from the Hamburg Bit-Bots team.
All code is written as individual ROS 2 packages targeting Ubuntu.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class HardwareInterface {
public:
virtual bool init() = 0;

virtual void read(const rclcpp::Time &t, const rclcpp::Duration &dt){};
virtual void read(const rclcpp::Time &t, const rclcpp::Duration &dt) {};

virtual void write(const rclcpp::Time &t, const rclcpp::Duration &dt){};
virtual void write(const rclcpp::Time &t, const rclcpp::Duration &dt) {};

virtual void restoreAfterPowerCycle(){};
virtual void restoreAfterPowerCycle() {};

virtual ~HardwareInterface(){};
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef BITBOTS_ROS_CONTROL_INCLUDE_BITBOTS_ROS_CONTROL_UTILS_H_
#define BITBOTS_ROS_CONTROL_INCLUDE_BITBOTS_ROS_CONTROL_UTILS_H_

#include "bitbots_msgs/msg/audio.hpp"
#include "rclcpp/rclcpp.hpp"
#include <bitbots_msgs/msg/audio.hpp>
#include <rclcpp/rclcpp.hpp>

namespace bitbots_ros_control {

Expand All @@ -13,7 +13,7 @@ void speakError(rclcpp::Publisher<bitbots_msgs::msg::Audio>::SharedPtr speak_pub

uint16_t dxlMakeword(uint64_t a, uint64_t b);
uint32_t dxlMakedword(uint64_t a, uint64_t b);
float dxlMakeFloat(uint8_t* data);
float dxlMakeFloat(const uint8_t* data);

std::string gyroRangeToString(uint8_t range);
std::string accelRangeToString(uint8_t range);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void DynamixelServoHardwareInterface::individualTorqueCb(bitbots_msgs::msg::Join
RCLCPP_WARN(nh_->get_logger(), "Couldn't set torque for servo %s ", msg.joint_names[i].c_str());
}
}
for (auto &bus : bus_interfaces_) {
for (const auto &bus : bus_interfaces_) {
bus->switch_individual_torque_ = true;
}
}
Expand All @@ -157,7 +157,7 @@ void DynamixelServoHardwareInterface::setTorqueCb(std_msgs::msg::Bool::SharedPtr
/**
* This saves the given required value, so that it can be written to the servos in the write method
*/
for (auto &bus : bus_interfaces_) {
for (const auto &bus : bus_interfaces_) {
bus->goal_torque_ = enabled->data;
}
for (size_t j = 0; j < joint_names_.size(); j++) {
Expand Down Expand Up @@ -196,7 +196,7 @@ void DynamixelServoHardwareInterface::write(const rclcpp::Time &t, const rclcpp:
// set all values from controller to the buses
// todo improve performance
int i = 0;
for (auto &bus : bus_interfaces_) {
for (const auto &bus : bus_interfaces_) {
for (int j = 0; j < bus->joint_count_; j++) {
bus->goal_position_[j] = goal_position_[i];
bus->goal_velocity_[j] = goal_velocity_[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ PressureConverter::PressureConverter(rclcpp::Node::SharedPtr nh, char side) {
}
for (int i = 0; i < 4; i++) {
std::stringstream single_wrench_frame;
single_wrench_frame << side << "_"
<< "cleat_" << wrench_topics[i];
single_wrench_frame << side << "_" << "cleat_" << wrench_topics[i];
wrench_frames_.push_back(single_wrench_frame.str());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ bool ServoBusInterface::writeROMRAM(bool first_time) {
// Allocate memory for the values in the driver
std::vector<int> values(joint_names_.size());
// Iterate over parameter names
for (auto register_name : parameter_names) {
for (const auto &register_name : parameter_names) {
// Get the value for each joint
for (size_t num = 0; num < joint_names_.size(); num++) {
// Get the value from the cache
Expand Down
2 changes: 1 addition & 1 deletion bitbots_lowlevel/bitbots_ros_control/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ uint32_t dxlMakedword(uint64_t a, uint64_t b) {
return uint32_t(uint16_t(a & 0xffff) | uint32_t(uint16_t(b & 0xffff) << 16));
}

float dxlMakeFloat(uint8_t* data) {
float dxlMakeFloat(const uint8_t* data) {
float f;
uint32_t b = dxlMakedword(dxlMakeword(data[0], data[1]), dxlMakeword(data[2], data[3]));
memcpy(&f, &b, sizeof(f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ void WolfgangHardwareInterface::write(const rclcpp::Time &t, const rclcpp::Durat
}
if (!bus_start_time_ || t > bus_start_time_.value()) {
if (bus_first_write_) {
for (std::vector<std::shared_ptr<HardwareInterface>> &port_interfaces : interfaces_) {
for (std::vector<std::shared_ptr<HardwareInterface>> const &port_interfaces : interfaces_) {
for (std::shared_ptr<HardwareInterface> interface : port_interfaces) {
interface->restoreAfterPowerCycle();
}
Expand Down
6 changes: 3 additions & 3 deletions bitbots_misc/bitbots_basler_camera/src/basler_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
#include <iostream>
#include <memory>
#include <opencv2/imgproc/imgproc.hpp>
#include <pylon_camera_parameters.hpp>
#include <rclcpp/experimental/executors/events_executor/events_executor.hpp>
#include <rclcpp/logger.hpp>
#include <rclcpp/rclcpp.hpp>
#include <string>
#include <vector>

#include "pylon_camera_parameters.hpp"

using std::placeholders::_1, std::placeholders::_2;
using namespace Pylon;

Expand Down Expand Up @@ -271,7 +270,8 @@ class BaslerCamera {
}

// Convert to cv::Mat
cv::Mat image(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC1, (uint8_t*)ptrGrabResult->GetBuffer());
cv::Mat image(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC1,
static_cast<uint8_t*>(ptrGrabResult->GetBuffer()));

// Create cv::Mat for color image
cv::Mat color(image.size(), CV_MAKETYPE(CV_8U, 3));
Expand Down
2 changes: 1 addition & 1 deletion bitbots_misc/bitbots_docs/docs/manual/testing/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Compile (compiles)
------------------

The first step is to test if the package compiles.
Obviously this should preferably be tested on the same system that is used on the robot (Ubuntu 22.04 with the iron distribution).
Obviously this should preferably be tested on the same system that is used on the robot (Ubuntu 24.04 with the jazzy distribution).
A part of this is to check if all dependencies are correct in the package.xml.
This is important so they can be installed with rosdep.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ For compilation of the whole meta repository run ``cba``, which is an alias for:
``cd $COLCON_WS; colcon build --symlink-install --continue-on-error``
After a successful run, before we are able to use any ros commands we now need to source colcon built sources
with ``sa``, which is an alias for:
``source "/opt/ros/iron/setup.$SHELL" && source "$COLCON_WS/install/setup.$SHELL"``
``source "/opt/ros/jazzy/setup.$SHELL" && source "$COLCON_WS/install/setup.$SHELL"``

**3. Run Webots Simulation**

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Software installation with ROS2
===============================

In this tutorial, we will learn how to install ROS2 Iron Irwini on Ubuntu 22.04 and build our software stack.
In this tutorial, we will learn how to install ROS2 Jazzy Jalisco on Ubuntu 24.04 and build our software stack.

**TLDR**: single command setup
------------------------------

**Prerequirements**
- You have a running Ubuntu 22.04 environment
- You have a running Ubuntu 24.04 environment
- You have an existing Github account and added a SSH key to your account
- You have root access to your system (sudo)

Expand All @@ -23,17 +23,17 @@ If you have not previously set up any of our software stack, you can use the fol
Manual steps with in depth explanation
--------------------------------------

**0. Use Ubuntu 22.04**
**0. Use Ubuntu 24.04**

As ROS works best on Ubuntu, we are using this distribution.
Currently, ROS2 Iron runs on Ubuntu 22.04.
Currently, ROS2 Jazzy runs on Ubuntu 24.04.

If you are not already using Ubuntu 22.04, consider installing it on your system (perhaps as a dual boot?).
If you are not already using Ubuntu 24.04, consider installing it on your system (perhaps as a dual boot?).
Alternatively you can use a devcontainer :doc:`vscode-dev-container`, with a preconfigured environment and follow those instructions, as these docs do not apply to the devcontainer.

**1. Setup and Install ROS 2**

- Follow this guide and when it comes to the section **Install ROS 2 packages**, install the recommended ``ros-iron-desktop-full``: https://docs.ros.org/en/iron/Installation/Ubuntu-Install-Debians.html
- Follow this guide and when it comes to the section **Install ROS 2 packages**, install the recommended ``ros-jazzy-desktop-full``: https://docs.ros.org/en/jazzy/Installation/Ubuntu-Install-Debs.html
- Install additional dependencies:

.. code-block:: bash
Expand Down Expand Up @@ -88,7 +88,7 @@ If you want to install it, you can do so by running ``make webots`` in the bitbo

**4. Setup colcon workspace**

`Colcon <https://docs.ros.org/en/iron/Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.html>`_ is the tool provided by ROS 2 to build and install our ROS packages, so that they can be launched later.
`Colcon <https://docs.ros.org/en/jazzy/Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.html>`_ is the tool provided by ROS 2 to build and install our ROS packages, so that they can be launched later.
The colcon workspace is where your source code gets build and where we use colcon.

- Create colcon workspace directory (typically ``~/colcon_ws/``)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Navigate to your colcon workspace.

Source ros

`source /opt/ros/iron/setup.zsh`
`source /opt/ros/jazzy/setup.zsh`

Open VSCode

`code .`

Install the ROS extension (from Microsoft).
You should see a `ROS2.iron` in the lower left corner.
You should see a `ROS2.jazzy` in the lower left corner.

Now you should be able to build the code with `Ctrl+Shift+B`

Expand Down
Loading
Loading