ROS2 Communication Node for RoboMaster AutoAim System
Comm Node is a ROS2 communication package designed for RoboMaster robots.
The node receives targeting data generated by the AutoAim system, packs the data according to a custom communication protocol, and transmits it to the lower-level STM32 controller through a USART serial interface.
It serves as the bridge between the high-level perception system and the embedded control system.
- ROS2-based communication architecture
- Subscribe to AutoAim target data
- Custom protocol packing
- USART serial communication
- Low-latency data transmission
- Modular design
- Easy integration with STM32 controllers
- Support for custom message definitions
+----------------+
| AutoAim |
| (Perception) |
+--------+-------+
|
| AutoaimData.msg
v
+--------+-------+
| Comm Node |
| Protocol Pack |
+--------+-------+
|
| USART
v
+--------+-------+
| STM32 |
| Lower Controller|
+----------------+
Camera
│
▼
YOLO Detection
│
▼
PnP Solver
│
▼
Kalman Tracker
│
▼
AutoAim Result
│
▼
ROS2 Topic
│
▼
Comm Node
│
▼
Protocol Packing
│
▼
USART Transmission
│
▼
STM32 Controller
┌─────────┐
│ AutoAim │
└────┬────┘
│ Publish AutoaimData.msg
▼
┌────────────┐
│ Comm Node │
└────┬───────┘
│ Receive Data
▼
┌────────────┐
│ pack.py │
└────┬───────┘
│ Build Frame
▼
┌────────────┐
│ USART │
└────┬───────┘
│ Send Packet
▼
┌────────────┐
│ STM32 │
└────────────┘
comm_node/
│
├── src/
│ └── comm_node/
│ ├── comm_node/
│ │ ├── __init__.py
│ │ ├── comm_node.py
│ │ └── pack.py
│ │
│ ├── resource/
│ ├── test/
│ ├── package.xml
│ ├── setup.cfg
│ └── setup.py
│
├── interface/
│ ├── msg/
│ │ └── AutoaimData.msg
│ ├── CMakeLists.txt
│ └── package.xml
│
└── .gitignore
This custom ROS2 message carries targeting information generated by the AutoAim system.
Example fields:
float32 yaw
float32 pitch
float32 distance
uint8 fire
- Receive AutoAim data from ROS2 topics
- Extract targeting information
- Pack data according to custom protocol
- Generate communication frame
- Send frame through USART
- STM32 receives and parses the packet
cd ~/ros2_ws
colcon build --packages-select interface
colcon build --packages-select comm_node
source install/setup.bashros2 run comm_node comm_node- ROS2 Humble/foxy
- Python 3.10+
- pyserial
- rclpy
This package is designed for:
- RoboMaster AutoAim Systems
- Embedded Robotics
- Vision-to-Control Communication
- ROS2 and STM32 Integration
Jingqi Mei
Robotics • Computer Vision • Embedded Systems
GitHub: https://github.com/AMwhisper