ROS2 Structure

Crawler ROS 2 — Software Architecture

ROS 2 Jazzy · tracked differential drive · sensors, motor control, safety and TF2 · source architecture, October 2026

1. Command and motion pipeline

Teleop / Nav2Twist commands Velocity targetv ± ω·track_width/2 Motor driverPWM + cliff interlock TracksL / R /cmd_vel motor targets TMAG5273 pairRPM / revolutions ICM-20948/imu angular velocity Odometryfusion / integration /odom/tf /odometer/left|right/* odometry feedback to teleop / localization consumers Solid arrows = topic data flow · dashed arrow = feedback / downstream consumption

2. Node groups and responsibilities

Sensors

crawler_ina226_nodeBattery voltage, current, power and BatteryState; I²C
crawler_icm20948_nodeRaw acceleration and angular velocity on /imu
crawler_tmag_odom_pair_nodeLeft/right magnetic encoder counts, RPM and revolutions. Addresses 0x22 / 0x23 in this configuration
hlds_laser_publisherLDS-01 LiDAR publishes /scan

Control

crawler_teleopOperator command interface; /cmd_vel
crawler_velocity_targetDifferential track kinematics, speed limit, deadzone, RPM-to-duty calibration
crawler_motor_driverpigpio PWM and directions; reads Pico cliff data via serial; inhibits unsafe motion
crawler_odom_nodeMagnetic odometry + IMU, publishes /odom and odom → base_footprint

Safety & mapping

crawler_current_guard_nodeBattery current monitor; trips motor-enable GPIO on sustained overcurrent
crawler_cliff_costmap_nodeCliff observations to occupancy costmap layer
crawler_cliff_keepout_nodePersistent keepout regions around detected cliffs
Nav2 / SLAM Toolbox / AMCLExternal navigation integration; not started by this source archive’s crawler.launch.py

3. TF2 coordinate frames

mapodombase_footprintbase_linkbase_scancliff_sensor_04cliff_sensor_05cliff_sensor_06cliff_sensor_07 LiDAR, yaw ≈ πfront leftfront rightrear rightrear left Localization*Odometry nodeStatic TFStatic TF branches * map → odom requires a localization / SLAM node outside this launch file.

Dynamic transforms: the odometry node broadcasts odom → base_footprint. A localization or SLAM component may provide map → odom. Static transforms: base_footprint → base_link (z = 0.036 m), base_link → base_scan (x = −0.002854 m, z = 0.115 m, yaw = π), plus four cliff sensor frames. The IMU message uses imu_link; this launch file does not publish a corresponding static transform, so that frame must be defined separately if required by consumers.

4. Main ROS 2 topics

TopicProducerPurpose / consumer
/cmd_velTeleop / Nav2Linear x and angular z command → velocity target
/crawler/motor/{left,right}/targetVelocity targetNormalized signed PWM request → motor driver
/crawler/motor/{left,right}/dirMotor driverApplied direction feedback → odometry
/odometer/{left,right}/rpm and /revolutionsTMAG pairEncoder speed and displacement → odometry
/imuICM-20948Angular velocity and acceleration → odometry
/odom, /tfOdometryRobot pose, velocity and coordinate transform
/battery/currentINA226Overcurrent detection → current guard
/battery/voltage, /battery/power, /battery/stateINA226Power telemetry
/crawler/cliff_sensorsMotor driver / PicoFour cliff sensor states → safety mapping nodes
/scanLDS-01LaserScan → navigation / mapping

5. Safety and implementation notes

The Pico cliff sensor stream is read by the motor driver, not by a separate ROS sensor node. The motor driver uses unknown or stale cliff information as a safety condition. The independent current guard monitors /battery/current and controls the motor-enable line. These mechanisms must be verified with the tracks lifted before deployment.

Tracked-vehicle kinematics: v_left = v_x − ω × track_width / 2 and v_right = v_x + ω × track_width / 2. The velocity target node converts each track speed into sprocket RPM and a calibrated motor duty fraction, with separate forward/reverse coefficients per motor.

Source: crawler_bringup, crawler_control, crawler_safety, crawler_sensors. Diagrams simplify message transport and show logical dependencies; they are not an automatically recorded ROS graph.