Skip to content

AMwhisper/comm_node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Comm Node

ROS2 Communication Node for RoboMaster AutoAim System

ROS2 Python License


Overview

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.


Features

  • 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

System Architecture

+----------------+
|    AutoAim     |
| (Perception)   |
+--------+-------+
         |
         | AutoaimData.msg
         v
+--------+-------+
|   Comm Node    |
| Protocol Pack  |
+--------+-------+
         |
         | USART
         v
+--------+-------+
|     STM32      |
| Lower Controller|
+----------------+

Communication Flow

Camera
   │
   ▼
YOLO Detection
   │
   ▼
PnP Solver
   │
   ▼
Kalman Tracker
   │
   ▼
AutoAim Result
   │
   ▼
ROS2 Topic
   │
   ▼
Comm Node
   │
   ▼
Protocol Packing
   │
   ▼
USART Transmission
   │
   ▼
STM32 Controller

Sequence Diagram

┌─────────┐
│ AutoAim │
└────┬────┘
     │ Publish AutoaimData.msg
     ▼
┌────────────┐
│ Comm Node  │
└────┬───────┘
     │ Receive Data
     ▼
┌────────────┐
│  pack.py   │
└────┬───────┘
     │ Build Frame
     ▼
┌────────────┐
│   USART    │
└────┬───────┘
     │ Send Packet
     ▼
┌────────────┐
│   STM32    │
└────────────┘

Project Structure

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

Message Interface

AutoaimData.msg

This custom ROS2 message carries targeting information generated by the AutoAim system.

Example fields:

float32 yaw
float32 pitch
float32 distance
uint8 fire

Protocol Workflow

  1. Receive AutoAim data from ROS2 topics
  2. Extract targeting information
  3. Pack data according to custom protocol
  4. Generate communication frame
  5. Send frame through USART
  6. STM32 receives and parses the packet

Build

cd ~/ros2_ws

colcon build --packages-select interface
colcon build --packages-select comm_node

source install/setup.bash

Run

ros2 run comm_node comm_node

Dependencies

  • ROS2 Humble/foxy
  • Python 3.10+
  • pyserial
  • rclpy

Applications

This package is designed for:

  • RoboMaster AutoAim Systems
  • Embedded Robotics
  • Vision-to-Control Communication
  • ROS2 and STM32 Integration

Author

Jingqi Mei

Robotics • Computer Vision • Embedded Systems

GitHub: https://github.com/AMwhisper

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages