Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all 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
12 changes: 2 additions & 10 deletions .github/workflows/ros-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,11 @@ jobs:
- dockerfile: Dockerfile.hardware
repo_name: ''
platforms: linux/amd64, linux/arm64
ros_distro: humble
ros_distro: jazzy
- dockerfile: Dockerfile.gazebo
repo_name: rosbot-gazebo
platforms: linux/amd64
ros_distro: humble
- dockerfile: Dockerfile.hardware
repo_name: ''
platforms: linux/amd64, linux/arm64
ros_distro: iron
# - dockerfile: Dockerfile.gazebo
# repo_name: rosbot-gazebo
# platforms: linux/amd64
# ros_distro: iron
ros_distro: jazzy

steps:

Expand Down
11 changes: 5 additions & 6 deletions Dockerfile.gazebo
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN MYDISTRO=${PREFIX:-ros}; MYDISTRO=${MYDISTRO//-/} && \
rm -rf build log src

## =========================== ROS builder ===============================
FROM husarnet/ros:${PREFIX}${ROS_DISTRO}-ros-base AS ros_builder
FROM husarnet/ros:${PREFIX}${ROS_DISTRO}-ros-base AS ros_builder

ARG PREFIX

Expand All @@ -52,12 +52,11 @@ RUN apt-get update --fix-missing && apt-get install -y \
ros-dev-tools && \
apt-get upgrade -y && \
# Clone source
git clone --depth 1 -b humble https://github.com/husarion/rosbot_ros.git src && \
git clone --depth 1 -b jazzy-devel https://github.com/husarion/rosbot_ros.git src && \
vcs import src < src/rosbot/rosbot_hardware.repos && \
vcs import src < src/rosbot/rosbot_simulation.repos && \
cp -r src/ros2_controllers/diff_drive_controller src/ && \
cp -r src/ros2_controllers/imu_sensor_broadcaster src/ && \
rm -rf src/ros2_controllers && \
# it is necessary to remove simulation - otherwise rosdep tries to install dependencies
rm -r src/rosbot_utils && \
# Install dependencies
rm -rf /etc/ros/rosdep/sources.list.d/20-default.list && \
rosdep init && \
Expand All @@ -66,7 +65,7 @@ RUN apt-get update --fix-missing && apt-get install -y \

RUN MYDISTRO=${PREFIX:-ros}; MYDISTRO=${MYDISTRO//-/} && \
source /opt/$MYDISTRO/$ROS_DISTRO/setup.bash && \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release && \
colcon build --packages-up-to rosbot --cmake-args -DCMAKE_BUILD_TYPE=Release && \
rm -rf build log

## =========================== Final Stage ===============================
Expand Down
19 changes: 12 additions & 7 deletions Dockerfile.hardware
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG ROS_DISTRO=humble
ARG ROS_DISTRO=jazzy
ARG MYDISTRO=ros
ARG PREFIX=

## =========================== Healthcheck builder ===============================
Expand All @@ -7,6 +8,8 @@ FROM husarnet/ros:${PREFIX}${ROS_DISTRO}-ros-base AS healthcheck_builder

ARG ROS_DISTRO
ARG PREFIX
ARG MYDISTRO
ENV HUSARION_ROS_BUILD=hardware

SHELL ["/bin/bash", "-c"]

Expand Down Expand Up @@ -36,6 +39,8 @@ FROM husarnet/ros:${PREFIX}${ROS_DISTRO}-ros-base AS ros_builder

ARG ROS_DISTRO
ARG PREFIX
ARG MYDISTRO
ENV HUSARION_ROS_BUILD=hardware

SHELL ["/bin/bash", "-c"]

Expand All @@ -47,11 +52,8 @@ COPY ./healthcheck.cpp /
RUN apt-get update && apt-get install -y \
python3-pip

RUN git clone --depth 1 -b humble https://github.com/husarion/rosbot_ros.git src && \
RUN git clone --depth 1 -b jazzy https://github.com/husarion/rosbot_ros.git src && \
vcs import src < src/rosbot/rosbot_hardware.repos && \
cp -r src/ros2_controllers/diff_drive_controller src/ && \
cp -r src/ros2_controllers/imu_sensor_broadcaster src/ && \
rm -rf src/ros2_controllers && \
# it is necessary to remove simulation - otherwise rosdep tries to install dependencies
rm -r src/rosbot_gazebo && \
# without this line (using vulcanexus base image) rosdep init throws error: "ERROR: default sources list file already exists:"
Expand All @@ -61,7 +63,7 @@ RUN git clone --depth 1 -b humble https://github.com/husarion/rosbot_ros.git src
rosdep install --from-paths src --ignore-src -y && \
MYDISTRO=${PREFIX:-ros}; MYDISTRO=${MYDISTRO//-/} && \
source /opt/$MYDISTRO/$ROS_DISTRO/setup.bash && \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release && \
colcon build --packages-up-to rosbot --cmake-args -DCMAKE_BUILD_TYPE=Release && \
echo $(cat /ros2_ws/src/rosbot/package.xml | grep '<version>' | sed -r 's/.*<version>([0-9]+.[0-9]+.[0-9]+)<\/version>/\1/g') >> /version.txt && \
rm -rf build log

Expand All @@ -70,6 +72,8 @@ FROM husarnet/ros:${PREFIX}${ROS_DISTRO}-ros-core

ARG ROS_DISTRO
ARG PREFIX
ARG MYDISTRO
ENV HUSARION_ROS_BUILD=hardware

SHELL ["/bin/bash", "-c"]

Expand All @@ -86,11 +90,12 @@ RUN cp src/rosbot_utils/rosbot_utils/flash-firmware.py /usr/bin/ && \

RUN apt-get update && apt-get install -y \
python3-pip \
python3-periphery \
python3-ftdi \
python3-rosdep \
stm32flash \
gosu \
ros-$ROS_DISTRO-teleop-twist-keyboard && \
pip3 install pyftdi && \
rm -rf /etc/ros/rosdep/sources.list.d/20-default.list && \
rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
Expand Down
17 changes: 15 additions & 2 deletions run_healthcheck_node.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
source "/ros2_ws_healthcheck/install/setup.bash"
gosu $USER bash -c "ros2 run healthcheck_pkg healthcheck_node &"
if [ ! -z "$USER" ] && [ "$USER" != "root" ] && [ "$USER" != "$(whoami)" ]; then
# Check if the user already exists; if not, create the user
if ! id "$USER" &>/dev/null; then
useradd -ms /bin/bash "$USER"
echo "[ \"\$(whoami)\" != \"$USER\" ] && su - \"$USER\"" >> /etc/bash.bashrc
fi

source "/ros2_ws_healthcheck/install/setup.bash"

exec gosu $USER /bin/bash -c "ros2 run healthcheck_pkg healthcheck_node &"

else
source "/ros2_ws_healthcheck/install/setup.bash"
ros2 run healthcheck_pkg healthcheck_node &
fi