sl-uwb bb35ddd56d chore: resolve git conflict markers and complete legacy STM32/Mamba → ESP32-S3 rename
- Resolve 73 committed conflict markers (bulk resolution taking theirs/ESP32 side)
- Rename all MAMBA_CMD_* → BALANCE_CMD_*, MAMBA_TELEM_* → BALANCE_TELEM_*
- Rename FC_STATUS/VESC/IMU/BARO → BALANCE_STATUS/VESC/IMU/BARO in protocol_defs.py
- Update can_bridge_node.py: fix imports, replace legacy encode/decode calls with
  balance_protocol equivalents (encode_velocity_cmd, encode_mode_cmd, decode_imu_telem,
  decode_battery_telem, decode_vesc_state); fix watchdog and destroy_node
- Rename stm32_protocol.py/stm32_cmd_node.py → esp32_protocol.py/esp32_cmd_node.py
- Delete mamba_protocol.py; stm32_cmd.launch.py/stm32_cmd_params.yaml archived
- Update can_bridge_params.yaml: mamba_can_id → balance_can_id
- Update docs/AGENTS.md, SALTYLAB.md, wiring-diagram.md for ESP32-S3 architecture
- Update test/test_ota.py sys.path to legacy/stm32/scripts/flash_firmware.py
- No legacy STM32/Mamba refs remain outside legacy/ and SAUL-TEE-SYSTEM-REFERENCE.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 09:11:24 -04:00

82 lines
3.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
uart_bridge.launch.py — FC↔Orin UART bridge (Issue #362)
Launches serial_bridge_node configured for Jetson Orin UART port.
Bridges Flight Controller (ESP32-S3) telemetry from /dev/ttyTHS1 into ROS2.
Published topics (same as USB CDC bridge):
/saltybot/imu sensor_msgs/Imu — pitch/roll/yaw as angular velocity
/saltybot/balance_state std_msgs/String (JSON) — full PID diagnostics
/diagnostics diagnostic_msgs/DiagnosticArray — system health
Usage:
ros2 launch saltybot_bridge uart_bridge.launch.py
# Override UART port (Orin has THS0THS3):
ros2 launch saltybot_bridge uart_bridge.launch.py uart_port:=/dev/ttyTHS0
# Override baud rate:
ros2 launch saltybot_bridge uart_bridge.launch.py baud_rate:=115200
Prerequisites:
- Flight Controller connected to /dev/ttyTHS1 @ 921600 baud
- ESP32-S3 firmware transmitting JSON telemetry frames (50 Hz) - ROS2 environment sourced (source install/setup.bash)
Note:
/dev/ttyTHS1 is the native UART1 on Jetson Orin. Verify connectivity:
$ cat /dev/ttyTHS1 | head -5
{"p":123,"r":-45,"e":0,"ig":0,"m":0,"s":1,"y":0}
...
Troubleshooting:
- "Permission denied" → run with sudo or add user to dialout group
- No frames received → check Flight Controller baud rate, verify UART cable
- Garbled output → check baud rate mismatch, check cable shield/termination
"""
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
# ── Launch arguments ───────────────────────────────────────────────────
DeclareLaunchArgument(
"uart_port",
default_value="/dev/ttyTHS1",
description="Jetson Orin UART device (THS0THS3)",
),
DeclareLaunchArgument(
"baud_rate",
default_value="921600",
description="Serial baud rate (Flight Controller standard)",
),
DeclareLaunchArgument(
"timeout",
default_value="0.1",
description="Serial read timeout in seconds",
),
DeclareLaunchArgument(
"reconnect_delay",
default_value="2.0",
description="Delay before reconnect attempt on serial error (seconds)",
),
# ── Serial bridge node ─────────────────────────────────────────────────
Node(
package="saltybot_bridge",
executable="serial_bridge_node",
name="fc_uart_bridge",
output="screen",
parameters=[
{
"serial_port": LaunchConfiguration("uart_port"),
"baud_rate": LaunchConfiguration("baud_rate"),
"timeout": LaunchConfiguration("timeout"),
"reconnect_delay": LaunchConfiguration("reconnect_delay"),
},
],
),
])