Skip to content

Commit

Permalink
Migration to jazzy (#83)
Browse files Browse the repository at this point in the history
* First changes for the migration. still needs to be tested

Signed-off-by: JesusSilvaUtrera <jsilvautrera@gmail.com>

* Simulation is now working with Jazzy

Signed-off-by: JesusSilvaUtrera <jsilvautrera@gmail.com>

* Updated the version of the setup-ros step for testing

Signed-off-by: JesusSilvaUtrera <jsilvautrera@gmail.com>

* Slam is working now

Signed-off-by: JesusSilvaUtrera <jsilvautrera@gmail.com>

---------

Signed-off-by: JesusSilvaUtrera <jsilvautrera@gmail.com>
  • Loading branch information
JesusSilvaUtrera authored Sep 16, 2024
1 parent 2cbaa21 commit 030c8f3
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 77 deletions.
3 changes: 1 addition & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Please remove the appropriate section.
For example, if this is a new feature, remove all sections except for the "New feature" section
If this is your first time opening a PR, be sure to check the contribution guide:
https://github.com/Ekumen-OS/andino_gz/blob/humble/CONTRIBUTING.md
https://github.com/Ekumen-OS/andino_gz/blob/jazzy/CONTRIBUTING.md
-->

# 🦟 Bug fix
Expand Down Expand Up @@ -40,4 +40,3 @@ context (e.g., screenshots, gifs) if appropriate.-->
- [ ] Added example and/or tutorial
- [ ] Updated documentation (as needed)
- [ ] Updated migration guide (as needed)

10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: colcon build & test
on:
push:
branches:
- humble
- jazzy
pull_request:
branches:
- humble
- jazzy
workflow_dispatch:

env:
ROS_DISTRO: humble
ROS_DISTRO: jazzy

# Cancel previously running PR jobs
concurrency:
Expand All @@ -22,10 +22,10 @@ jobs:
name: Compile and test
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
image: ubuntu:24.04
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/setup-ros@v0.6
- uses: ros-tooling/setup-ros@v0.7
- uses: ros-tooling/action-ros-ci@v0.3
id: action_ros_ci_step
with:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ This package provides a simulation environment for [Andino](https://github.com/E

## :clamp: Platforms

- ROS 2: Humble Hawksbill
- ROS 2: Jazzy Hawksbill
- OS:
- Ubuntu 22.04 Jammy Jellyfish
- Ubuntu 24.04 Noble Numbat
- Gazebo:
- Harmonic

Expand Down Expand Up @@ -172,7 +172,7 @@ Also, consider using looking at the translation entries under `andino_gz/config/
ros2 launch andino_gz slam_toolbox_online_async.launch.py
```

Configuration can be forwarded to the `slam_toolbox_node`. By default, the configuration parameters are obtained from [andino's configuration file](https://github.com/Ekumen-OS/andino/blob/humble/andino_slam/config/slam_toolbox_online_async.yaml). In case a custom file is wanted to be passed, simply use the launch file argument for indicating the path to a new file.
Configuration can be forwarded to the `slam_toolbox_node`. By default, the configuration parameters are obtained from [andino's configuration file](https://github.com/Ekumen-OS/andino/blob/jazzy/andino_slam/config/slam_toolbox_online_async.yaml). In case a custom file is wanted to be passed, simply use the launch file argument for indicating the path to a new file.

```
ros2 launch andino_gz slam_toolbox_online_async.launch.py slams_param_file:=<my_path>
Expand Down
25 changes: 12 additions & 13 deletions andino_gz/launch/slam_toolbox_online_async.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
import os

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
from launch.launch_description_sources import PythonLaunchDescriptionSource


def generate_launch_description():
Expand All @@ -46,21 +47,19 @@ def generate_launch_description():
'config', 'slam_toolbox_online_async.yaml'),
description='Full path to the ROS 2 parameters file to use for the slam_toolbox node')

start_async_slam_toolbox_node = Node(
parameters=[
slam_params_file,
{
'use_sim_time': True
}
],
package='slam_toolbox',
executable='async_slam_toolbox_node',
name='slam_toolbox',
output='screen')
async_slam_toolbox_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory("slam_toolbox"),
'launch', 'online_async_launch.py')
),
launch_arguments={
'slam_params_file': slam_params_file
}.items(),
)

ld = LaunchDescription()

ld.add_action(declare_slam_params_file_cmd)
ld.add_action(start_async_slam_toolbox_node)
ld.add_action(async_slam_toolbox_launch)

return ld
2 changes: 1 addition & 1 deletion andino_gz/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<!-- 'gz-sim8' for Gazebo Harmonic isn't added as it can't get its keys resolved -->
<exec_depend>gz-sim8</exec_depend>
<exec_depend>andino_description</exec_depend>
<exec_depend>andino_slam</exec_depend>
<exec_depend>nav2_bringup</exec_depend>
Expand Down
23 changes: 6 additions & 17 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ For NVIDIA GPU support, `nvidia-container-toolkit` should be installed. *Skip th

#### Building image and running container

- Build the docker image whose default name is `ros2_humble_andino_gz`:
- Build the docker image whose default name is `ros2_jazzy_andino_gz`:

```sh
./docker/build.sh
Expand All @@ -29,7 +29,7 @@ You can also try to set a specific image name:
./docker/build.sh -i my_fancy_image_name
```

- Run a docker container from `ros2_humble_andino_gz` called `ros2_humble_andino_gz_container`:
- Run a docker container from `ros2_jazzy_andino_gz` called `ros2_jazzy_andino_gz_container`:

```sh
./docker/run.sh
Expand All @@ -47,19 +47,8 @@ You can also try to set specific image and container names:
./docker/run.sh --use_nvidia -i my_fancy_image_name -c my_fancy_container_name
```

- Inside the container, install dependencies via `rosdep`:
With this, you can just source the workspace and start testing it out, as the dependencies and the workspace have been already installed during the building process:

```sh
rosdep install -i -y --rosdistro humble --from-paths src
```

Note that the repository is mounted into a workspace. That is convenient if you
are working in a single repository project. Note that for multi-repository
workspace you should use another tool like vcs-tool to control via a `.repos`
file the repositories in your workspace.

- To build:

```sh
colcon build
```
```sh
source ./install/setup.bash
```
12 changes: 5 additions & 7 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ set -e
function show_help() {
echo $'\nUsage:\t build.sh [OPTIONS] \n
Options:\n
\t-i --image_name\t\t Name of the image to be built (default ros2_humble_andino_gz).\n
\t-i --image_name\t\t Name of the image to be built (default ros2_jazzy_andino_gz).\n
Example:\n
\tbuild.sh --image_name custom_image_name\n'
}

echo "Building the docker image for ros2 humble andino gazebo development."
echo "Building the docker image for ros2 jazzy andino gazebo development."

SCRIPT_FOLDER_PATH="$(cd "$(dirname "$0")"; pwd)"
CONTEXT_FOLDER_PATH="$(cd "$(dirname "$0")"; cd .. ; pwd)"
Expand All @@ -57,15 +57,13 @@ while [[ "$#" -gt 0 ]]; do
done

# Update the arguments to default values if needed.
OS_VERSION="focal"
IMAGE_NAME=${IMAGE_NAME:-ros2_humble_andino_gz}
OS_VERSION="noble"
IMAGE_NAME=${IMAGE_NAME:-ros2_jazzy_andino_gz}
DOCKERFILE_PATH=$SCRIPT_FOLDER_PATH/Dockerfile

USERID=$(id -u)
USER=$(whoami)
USER=ubuntu

sudo docker build -t $IMAGE_NAME \
--file $DOCKERFILE_PATH \
--build-arg USERID=$USERID \
--build-arg USER=$USER \
$CONTEXT_FOLDER_PATH
51 changes: 34 additions & 17 deletions docker/dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
FROM osrf/ros:humble-desktop-full
FROM osrf/ros:jazzy-desktop-full

# Arguments for building
ARG USERID
ARG USER
ARG USER=ubuntu

# Setup environment
ENV TERM=linux
Expand All @@ -14,43 +13,61 @@ COPY docker/requirements.txt .
RUN apt-get update && apt-get install --no-install-recommends -y $(cat requirements.txt)
RUN rm requirements.txt

#####################################
# ROS2 dependencies built from source
#####################################

# Prepare worksapce for ros2 packages built in the container
RUN mkdir -p /home/$USER/ros_deps_ws/src
WORKDIR /home/$USER/ros_deps_ws/src
# Clone andino main repo
RUN git clone https://github.com/Ekumen-OS/andino.git -b jazzy
WORKDIR /home/$USER/ros_deps_ws
# Rosdep install
RUN . /opt/ros/jazzy/setup.sh && rosdep install -y -i --from-paths src
# Build
RUN . /opt/ros/jazzy/setup.sh && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
# Adds overlay to the bashrc
RUN echo "source /home/$USER/ros_deps_ws/install/setup.bash" >> /home/$USER/.bashrc

# Add the Gazebo repository and install Gazebo Harmonic
RUN sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" > /etc/apt/sources.list.d/gazebo-stable.list' && \
wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg && \
sudo apt update && \
sudo apt install -y gz-harmonic && \
sudo apt remove -y ros-humble-ros-gz* && \
sudo apt autoremove -y && \
sudo apt update && \
sudo apt install -y ros-humble-ros-gzharmonic && \
sudo rm -rf /var/lib/apt/lists/*
sudo apt install -y gz-harmonic

# Create a user with passwordless sudo
RUN adduser --uid $USERID --gecos "ekumen developer" --disabled-password $USER
RUN adduser $USER sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN echo "export QT_X11_NO_MITSHM=1" >> /home/$USER/.bashrc
RUN echo "export GZ_IP=127.0.0.1" >> /home/$USER/.bashrc
USER $USER

# Install fixuid and configure it
RUN curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - && \
chown root:root /usr/local/bin/fixuid && \
chmod 4755 /usr/local/bin/fixuid && \
mkdir -p /etc/fixuid && \
printf "user: $USER\ngroup: $USER\n" > /etc/fixuid/config.yml

# Adds USER to dialout and plugdev group.
# This is needed to access the serial ports, for further references check
# the libserial documentation.
RUN sudo usermod -a -G dialout $USER
RUN sudo usermod -a -G plugdev $USER

USER $USER

# Creates the src folder of the workspace.
RUN mkdir -p /home/$USER/ws/src

# Adds to bashrc the ros humble overlay sourcing.
RUN echo "source /opt/ros/humble/setup.bash" >> /home/$USER/.bashrc
# Adds colcon autocomplete
RUN echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> /home/$USER/.bashrc
# Adds to bashrc the ros jazzy overlay sourcing.
RUN echo "source /opt/ros/jazzy/setup.bash" >> /home/$USER/.bashrc

# Updates
RUN sudo apt upgrade -y && sudo apt update && rosdep update

# Defines a workspace folder.
WORKDIR /home/$USER/ws

# Use fixuid as the entrypoint in quiet mode
ENTRYPOINT ["fixuid", "-q"]

CMD ["/bin/bash"]
4 changes: 0 additions & 4 deletions docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ openssh-server
python3
python3-pip
python3-setuptools
ros-humble-andino-description
ros-humble-andino-slam
ros-humble-nav2-bringup
ros-humble-nav2-common
software-properties-common
sudo
tmux
Expand Down
18 changes: 10 additions & 8 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ set +e
function show_help() {
echo $'\nUsage:\t run.sh [OPTIONS] \n
Options:\n
\t-i --image_name\t\t Name of the image to be run (default ros2_humble_andino_gz).\n
\t-c --container_name\t Name of the container(default ros2_humble_andino_gz_container).\n
\t-i --image_name\t\t Name of the image to be run (default ros2_jazzy_andino_gz).\n
\t-c --container_name\t Name of the container(default ros2_jazzy_andino_gz_container).\n
\t--use_nvidia\t\t Use nvidia runtime.\n
Examples:\n
\trun.sh\n
Expand Down Expand Up @@ -79,21 +79,23 @@ done

# Update the arguments to default values if needed.

IMAGE_NAME=${IMAGE_NAME:-ros2_humble_andino_gz}
CONTAINER_NAME=${CONTAINER_NAME:-ros2_humble_andino_gz_container}
IMAGE_NAME=${IMAGE_NAME:-ros2_jazzy_andino_gz}
CONTAINER_NAME=${CONTAINER_NAME:-ros2_jazzy_andino_gz_container}

USER=ubuntu

SSH_PATH=/home/$USER/.ssh
WORKSPACE_SRC_CONTAINER=/home/$(whoami)/ws/src/$REPOSITORY_FOLDER_NAME
WORKSPACE_ROOT_CONTAINER=/home/$(whoami)/ws
WORKSPACE_SRC_CONTAINER=/home/$USER/ws/src/$REPOSITORY_FOLDER_NAME
WORKSPACE_ROOT_CONTAINER=/home/$USER/ws
SSH_AUTH_SOCK_USER=$SSH_AUTH_SOCK

# Create cache folders to store colcon build files
mkdir -p ${REPOSITORY_FOLDER_PATH}/.build
mkdir -p ${REPOSITORY_FOLDER_PATH}/.install

# Transfer the ownership to the user
chown -R "$USER" ${REPOSITORY_FOLDER_PATH}/.build
chown -R "$USER" ${REPOSITORY_FOLDER_PATH}/.install
# chown -R "$USER" ${REPOSITORY_FOLDER_PATH}/.build
# chown -R "$USER" ${REPOSITORY_FOLDER_PATH}/.install

# Check if name container is already taken.
if sudo -g docker docker container ls -a | grep "${CONTAINER_NAME}$" -c &> /dev/null; then
Expand Down

0 comments on commit 030c8f3

Please sign in to comment.