Welcome to MicroROS V2 Robot Car repository
1. Robot Information Release
Robot Information Publishing
Robot Information Publishing1. Course ContentCourse Objectives2. Preparation3. Demonstration3.1 Chassis Sensor Topics3.2 Controlling the Robot Chassis through Topics3.3 Controlling the Buzzer On/Off through Topics3.4 Controlling the Servo Gimbal Angle through Topics3.5 Controlling Movement through Services3.6 Saving Camera Images through a Service
1. Course Content
- Connect to the robot car through the micro-ROS agent, view topic data, and control the robot through topic and service interfaces
Course Objectives
- Understand how the car's sensor data enters the ROS 2 system
- Master the basic operations of subscribing to topics and publishing control commands through the command line
2. Preparation
ros2 launch microros_v2_bringup car_base.launch.py

3. Demonstration
3.1 Chassis Sensor Topics
- Topic summary
| Topic | Message Type | Description |
|---|---|---|
imu | sensor_msgs/Imu | IMU angular velocity + linear acceleration |
odom_raw | nav_msgs/Odometry | Accumulated wheel odometry |
scan | sensor_msgs/LaserScan | LiDAR scan data |
battery | std_msgs/Float32 | Battery voltage |
ptz_angle | geometry_msgs/Vector3 | Current gimbal angles (x=S1 horizontal, y=S2 pitch, in degrees) |
- View all topics
xxxxxxxxxxros2 topic list
- View the publishing rate of a specified topic:
xxxxxxxxxxros2 topic hz /imu
- View the data content of a specified topic
xxxxxxxxxxros2 topic echo /imu --once

[!TIP]
The command format for viewing the data content, rate, and other information of other topics is the same; just replace the corresponding topic name
3.2 Controlling the Robot Chassis through Topics
- Publish velocity commands to
/cmd_velto control the car movement:
xxxxxxxxxx# Move forward at 0.3 m/s on the x-axisros2 topic pub /cmd_vel geometry_msgs/msg/Twist "{linear: {x: 0.3}, angular: {z: 0.0}}"
xxxxxxxxxx# Turn left in place at 1.0 rad/sros2 topic pub /cmd_vel geometry_msgs/msg/Twist "{angular: {z: 1.0}}"
- Stop the car movement
xxxxxxxxxxros2 topic pub /cmd_vel geometry_msgs/msg/Twist "{linear: {x: 0.0}, angular: {z: 0.0}}"
3.3 Controlling the Buzzer On/Off through Topics
xxxxxxxxxx# Turn on the buzzerros2 topic pub /beep std_msgs/msg/UInt16 "{data: 1}" --once# Turn off the buzzerros2 topic pub /beep std_msgs/msg/UInt16 "{data: 0}" --once

3.4 Controlling the Servo Gimbal Angle through Topics
[!NOTE]
x:0.0 ,y: -45.0 is the neutral position of the servo gimbal: the camera faces directly forward
xxxxxxxxxx