Welcome to MicroROS Self-balancing Robot Car repository
1.Robot information release
Robot information release
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 [Must-read before use] to set the IP and ROS_DOMAIN_ID on the board.
1. Program function description
After the car connects to the proxy, it will publish sensor data such as radar and imu. You can run commands in the matching virtual machine to query this information, and you can also publish control data of sensors such as speed and buzzer.
2. Query the car information
2.1. Start and connect the agent
Take the matching 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 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.2. Query the car node information
Enter the following command in the terminal to query the node,
xxxxxxxxxxros2 node list 
Then enter the following command to query which topics the node publishes/subscribes to,
xxxxxxxxxxros2 node info /YB_Car_Node 
It can be seen that the subscribed topics are,
/beep: buzzer control
/cmd_vel_bl: car speed control
The published topics are,
/imu: imu module data
/mpuimu: mpu6050 module data
/odom_raw: odometer data
/scan: radar module data
We can also query the topic command, terminal input,
ros2 topic list 
2.3, query topic data
Query radar data,
xxxxxxxxxxros2 topic echo /scan 
Query imu data,
xxxxxxxxxxros2 topic echo /imu 
Query odom data,
xxxxxxxxxxros2 topic echo /odom_raw 
3. Publish car control information
3.1. Control buzzer
First query the following buzzer topic related information, terminal input,
xxxxxxxxxxros2 topic info /beep 
The data type is std_msgs/msg/UInt16. Then enter the following command to turn on the buzzer, terminal input,
xxxxxxxxxxros2 topic pub /beep std_msgs/msg/UInt16 "data: 1" 
Enter the following command to turn off the buzzer, terminal input,
xxxxxxxxxxros2 topic pub /beep std_msgs/msg/UInt16 "data: 0" 
3.2. Publish speed control information
We assume that the published car moves at a linear speed of 22.5 and an angular speed of 200.0. Input in the terminal,
xxxxxxxxxx#Linear speed range: 0~60.0#Angular speed range: 0~1000.0xxxxxxxxxxros2 topic pub /cmd_vel_bl geometry_msgs/msg/Twist "{linear: {x: 22.5, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 200.0}}"
If the car stops, input,
xxxxxxxxxxros2 topic pub /cmd_vel_bl geometry_msgs/msg/Twist "{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}" ``` 