5、Enter the bot's docker container

 

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

5.1、related concepts

  1. What is the host of Docker?

  1. What is GUI?

  1. What is a docker container for robots

  1. Before operating this chapter tutorial, please make sure that you have mastered the knowledge of the following chapters, otherwise you may feel more difficult to learn. In this case, please check the following pre-knowledge content repeatedly, you will feel very relaxed after mastering, 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 mirror version used on the trolley, and the user executes after the system image of the burned trolley is started:

You will see that there are multiple docker image versions, please select the name [yahboomtechnology/ros-foxy], the highest tag version is the latest image version of the robot. If you can find it here, use the [yahboomtechnology/ros-foxy:3.5.4] version, and the mirror image with the name [192.168.2.51:5000/ros-foxy] will not be bothered.

  1. Why can't you just put a docker image in the car system?

If you have read the tutorial in the chapter [07, Docker ------ 3, docker images to deeply understand and release images], you should know that docker images are layered mechanisms, that is, the image of the latter tag depends on the image of the previous tag. Therefore, there may be multiple versions of docker images in the host, and the tags of these images will be updated incrementally.

In the future, we will update the new course, and we will also update the function by releasing a new docker image

5.3、Binding peripherals

Port binding has been configured in the host, and you can view the content modification if you need to modify it:

image-20230506144842423

5.4、Check peripheral connections

This step operates on the host:

  1. Here is to view peripherals other than the camera, there is no voice control module connected here, and the connected [myspeech] device will be displayed

image-20230423172753208

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

5.5、Edit scripts

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

Edit the script running docker, this step is performed on the host:

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

image-20230423164551252

【run_docker.sh】The contents of the script are as follows:

Without comments, you can copy it directly and modify it as needed

Note: When adding a host device to a container below, if the host does not have the device connected, you need to remove the corresponding add operation to open the container

Annotated script description:

Note: When adding a host device to a container below, if the host does not have the device connected, you need to remove the corresponding add operation to open the container

  1. Modify the above script, these two lines are the port number of the AstraPro Plus camera, because the port number will change after the camera is plugged and unplugged, you need to reconfigure the port of the camera

For the camera port queried in step 5.4 2, this port may change after the camera is plugged and unplugged, so each person is different and needs to be equipped by yourself.

5.6、Execute scripts

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

Note: Here must be executed on the VNC of the trolley or on the trolley screen, not in the trolley terminal entered remotely through ssh (such as the trolley terminal entered through MobaXterm), otherwise the GUI image may not be displayed in the container, as follows in MobaXterm into the trolley terminal execution run_docker.sh after entering the container, rviz cannot be displayed

image-20230423173220146

Execute on the VNC interface of the trolley or on the trolley screen:

The container can be entered correctly, and the GUI screen can be displayed, and the rviz2 command test can be executed again.

image-20230423171929960

If the GUI cannot be displayed after executing the rviz2 command, the following error is displayed: (Generally, it may appear in the Raspberry Pi master)

image-20230509173232054

You need to add another parameter to the startup script:

namely:

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

5.7、Switch models, radar, and camera

Note: Since ROSMASTER series robots are divided into multiple robots and multiple devices, the factory system has been configured with routines for multiple devices, but because the product cannot be automatically identified, it is necessary to manually set the machine type and radar model.

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

image-20230525093413004

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

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

The 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, and another terminal can be opened on the host (car) to view:

image-20230423182207793

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

image-20230423182446607

Successfully entering the container, you can also open an unlimited number of terminals to enter the container.

The robot project files are stored in the following directory:

  1. Note:

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

image-20230423182959239

(2) If the container is in the Exited shutdown state, see Step 5.8 below

image-20230423183116348

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

There are two cases here: you still need to use a camera and you no longer need to use a camera

5.8.1、Camera required

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

  1. If the port of the Astra Pro camera changes, it cannot 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, then directly refer to the [5.2 to 5.6] steps in this section to enter the container.

  1. If the port of the AstraPro Plus camera has not changed, then directly refer to the [5.8.3, enter the [Exited] closed container again] step to execute.

5.8.2、No need to use a camera

Directly refer to the [5.8.3, enter the [Exited] closed container again] step execution.

5.8.3、enter the [Exited] closed container again

Open the terminal on the docker's host [that is, the car, which can be on VNC or on the screen of the car].

Note: Here must be executed on the VNC of the car or on the screen of the car, not in the car terminal entered remotely through ssh (such as the car terminal entered through MobaXterm), otherwise the GUI image may not be displayed in the container, of course, how you do not need to display the GUI image, then you can.

  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 container that currently exists]

  1. Enter the container again

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

  1. The specific implementation is as follows: