This repository provides the ROS 2 Humble integration layer for the main temperature control platform:
👉 Main embedded project (hardware + firmware + control)
https://github.com/CrissCCL/Temp_ControlMod
It runs on a Raspberry Pi and bridges an embedded controller (Teensy/MCU) to ROS 2 via UART, enabling:
- Real-time telemetry streaming
- Remote setpoint commands
- Online control performance metrics
- Logging, visualization, and data analysis
- Bidirectional UART ↔ ROS 2 communication
- Real-time telemetry (~100 Hz, limited by UART bandwidth)
- Remote setpoint commands
- Online control metrics (IAE, ISE, ITAE, RMSE, overshoot, settling time)
- rosbag logging support
- Embedded + middleware architecture
- Designed for control engineering education and experimentation
/uart_ros_bridge/→ UART bridge + control metrics nodes/launch/→ system launch files/scripts/→ offline utilities (CSV merge, analysis)/docs/→ diagrams and screenshots/notebooks/→ data analysis (optional)
/control_temp_LC3/→ Teensy / Arduino firmware (compiled independently, not part of colcon build)
package.xmlsetup.py
Physical connections:
- Teensy → temperature sensor + actuator (heater/fan)
- UART (Serial1) → Raspberry Pi
- Raspberry Pi → ROS 2 nodes (bridge + metrics + visualization)
The Teensy executes the real-time PI temperature control loop and communicates with ROS 2 using a simple ASCII UART protocol.
temp,u,ref\n
REF:<value>\n
Where:
temp→ measured temperatureu→ control effortref→ active setpoint
- Serial1
- 57600 baud
- 8N1
Firmware is compiled with Arduino/Teensyduino and runs independently from ROS.
- Control systems laboratories
- Embedded–ROS integration
- Controller tuning and identification
- Digital twin experimentation
- Teaching automatic control
| Topic | Type | Description |
|---|---|---|
/temp |
Float32 | Temperature measurement |
/u |
Float32 | Control effort |
/ref |
Float32 | Active setpoint |
/temp_u_ref |
String | Raw telemetry line |
/control_metrics |
String | Online performance metrics |
| Topic | Type | Description |
|---|---|---|
/ref_cmd |
Float32 | New setpoint command |
MCU → RPi (ROS)
Line format (ASCII):
temp,u,ref\n
RPi (ROS) → MCU
Command format (ASCII):
REF:<value>\n
Default port/baud (editable in the node file):
- Port:
/dev/serial0 - Baud:
57600
- Ubuntu 22.04 + ROS 2 Humble
- Python 3
pyserial
Install pyserial:
pip3 install pyserialTip (serial permissions): add your user to
dialout
sudo usermod -a -G dialout $USER
# logout/loginmkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone <THIS_REPO_URL> uart_ros_bridge_repo
cd ..
colcon build
source install/setup.bashsource /opt/ros/humble/setup.bash
source ~/ros2_ws/install/setup.bash
ros2 launch uart_ros_bridge system.launch.pyUART bridge:
ros2 run uart_ros_bridge uart_temp_to_rosMetrics:
ros2 run uart_ros_bridge control_metricsSend a new setpoint:
ros2 topic pub /ref_cmd std_msgs/msg/Float32 "{data: 40.0}"Quick check:
ros2 topic echo /temp
ros2 topic echo /control_metricsPlot:
rqt_plot /temp /ref /usource /opt/ros/humble/setup.bash
source ~/ros2_ws/install/setup.bash
ros2 launch uart_ros_bridge system.launch.pyros2 topic echo /temp_u_refros2 topic echo /temp
ros2 topic echo /u
ros2 topic echo /refros2 topic pub --once /ref_cmd std_msgs/msg/Float32 "{data: 40.0}"source /opt/ros/humble/setup.bash
source ~/ros2_ws/install/setup.bash
rqtYou should observe:
- temperature tracking the reference
- control effort reacting to the error
- stable closed-loop behavior
If you export ROS bag topics to CSV files (e.g., temp.csv, u.csv, ref.csv), you can merge them:
python3 scripts/merge_temp_u_ref_csv.py- Embedded firmware (MCU / control loop)
- 👉 https://github.com/CrissCCL/Temp_ControlMod
Support me on Patreon https://www.patreon.com/c/CrissCCL
MIT License


