Welcome to MicroROS Robot Expansion Board repository
Robot keyboard control
Robot keyboard control
Note: The virtual machine needs to be in the same LAN as the car, and the ROS_DOMAIN_ID needs to be consistent. You can check [Read me] to set the IP and ROS_DOMAIN_ID on the board.
1. Program function description
After the program is started, the car movement can be controlled through the keyboard.
2. Start and connect to the agent
Taking the supporting virtual machine as an example, enter the following command to start the agent:
sudo docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:humble udp4 --port 8090 -v4
Then, turn on the car switch and wait for the car to connect to the agent. The connection is successful, as shown in the figure below.

3、Start the keyboard control program
Enter the following command in the terminal to start the keyboard control program.
xxxxxxxxxxros2 run yahboomcar_ctrl yahboom_keyboard
Keyboard key descriptions are as follows
Directional control.
| 【i】or【I】 | 【linear,0】 | 【u】or【U】 | 【linear,angular】 |
|---|---|---|---|
| 【,】 | 【-linear,0】 | 【o】or【U】 | 【linear,-angular】 |
| 【j】or【J】 | 【0,angular】 | 【m】or【M】 | 【-linear,-angular】 |
| 【l】or【L】 | 【0,-angular】 | 【.】 | 【-linear,angular】 |
According to the control table description, you can go forward by pressing the [i] key. Press [,] to go back,Press [l] to rotate to the right, press [j] to rotate to the left, and so on.
speed control table
| speed change | speed change | keyboard keys | speed change |
|---|---|---|---|
| 【q】 | Linear speed and angular speed increased by 10% | 【z】 | Linear speed and angular speed are reduced by 10% |
| 【w】 | Only line speed increases by 10% | 【x】 | Only line speed is reduced by 10% |
| 【e】 | Only the angular velocity is increases by 10% | 【c】 | Only the angular velocity is reduced by 10% |
| 【t】 | Linear speed X-axis/Y-axis direction switching | 【s】 | Stop keyboard control |
Note: Since the car has a four-wheel drive structure with ordinary tires and cannot move sideways, the [t] button has no meaning. Before each use of keyboard control, you need to click on the terminal that starts the program, otherwise the key event cannot be detected.