5. Enter the robot’s docker container

Raspberry Pi PI5Master Control’s ROS1 courses are all in docker containers.

The operating environment and software and hardware reference configuration are as follows:

  1. What is a docker host?

  1. What is GUI?

  1. What is the robot’s docker container?

  1. Before operating the tutorial in this chapter, please make sure that you have mastered the knowledge of the following chapters, otherwise you may find it difficult to learn. If this happens, please review the following pre-knowledge content repeatedly. Once you master it, you will feel very relaxed. Come on, you are the best!

image-20230519094253521

 

5.2. How to query the docker image version used by the robot

  1. The docker image version used by the robot is also the image version used on the car. After the user burns the system image of the car and starts it, execute:

You will see multiple docker image versions. Please select the name [yahboomtechnology/ros-foxy]. The version with the highest tag is the latest image version of the robot. As queried here, use the [yahboomtechnology/ros-foxy:3.5.4] version, and ignore the image named [192.168.2.51:5000/ros-foxy].

  1. Why can’t we just put one docker image in the car system?

If you have read the tutorial in this chapter [07. Docker ------- 3. In-depth understanding of docker images and publishing images], you should know that docker images are a layered mechanism, that is, the image of a subsequent tag depends on the image of the previous tag. Mirror. Therefore, there may be multiple versions of docker images in the host machine, and the tags of these images will be updated incrementally.

In the future, we will update new courses and update functions by releasing new docker images.

 

5.3. Binding peripherals

 

image-20230506144842423

 

5.4. Check the peripheral connection status

 

This step is performed on the host machine:

  1. This is to view the peripherals other than the camera. There is no voice control module connected here. If it is connected, the [myspeech] device will be displayed.

image-20230423172753208

 

  1. Check the ports of the AstraPro Plus camera as follows:

 

5.5. Edit script

Since the port number will often change after the AstraPro Plus camera is plugged in and unplugged, you need to re-edit the script to configure the port of the AstraPro Plus camera.

 

Edit the script to run docker. This step is performed on the host machine:

  1. The script to run docker [run_docker.sh] is generally placed in the root directory of the car's owner directory. Here I am in the path below. If not, you can create the file yourself, and remember to give the script executable permissions after creation.

image-20230423164551252

The content of the [run_docker.sh] script is as follows:

Those without comments can be copied directly and modified as needed.

Note: When adding a host device to the container below, if the host is not connected to the device, you need to remove the corresponding addition operation before the container can be opened.

ALL Masters ROS2

Raspberry Pi PI5 ROS1

Annotated script description:

Note: When adding a host device to the container below, if the host is not connected to the device, you need to remove the corresponding addition operation before the container can be opened.

 

  1. Modify the above script. These two lines are the port numbers of the AstraPro Plus camera. Since the port number will change after the camera is plugged in and out, you need to reconfigure the camera port.

It is the camera port queried in step 5.4 2. This port may change after the camera is plugged in and out, so everyone's port is different and needs to be configured by yourself.

 

 

5.6. Execute script

 

After step 5.5 is completed, open the terminal on the docker host machine [i.e. the car, which can be on VNC or on the car screen]

Note: This must be executed on the VNC of the car or on the car screen. It cannot be executed in the car terminal remotely entered through ssh (such as the car terminal entered through MobaXterm). Otherwise, the GUI image may not be displayed in the container, as shown below in MobaXterm After entering the car terminal and executing run_docker.sh to enter the container, rviz cannot be displayed.

image-20230423173220146

 

Execute in the VNC interface of the car or on the car screen:

You can correctly enter the container and display the GUI screen. You can execute the rviz2 command test again.

image-20230423171929960

 

If the GUI cannot be displayed after executing the rviz2 command, the following error is displayed: (generally possible in the Raspberry Pi master)

image-20230509173232054

You need to add another parameter to the startup script:

Right now:

Raspberry Pi PI5 ROS1

Then run the script again to enter the container and display the GUI screen.

 

 

5.7. Switch models, radars and cameras

Note: Since the ROSMASTER series robots are divided into multiple types of robots and multiple types of equipment, the factory system has been configured with routines for multiple types of equipment. However, since the product cannot be automatically identified, the machine type and radar model need to be manually set.

After entering the container: Make the following modifications according to the car model, radar type and camera type:

image-20230525093413004

After the modification is completed, save and exit vim, and then execute:

You can see the current modified car model, radar type and camera type

 

Robot project files are stored in the following directory:

 

5.8. Multiple terminals enter the same docker container

 

  1. In the above steps, a docker container has been opened. You can open another terminal on the host (car) to view:

image-20230423182207793

  1. Now enter the docker container in the newly opened terminal:

image-20230423182446607

After successfully entering the container, you can open countless terminals to enter the container.

Robot project files are stored in the following directory:

 

  1. Note:

(1) When executing the command in step 2, make sure the container is in the [UP] state

image-20230423182959239

(2) If the container is in the [Exited] closed state, please refer to step 1.6 below.

image-20230423183116348

 

 

5.8. How to open a container that is already in the [Exited] state

 

There are two situations: still need to use the camera and no longer need to use the camera

 

5.8.1. Need to use camera

First, you need to check whether the port of the AstraPro Plus camera has changed according to the guidance in the above step [5.3. Check the peripheral connection status].

  1. If the port of the Astra Pro camera is changed, it will not be possible to enter the container again.

(1) If there are some modifications in the container that need to be retained, you can refer to the following command to generate a new image,

(2) If there are no modifications that need to be retained, directly refer to the steps [5.2 to 5.5] in this chapter to enter the container.

 

  1. If the port of the AstraPro Plus camera has not changed, then directly refer to the steps of [5.7.3, Entering the [Exited] Closed State Container Again].

 

5.8.2. No need to use camera

Directly refer to the steps of [5.7.3, Entering the [Exited] Closed State Container Again] to perform.

 

 

5.8.3. Containers that enter the [Exited] closed state again

Open the terminal on the docker host machine [that is, the car, which can be on VNC or on the car screen]

Note: This must be executed on the VNC of the car or on the car screen. It cannot be executed in the car terminal remotely entered through ssh (such as the car terminal entered through MobaXterm). Otherwise, the GUI image may not be displayed in the container. Of course, how can you There is no need to display the GUI image, that's fine.

  1. First check the status of the container

  1. Enable GUI access permissions

  1. Open the container [The ID of the container here can be abbreviated, as long as it can uniquely identify the currently existing container]

  1. Enter the container again

  1. Open rviz to see if the GUI screen can be opened.

  1. The specific implementation is as follows: