Welcome to ROSMASTER R2 repository
6. docker in the robot development environment build
6. docker in the robot development environment build
6. docker in the robot development environment build6.1. Using jupyter lab to access docker6.2 Using vscode to access docker6.2.1. Remote Configuration6.2.2. vscode configuration6.2.2.1. Download and install vscode6.2.2.2. vscode configuration ssh remote login to the host computer6.2.2.3. Entering the robot container6.2.2.4, vscode remote host configuration docker environment6.2.2.5 Configuring Confidential Login
The operating environment and hardware and software reference configuration are as follows:
- Reference model: ROSMASTER X3
- Robot hardware configuration: Arm series main control, Silan A1 LiDAR, AstraPro Plus depth camera.
- Robot system: Ubuntu (version not required) + docker (version 20.10.21 and above)
- PC virtual machine: Ubuntu (20.04) + ROS2 (Foxy)
- Usage scenario: use on a relatively clean 2D plane
6.1. Using jupyter lab to access docker
- Enter the container, see [5. Enter the docker container of the robot], and execute the following command:
Note: When using jupyter lab in a docker container, you must run the docker container with host networking: add the "--net=host" parameter when running the container.
xxxxxxxxxxroot@ubuntu:/# jupyter lab --allow-root[I 2023-04-24 09:27:45.265 ServerApp] Package jupyterlab took 0.0001s to import[I 2023-04-24 09:27:45.277 ServerApp] Package jupyter_server_fileid took 0.0096s to import[I 2023-04-24 09:27:45.297 ServerApp] Package jupyter_server_terminals took 0.0190s to import[I 2023-04-24 09:27:45.429 ServerApp] Package jupyter_server_ydoc took 0.1301s to import[I 2023-04-24 09:27:45.431 ServerApp] Package nbclassic took 0.0001s to import..................
- other device view, open in windows or ubuntu browser (must be on the same LAN, 192.168.2.102 is the IP address inside the docker container)
xxxxxxxxxxhttp://192.168.2.102:8888/lab输入密码:yahboom,即可进入jupyter labEnter the password: yahboom to access jupyter lab

The following directory is the project path for the robot:
6.2 Using vscode to access docker
Here is an example of how to configure vscode to access docker containers in windows, and the steps to access docker in ubuntu are basically the same.
6.2.1. Remote Configuration
See section [VI. Linux operating systems ---- 3. Remote control].
Make sure windows can log in remotely to docker's host [cart]:
xxxxxxxxxx在windows中打开cmd输入ssh命令测试:ssh jetson@192.168.2.102 (用户名和ip修改为自己的)或者使用远程工具:putty、xshell、securecrt、winscp、mobaxterm、finalshell等都可以Open cmd in windows and enter ssh command to test: ssh jetson@192.168.2.102 (username and ip changed to your own)Or use remote tools: putty, xshell, securecrt, winscp, mobaxterm, finalshell, etc. can be used
6.2.2. vscode configuration
6.2.2.1. Download and install vscode
vscode official website: https://code.visualstudio.com/, download the windows version of the installation can be
6.2.2.2. vscode configuration ssh remote login to the host computer
1, open vscode, click on the left below the arrow icon, and then in the search box, type remote, select Remote Development plug-in, click Install to install the plug-in.

vscode default installation after the English version, you can install Chinese plug-ins to Chinese:
- In vscode, press the shortcut key [ctrl + shift + p] to open the command input window, type: remote, and then follow the guidelines in the figure below to log in to the remote host [cart].
How to see the screen above, indicating that you have successfully logged in remotely to the host computer.
6.2.2.3. Entering the robot container
See the tutorial in section [5. Entering the robot's docker container] to enter.
6.2.2.4, vscode remote host configuration docker environment
1.Install the docker plugin on the remote host [cart].
- After the installation is complete, a docker icon will appear in the left navigation bar
- Click the docker icon
- Right-click on the running container and follow the figure below:
- A new window will open, see the following indicates that you have entered the container
- Open the folder
xxxxxxxxxx/root/yahboomcar_ros2_ws # 这是机器人的项目路径# This is the robot's project path
- Similarly, in the container can also install the plug-ins we need to facilitate the development of our

In addition to ros, the recommended plugins to install here are:
After completing the above steps, you can manipulate the code files in the container to develop and learn.
6.2.2.5 Configuring Confidential Login
In the above steps, some steps may need to enter the host's password, here again to optimize the configuration of the password-free login.
- first test in windows using ssh login to the host [cart], the command is as follows:
xxxxxxxxxxssh jetson@192.168.2.102 (用户名和ip修改为自己的)(Username and ip changed to your own)
This time you will find that you need to enter the host password
- Next, configure password-free login
(1) Add environment variables
Open the environment variable properties page, click New in the user variables section, the variable HOME, the value of C:\Users\name, where name is the user name, you can check your own computer's user name, after the generated key pairs are saved in this directory by default.

(2) Generate key pairs
Open the cmd command line, run in the directory where the ssh program is located, or after adding the system environment, run the command [ssh-keygen -t rsa] used to generate the key, and then all the way back to the car, when you see a rectangle generated, then the key generation is successful. At this point in the user directory of the .ssh folder will be two more files that is id_rsa (private key), id_rsa.pub (public key)

(3) Add the public key to the host machine
Again open the cmd command line and type
xxxxxxxxxxssh username@host "cat >> ~/.ssh/authorized_keys" < C:\Users\name\.ssh\id_rsa.pub#例如:根据自己的情况修改# e.g. Modify as you see fitssh jetson@192.168.2.102 "cat >> ~/.ssh/authorized_keys" < C:\Users\Admin\.ssh\id_rsa.pub This command first logs in to the host machine and then adds the public key from the local machine, Win, to the personal directory of the host account, thus enabling password-free login. Note that you need to enter the host account's password for this step.
(4) Authentication
Test again using ssh login on windows to the host [cart] with the following command:
xxxxxxxxxxssh jetson@192.168.2.102 (用户名和ip修改为自己的)(Username and ip changed to your own)
At this point you will realize that you no longer need to enter a password.
Restart vscode and you will no longer need to enter passwords where they are required.