Welcome to MicroROS Self-balancing Robot Car repository
2.Robot keyboard control
Robot keyboard control
Note: The virtual machine needs to be in the same LAN as the robot, and the ROS_DOMAIN_ID needs to be consistent. You can check [Must Read Before Use] to set the IP and ROS_DOMAIN_ID on the board.
1. Start and connect the agent
Take the supporting virtual machine as an example, enter the following command to start the agent,
xxxxxxxxxxsudo docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:humble udp4 --port 8899 -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,

2. Start the keyboard control program
2.1 Code path
Code path:
xxxxxxxxxx/root/yahboomcar_ws/src/yahboomcar_ctrl/yahboomcar_ctrl
2.2 Run command
Take the matching virtual machine as an example, terminal input,
xxxxxxxxxxros2 run yahboomcar_ctrl yahboom_keyboard 
The keyboard key description is as follows,
2.3 Direction control
| Key | Linear angular velocity | Direction | Key | Linear angular velocity | Direction |
|---|---|---|---|---|---|
| 【i】 or 【I】 | 【linear,0】 | Go forward | 【u】 or 【U】 | 【linear,angular】 | Turn left |
| 【,】 | 【-linear,0】 | Go backward | 【o】 or 【O】 | 【linear,-angular】 | Turn right |
| 【j】 or |