I’ll start by saying I’m very new to Docker, ROS 2, and this forum. My bot is working for remote-operated scenarios, and now I am trying to set up autonomous behavior in my bot. I am using a Raspberry Pi 5 running Raspberry Pi OS (64-bit), which is communicating with a Pixhawk1. The RPi5 is connected to QGC mission planner on my PC via Ethernet. Everything in this setup is working. Now for autonomous behavior, I am trying to run ROS 2 Humble on my RPi5. ROS 2 Humble only has Tier 3 support for Raspberry Pi OS. So, I am using a Docker container for installing ROS 2 Humble on the RPi.
This is the issue I am encountering:
According to these docs: ROS 2 — Dev documentation, I have run the following commands so far:
$ git clone GitHub - ArduPilot/ardupilot_dev_docker
$ cd ardupilot_dev_docker/docker
$ docker build -t ardupilot/ardupilot-dev-ros -f Dockerfile_dev-ros .
$ docker run -it --name ardupilot-dds ardupilot/ardupilot-dev-ros
Now this opens the container’s terminal and I have followed the rest of the guidelines as mentioned on the docs, inside the container:
$ pip install -U MAVProxy
$ echo “source /opt/ros/humble/setup.bash” >> ~/.bashrc
$ printenv | grep -i ROS #to check for correct installation
$ echo “export ROS_DOMAIN_ID=7” >> ~/.bashrc
Now, according to the docs, I am setting up the build environment inside the container:
$ git clone --recurse-submodules GitHub - ArduPilot/ardupilot: ArduPlane, ArduCopter, ArduRover, ArduSub source
$ cd ardupilot
Tools/environment_install/install-prereqs-ubuntu.sh -y
Since inside the Docker container, I am logged in as root, I cannot run this particular command to install the necessary dependencies. Therefore, I cannot run ./waf configure --board Pixhawk1 and build my environment for SITL, etc. I know I am using Raspberry Pi OS and the script is meant for Ubuntu. To confirm compatibility, I have tested this particular file on my RPi5 outside container and it runs flawlessly, and I can build and get SITL running easily.
Here is what I tried to do to solve this issue so far:
- Tried to manually comment out the sudo requirement from the install-prereqs-ubuntu.sh script:
I commented out:
if [ $EUID == 0 ]; then
echo “Please do not run this script as root; don’t sudo it!”
exit 1
fi
However, if I try to run the script now, it still doesn’t run properly.
- Tried to create a new user inside the container and run the file:
I tried to create a new user inside the container and tried to run the file. This runs correctly and I can get SITL running from the new user. However, as I have logged in as a new user, I no longer have any of the directories that were created for root when I first created the image from the Dockerfile.
- Tried to edit Dockerfile_dev-ros to include a new user:
At the end of the Dockerfile, I added the following lines:
RUN useradd -u 1001 rosuser && echo “rosuser:password” | chpasswd
RUN usermod -aG sudo rosuser
Now when I build and run the Dockerfile, I get logged in as ‘rosuser’, a non-root user. However, now when I run the install-prereqs-ubuntu.sh script, I get an error about some ‘invalid signature’ and the script does not run. Moreover, the default .bashrc file that is created upon running the container as root is no longer available to me. That was a very lengthy file containing a lot of commands. I cannot see it using sudo cat, or edit it. This new ‘rosuser’ has no .bashrc file.
- Tried to use the STM toolchain as the docs suggest:
Setting up the Build Environment (Linux/Ubuntu) — Dev documentation
I don’t want to do this since I know that the script runs both on Raspberry Pi OS outside the container as well as inside the container when logged in as a non-root user.
However after giving up hope, I tried running the following commands inside the container as suggested by docs (as a root user btw):
$ export PATH=$PATH:$HOME/ardupilot/Tools/autotest
$ export PATH=/usr/lib/ccache:$PATH
$ . ~/.bashrc
$ wget https://firmware.ardupilot.org/Tools/STM32-tools/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
$ apt update
$ apt install make
$ apt install gawk
The next step according to the docs is to install “libc6-i386”. I tried to install this many times, but terminal always gave the same error that it cannot find this package.
I stopped continuing with this approach once I encountered this issue.
I have no idea how I should proceed. I just want to build inside the Docker container suggested by ArduPilot for ROS 2. Any help would be much appreciated.