The ROS environment of Raspberry Pi 5 and the Dofbot hardware control case are both located in Docker. Every time we run the case, we need to start the corresponding container of Dofbot.
xxxxxxxxxx
Starting docker yourself is necessary to run a single case or personal development.
Note: The startup program must be closed to run a single case!
For the tutorial on closing the large startup program, please refer to the tutorial [Preparation before development: Closing the large startup program].
xxxxxxxxxx
[Preparation before development: Close the startup program]: The tutorial provides temporary/permanent shutdown of the startup program and shutdown/restoration of the startup Docker script operation!
For first-time users, I recommend temporarily closing the startup program. For simple developers, you can try closing the startup program permanently.
xxxxxxxxxx
If the recovery of the large boot program fails permanently, you can follow the tutorial to reverse the recovery or burn the system yourself to restore the factory mode.
We provide the script file Docker_Ros.sh
for running the docker image corresponding to Dofbot in the home directory on the Raspberry Pi 5 motherboard.
xxxxxxxxxx
#!/bin/bash
# Wait for the Docker service to start
while true; do
if systemctl is-active --quiet docker; then
echo "Docker service has been started"
break
else
echo "The Docker service has not started, waiting..."
sleep 1
fi
done
# Docker start
xhost+
docker run -it --rm \
--privileged=true \
--net=host \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--security-opt apparmor:unconfined \
-v /home/pi/Temp:/root/Temp \
--device=/dev/video0 \
--device=/dev/i2c-1 \
yahboomtechnology/ros-melodic:4.4 /bin/bash
Start command
xxxxxxxxxx
./Docker_Ros.sh
If the hardware device is not connected correctly, starting docker may fail!
If the camera is not connected or the one identified is not /dev/video0, Docker may not be able to enter correctly or the camera case will report an error.
If you need to cancel the hardware mapping of the USB camera, we can delete the corresponding --device=/dev/video0\
information in the startup script.
xxxxxxxxxx
#!/bin/bash
# Wait for the Docker service to start
while true; do
if systemctl is-active --quiet docker; then
echo "Docker service has been started"
break
else
echo "The Docker service has not started, waiting..."
sleep 1
fi
done
# Docker start
xhost+
docker run -it --rm \
--privileged=true \
--net=host \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--security-opt apparmor:unconfined \
-v /home/pi/Temp:/root/Temp \
--device=/dev/i2c-1 \
yahboomtechnology/ros-melodic:4.4 /bin/bash