Skip to content

Commit

Permalink
Added foxy support (#28)
Browse files Browse the repository at this point in the history
* Added foxy support

* Updated README for ros2 foxy and v1.6
  • Loading branch information
gstavrinos committed Jul 16, 2023
1 parent 0e7c942 commit a1a0119
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ or
* [For versions >= `v1.3.0`] A ROS Melodic version is now available (with the `rosezm` command) and a much more robust locking mechanism is now in effect. If you experienced frequent lockouts or race conditions, this version should be more stable.
* [For versions >= `v1.4.0`] All supported ROS versions (melodic/noetic/humble) now work on a completely persistent filesystem to save apt, library and other installations + all other user-defined changes on the container. Additionally, this version also supports audio, enabling users to play sounds through the `rosez` containers.
* [For versions >= `v1.5.0`] The `sc` or `skip-compilation` flag is now supported, which completely bypasses rosdep and catkin/colcon builds for faster startup.

* [For versions >= `v1.6.0`] A ROS2 Foxy version is now available (with the `ros2ezf` command). Its image comes with built-in `ros1_bridge` support for *ez* ROS1-ROS2 integration.
## Tested platforms
* EndeavourOS
* Fedora 35
Expand Down
1 change: 1 addition & 0 deletions includes/ros2f_ws.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/$USER/ros2_foxy_ws/
5 changes: 4 additions & 1 deletion internal/entrypoint.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ lockation=""
wstxt="ros2_ws.txt"
if [ -f /opt/ros/humble/setup.bash ]; then
rosversion="humble"
elif [ -f /opt/ros/foxy/setup.bash ]; then
rosversion="foxy"
wstxt="ros2f_ws.txt"
elif [ -f /opt/ros/noetic/setup.bash ]; then
rosversion="noetic"
wstxt="ros_ws.txt"
Expand Down Expand Up @@ -41,7 +44,7 @@ if [ "$rosversion" != "unknown" ]; then
output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "rosdep install -ir --from-path src --rosdistro $rosversion -y" | tee /dev/fd/2)
intermediate_error_handler $?
fi
if [ "$rosversion" == "humble" ]; then
if [ "$rosversion" == "humble" ] || [ "$rosversion" == "foxy" ]; then
if [ $skip_compilation -ne 1 ]; then
output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo" | tee /dev/fd/2)
intermediate_error_handler $?
Expand Down
5 changes: 5 additions & 0 deletions internal/installer.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ elif [ "$1" == "3" ]; then
volume="rosezm-volume"
executable_folder_name="ros-ezm"
dockerfile="ros_melodic_Dockerfile"
elif [ "$1" == "4" ]; then
image_name="ros2_ezf"
volume="ros2ezf-volume"
executable_folder_name="ros2-ezf"
dockerfile="ros2_foxy_Dockerfile"
fi
sudo pip install rocker==0.2.10
cd $SCRIPT_DIR
Expand Down
3 changes: 3 additions & 0 deletions internal/ros2-ezf/ros2ezf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
$SCRIPT_DIR/../rosez_exec.bash "4" $*
2 changes: 1 addition & 1 deletion internal/ros2_Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM osrf/ros:humble-desktop-full

LABEL maintainer="George Stavrinos <gstavrinos@protonmail.com>"

RUN mkdir -p /opt/ros/ros2_ws/src && apt-get update && apt-get full-upgrade -y && apt-get install -y \
RUN mkdir -p /opt/ros/ros2_ws/src && apt-get update && apt-get full-upgrade -y && DEBIAN_FRONTEND=noninteractive apt-get install -y \
gdb \
xterm \
valgrind \
Expand Down
60 changes: 60 additions & 0 deletions internal/ros2_foxy_Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM osrf/ros:foxy-ros1-bridge

LABEL maintainer="George Stavrinos <gstavrinos@protonmail.com>"

RUN apt-get update --allow-insecure-repositories && apt-get install -y curl && curl http://repo.ros2.org/repos.key | apt-key add - && apt-get update && apt-get full-upgrade -y && DEBIAN_FRONTEND=noninteractive apt-get install -y \
gdb \
xterm \
valgrind \
pulseaudio \
mesa-utils \
libuvc-dev \
python3-bloom \
openssh-client \
libgl1-mesa-glx \
ros-foxy-desktop \
python3-catkin-pkg \
ros-foxy-gazebo-ros \
ros-foxy-navigation2 \
ros-foxy-nav2-bringup \
ros-foxy-ros2-control \
ros-foxy-slam-toolbox \
ros-foxy-gazebo-plugins \
ros-foxy-ros2controlcli \
ros-foxy-gazebo-ros-pkgs \
ros-foxy-control-toolbox \
ros-foxy-ros2-controllers \
ros-foxy-rmw-cyclonedds-cpp \
ros-foxy-controller-manager \
ros-foxy-effort-controllers \
ros-foxy-robot-localization \
ros-foxy-gazebo-ros2-control \
ros-foxy-velocity-controllers \
ros-foxy-position-controllers \
ros-foxy-joint-state-publisher \
ros-foxy-transmission-interface \
ros-foxy-joint-state-publisher-gui

ARG USER_ID=16661
ARG GROUP_ID=16661

RUN addgroup --gid $GROUP_ID rosez_user && adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID rosez_user && usermod -aG sudo rosez_user && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && touch /home/rosez_user/.sudo_as_admin_successful

USER rosez_user
RUN rosdep update

VOLUME /opt/ros/foxy
VOLUME /bin
VOLUME /etc
VOLUME /home
VOLUME /lib
VOLUME /lib64
VOLUME /mnt
VOLUME /opt
VOLUME /root
VOLUME /run
VOLUME /sbin
VOLUME /srv
VOLUME /sys
VOLUME /usr
VOLUME /var
2 changes: 1 addition & 1 deletion internal/ros_Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM osrf/ros:noetic-desktop-full

LABEL maintainer="George Stavrinos <gstavrinos@protonmail.com>"

RUN mkdir -p /opt/ros/catkin_ws/src && apt-get update && apt-get full-upgrade -y && apt-get install -y \
RUN mkdir -p /opt/ros/catkin_ws/src && apt-get update && apt-get full-upgrade -y && DEBIAN_FRONTEND=noninteractive apt-get install -y \
gdb \
xterm \
valgrind \
Expand Down
2 changes: 1 addition & 1 deletion internal/ros_melodic_Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM osrf/ros:melodic-desktop-full

LABEL maintainer="George Stavrinos <gstavrinos@protonmail.com>"

RUN mkdir -p /opt/ros/catkin_ws/src && apt-get update && apt-get full-upgrade -y && apt-get install -y \
RUN mkdir -p /opt/ros/catkin_ws/src && apt-get update && apt-get full-upgrade -y && DEBIAN_FRONTEND=noninteractive apt-get install -y \
gdb \
xterm \
valgrind \
Expand Down
11 changes: 11 additions & 0 deletions internal/rosez_exec.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ elif [ "$1" == "3" ]; then
rosez_vol="rosezm-volume"
ros="melodic"
ros_image="ros_ezm"
elif [ "$1" == "4" ]; then
rosws_file="ros2f_ws.txt"
rosez_vol="ros2ezf-volume"
ros="foxy"
ros_image="ros2_ezf"
fi
shift
trap 'signal_handler' $signal_list
Expand All @@ -39,6 +44,10 @@ lockation=""
while read -r line
do
wsdir=$(eval echo -e "$line")
if [ ! -d "$wsdir" ]; then
echo "$wsdir not found, creating it"
mkdir -p $wsdir/src
fi
volumes=$volumes"--volume $wsdir:/opt/ros/$(basename $wsdir) "
if [[ -z $lockation ]]; then
# lockdir=$(basename wsdir)
Expand Down Expand Up @@ -122,6 +131,8 @@ if [ ! -d $ssh_folder ]; then
fi
intermediate_error_handler $?
x=""$(rocker --mode dry-run --network host --x11 --pulse $gpu_param --volume $rosez_vol-bin:/bin --volume $rosez_vol-etc:/etc/ --volume $rosez_vol-etc:/etc/ --volume $rosez_vol-home:/home/ --volume $rosez_vol-lib:/lib/ --volume $rosez_vol-lib64:/lib64/ --volume $rosez_vol-mnt:/mnt/ --volume $rosez_vol-opt:/opt/ --volume $rosez_vol-root:/root/ --volume $rosez_vol-run:/run/ --volume $rosez_vol-sbin:/sbin/ --volume $rosez_vol-srv:/srv/ --volume $rosez_vol-sys:/sys/ --volume $rosez_vol-usr:/usr --volume $rosez_vol-var:/var --volume $rosez_vol:/opt/ros/$ros --volume $SCRIPT_DIR/../includes/$rosws_file:/opt/ros/$rosws_file $volumes $SCRIPT_DIR/../internal/entrypoint.bash:/home/rosez_user/.bashrc --volume /dev:/dev --volume $bloom_file:/home/rosez_user/.config/bloom --volume $gitconfig_file:/home/rosez_user/.gitconfig --volume $ssh_folder:/home/rosez_user/.ssh --volume $SCRIPT_DIR/helpers.bash:/home/rosez_user/helpers.bash --volume /:$HOME/.$rosez_vol -- $ros_image:latest | tail -n 1 | sed -e "s#-v $(pwd)/$rosez_vol#-v $rosez_vol#g")
echo "------;)----"
echo $x
intermediate_error_handler $?
xauthf="$((echo \"$x\") | grep -E -o '/tmp/.docker[a-zA-Z0-9_-]+.xauth' | head -1)"
intermediate_error_handler $?
Expand Down
3 changes: 3 additions & 0 deletions ros2f_installer.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
$SCRIPT_DIR/internal/installer.bash "4"

0 comments on commit a1a0119

Please sign in to comment.