5.Enter docker container

 

 

5.1、related concepts

  1. What is the host of Docker?
  1. What is GUI?
  1. What is the docker container
  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 which is the highest tag version is the latest image version of the board. The actual situation is displayed based on the mirror you have queried.

2、Why can't you just put a docker image in the car system?

If you have read the tutorial in the chapter [ 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

The following uses Radar and serial device bonding as an example

This step is performed on the host::

1、Here is to view peripherals other than the camera

image-20230423172753208

2、View camera device

 

5.4、Edit scripts

Then edit the startup script according to the device found in the previous step

The following uses Radar and serial device bonding as an example

Edit the script that runs docker,This step is performed on the host:

1、Create a docker run script [run_usb_docker.sh], It's usually in the home directory

【run_usb_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

 

Here is the 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

 

5.5、Execute scripts

After the 5.4 step is completed, ,open the terminal on the host of docker(can be on VNC or on the screen of the board)

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

Run the startup script you created earlier on the VNC interface or on the screen

(Note: Each time this script is executed, a new container is created from the image.)

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

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

image-20230509173232054

You need to add another parameter to the startup script:

such as:

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

 

5.6、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 to view:

2、Now enter the docker container in this newly opened terminal:

example:

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

3、Note:

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

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

 

 

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

There are two cases here:: Cameras and other related external equipment changes and Cameras and other related external equipment not changes(See step 5.3 Checking Peripheral Connections)

1、Cameras and other related external equipment changes

If there are changes in the container that need to be preserved, can generate a new image by referring to the following command(See the previous tutorial for detailed steps to publish an image)

2、Cameras and other related external equipment not changes,then directly refer to the [5.7.1、enter the [Exited] closed container again] step to execute.

 

5.7.1、enter the [Exited] closed container again

Open the terminal on the docker's host ( can be on VNC or on the screen of the matherboard )

Note: Here must be executed on the VNC of the board or on the screen of the board, not in the board terminal entered remotely through ssh, 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

2、Enable GUI access permissions

3、Open the container [the ID of the container here can be abbreviated, as long as it can uniquely identify the container that currently exists]

4、Enter the container again

5、Open rviz to see if the GUI screen can be opened