Bolting a single-board computer (SBC) and a microcontroller unit (MCU) onto a mobile robot chassis looks like pure mechanical assembly, yet inside ROS 2 it is fundamentally an exercise in coordinate frame architecture. Raising a Raspberry Pi standoff by 3 mm shifts every sensor mounted above it, and rotating an MCU board by 90 degrees reorients any onboard inertial sensor axes. Having completed the drivetrain in Modeling Differential Drive Wheels and Casters in URDF, we now bring the dual-compute hierarchy outlined in ROS 2 Robot Hardware Architecture and the Robot Edge AI SoC Selection Checklist directly into the myros_sketch URDF tree.
This tutorial explains why mounting plates (rpi_base) and printed circuit boards (rpi_frame, esp32s3_frame) should be modeled as separate links, how fixed joints interact with /tf_static, and how to calculate non-overlapping vertical Z stacks on Ubuntu 24.04 with ROS 2 Jazzy.
Architectural Principle: Separating Mounting Brackets from PCBs
It is tempting to represent a Raspberry Pi 5 and its 3D-printed carrier bracket as a single lumped box link. On a real workbench, however, the physical stack consists of a 3D-printed PETG adapter plate (rpi_base) bolted to the aluminum chassis deck, followed by brass standoffs supporting the Raspberry Pi 5 PCB and cooler assembly (rpi_frame).
| Frame Name | Physical Component | Box Dimensions ($L \times W \times H$) | Mass | Modularity Benefit of Frame Separation |
|---|---|---|---|---|
esp32s3_frame | ESP32-S3 motor control MCU board | 0.026 × 0.063 × 0.008 m (or 0.05 × 0.07 × 0.01 m) | 0.010–0.050 kg | Establishes rear wiring clearance and reference origin for MCU-attached sensors |
rpi_base | 3D-printed PETG mounting plate | 0.090 × 0.060 × 0.005 m | 0.020–0.050 kg | Decouples chassis hole patterns from SBC mounting hole patterns |
rpi_frame | Raspberry Pi 5 PCB + heatsink/cooler | 0.085 × 0.056 × 0.017 m | 0.050–0.080 kg | Swapping boards (RPi 4 to RPi 5) or changing standoff height modifies only rpi_joint |
In URDF design, each hierarchical level should correspond to a physical unit of replacement. When rpi_base and rpi_frame are separated, replacing 3 mm standoffs with 6 mm standoffs to clear a taller heatsink requires changing a single number—the Z offset of rpi_joint—from 0.014 to 0.017. Every downstream frame attached above the Raspberry Pi (such as a top-deck LiDAR tower) automatically inherits the +3 mm elevation shift without manual recalculation.
REP-105 Naming Rules and Avoiding Duplicate Static Publishers
Both the REP-0105 Coordinate Frames for Mobile Platforms standard and the ROS 2 Jazzy tf2 documentation match coordinate frame identifiers by exact string comparison. A single character mismatch breaks the transform chain between sensor messages and the robot model.
| Naming Convention Rule | Valid Example | Invalid Example | Runtime Consequence if Violated |
|---|---|---|---|
| Lowercase & underscores only | esp32s3_frame, rpi_base | ESP32S3_Frame, rpi-base | Case or hyphen mismatches trigger tf2::LookupException in subscriber nodes |
No leading forward slash (/) | rpi_frame | /rpi_frame | TF2 rejects leading slashes, severing the frame from the transform tree |
| Descriptive role suffixes | rpi_base, rpi_frame | board1, box2 | Ambiguous names make view_frames PDFs and debugging logs unreadable |
Furthermore, understand how fixed joints are broadcast. When robot_state_publisher parses a URDF file, it converts every <joint type="fixed"> into a static transform message on /tf_static. In a distributed micro-ROS microcontroller architecture, the ESP32-S3 does not compute or broadcast TF matrices; it only stamps a header.frame_id string onto its outgoing packets while the Raspberry Pi publishes the URDF-derived /tf_static tree. Never launch a separate static_transform_publisher node for a parent-child pair that already exists in your URDF—having two publishers broadcast the same transform triggers continuous TF_REPEATED_DATA warnings.
Calculating Non-Overlapping Z Stacks and Writing the URDF
Because URDF <box> primitives are centered at their local link origin (0, 0, 0), stacking one component on top of another requires summing the top surface Z height of the lower part + any standoff air gap + half the thickness of the upper part. Omitting the half-thickness term sinks the upper box halfway into the lower box, causing <collision> interpenetration that makes physics engines jitter violently.
In myros_sketch, base_link and the center of the 0.05 m thick chassis sit at z = 0.0325 m above the floor, which places the top surface of the chassis deck at z = +0.025 m relative to base_link:
- ESP32-S3 MCU board (
esp32s3_frame): Mounted near the rear of the top deck (x = -0.060 m). Adding half of the board thickness (0.008 / 2 = 0.004 m) to the deck surface (0.025 m) gives a joint Z offset of0.029 m. (On a thicker0.06 mchassis wherechassisis the parent link, a0.010 mthick board sits at0.030 + 0.005 = 0.035 m.) - Raspberry Pi mounting plate (
rpi_base): Mounted slightly forward of center (x = +0.010 m). Adding half of the0.005 mplate thickness (0.0025 m) to the deck surface (0.025 m) yields a joint Z offset of0.0275 m. - Raspberry Pi 5 PCB (
rpi_frame): Mounted onrpi_baseusing0.003 m(3 mm) standoffs. Relative to the center ofrpi_base, the Z offset equals half the plate thickness (0.0025 m) + standoff height (0.003 m) + half the0.017 mPCB/heatsink thickness (0.0085 m) =0.014 m. (Its cumulative Z height abovebase_linkis $0.0275 + 0.014 = 0.0415\text{ m}$.)
Step 1: Adding esp32s3_joint and esp32s3_frame
An ESP32-S3 development board measures approximately 63 × 26 × 8 mm and weighs 10 g (0.010 kg). Orienting its 63 mm dimension laterally along the Y-axis fits comfortably across the 150 mm wide rear deck while keeping the USB-C port accessible and separating the PCB antenna from the Raspberry Pi mounting plate. Add the following block to urdf/myros_sketch.urdf:
<!-- ESP32-S3 dimensions and placement properties -->
<xacro:property name="esp32_x" value="-0.060"/>
<xacro:property name="esp32_y" value="0.0"/>
<xacro:property name="esp32_z" value="0.029"/>
<xacro:property name="esp32_size_x" value="0.026"/>
<xacro:property name="esp32_size_y" value="0.063"/>
<xacro:property name="esp32_size_z" value="0.008"/>
<material name="pcb_black">
<color rgba="0.12 0.12 0.14 1.0"/>
</material>
<joint name="esp32s3_joint" type="fixed">
<parent link="base_link"/>
<child link="esp32s3_frame"/>
<origin xyz="${esp32_x} ${esp32_y} ${esp32_z}" rpy="0 0 0"/>
</joint>
<link name="esp32s3_frame">
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="${esp32_size_x} ${esp32_size_y} ${esp32_size_z}"/>
</geometry>
<material name="pcb_black"/>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="${esp32_size_x} ${esp32_size_y} ${esp32_size_z}"/>
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="0.010"/>
<inertia ixx="3.36e-6" ixy="0.0" ixz="0.0"
iyy="6.17e-7" iyz="0.0" izz="3.87e-6"/>
</inertial>
</link>
Step 2: Adding the Two-Stage rpi_base and rpi_frame Hierarchy
Next, add the 3D-printed mounting plate (rpi_base, 0.090 × 0.060 × 0.005 m, 0.020 kg) and the Raspberry Pi 5 board (rpi_frame, 0.085 × 0.056 × 0.017 m, 0.050 kg). Following the ROS 2 Jazzy URDF tutorials, compute the box inertia tensors for both links so the total upper-deck mass contribution is accurately represented in dynamics solvers:
<material name="petg_dark">
<color rgba="0.25 0.30 0.35 1.0"/>
</material>
<material name="pcb_green">
<color rgba="0.10 0.35 0.20 1.0"/>
</material>
<!-- Stage 1: 3D-printed mounting plate (rpi_base) -->
<joint name="rpi_base_joint" type="fixed">
<parent link="base_link"/>
<child link="rpi_base"/>
<origin xyz="0.010 0 0.0275" rpy="0 0 0"/>
</joint>
<link name="rpi_base">
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="0.090 0.060 0.005"/>
</geometry>
<material name="petg_dark"/>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="0.090 0.060 0.005"/>
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="0.020"/>
<inertia ixx="6.04e-6" ixy="0.0" ixz="0.0"
iyy="1.35e-5" iyz="0.0" izz="1.95e-5"/>
</inertial>
</link>
<!-- Stage 2: Raspberry Pi 5 PCB and cooler envelope (rpi_frame) -->
<joint name="rpi_joint" type="fixed">
<parent link="rpi_base"/>
<child link="rpi_frame"/>
<origin xyz="0 0 0.014" rpy="0 0 0"/>
</joint>
<link name="rpi_frame">
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="0.085 0.056 0.017"/>
</geometry>
<material name="pcb_green"/>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="0.085 0.056 0.017"/>
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="0.050"/>
<inertia ixx="1.427e-5" ixy="0.0" ixz="0.0"
iyy="3.131e-5" iyz="0.0" izz="4.317e-5"/>
</inertial>
</link>
Inspecting the TF Tree Depth and Verifying Collision Clearance
With the compute and MCU boards mounted, the kinematic tree of myros_sketch remains shallow and well-organized:
base_footprint (z = 0.000 m, Ground plane root)
└── base_link (z = 0.0325 m, Wheel axle center)
├── chassis (0, 0, 0)
├── wheel_left_link (0, +0.080, 0)
├── wheel_right_link (0, -0.080, 0)
├── caster_link (+0.075, 0, -0.020)
├── esp32s3_frame (-0.060, 0, +0.029)
└── rpi_base (+0.010, 0, +0.0275)
└── rpi_frame (0, 0, +0.014 -> cumulative +0.010, 0, +0.0415 from base_link)
Keeping the maximum tree depth at four levels or fewer prevents deep chain multiplication errors and makes intermediate offsets easy to audit. Launch the display script and verify the cumulative transforms with tf2_echo and view_frames:
ros2 launch myros_sketch display.launch.py
# In a second terminal, query the cumulative static transforms
ros2 run tf2_ros tf2_echo base_link esp32s3_frame
# Expected Translation: [-0.060, 0.000, 0.029]
ros2 run tf2_ros tf2_echo base_link rpi_frame
# Expected Translation: [0.010, 0.000, 0.042] (exact sum: 0.0415 m)
ros2 run tf2_ros tf2_echo base_footprint rpi_frame
# Expected Translation: [0.010, 0.000, 0.074] (0.0325 + 0.0415 = 0.0740 m)
ros2 run tf2_tools view_frames
| Target Frame | Expected (x, y, z) from base_link | Elevation z Above base_footprint | Mechanical & Simulation Verification Check |
|---|---|---|---|
esp32s3_frame | (-0.060, 0.000, 0.0290) | 0.0615 m | Confirm USB-C cable clearance and keep PCB antenna clear of metal plates |
rpi_base | (0.010, 0.000, 0.0275) | 0.0600 m | Verify bottom face rests flush on the z = 0.025 m chassis top deck |
rpi_frame | (0.010, 0.000, 0.0415) | 0.0740 m | Toggle Collision Enabled in RViz2 to confirm the 3 mm standoff gap above rpi_base |
Practical Layout Considerations for Onboard Compute Boards
When finalizing the X-Y placement of esp32s3_frame and rpi_frame on a compact 200 × 150 mm chassis deck, physical hardware constraints directly influence the coordinate values entered into the URDF:
- RF antenna clearance: The PCB trace antenna on the ESP32-S3 module radiates best when positioned at the rear edge of the chassis away from thick aluminum brackets and the Raspberry Pi 5 heatsink. Placing
esp32s3_frameatx = -0.060 mkeeps the antenna clear of upper-deck metal standoffs. - Cable bend radius and connector envelopes: USB-C power cables, micro-HDMI leads, and GPIO ribbon cables require 15–25 mm of physical clearance beyond the bare PCB footprint. Expanding the
<collision>box slightly or leaving a 15 mm buffer betweenesp32s3_frame(x = -0.060 m) andrpi_base(x = +0.010 m) prevents cable pinching during assembly. - Thermal headroom under upper sensor decks: Under sustained SLAM and perception workloads, a Raspberry Pi 5 requires an active cooler, raising its total height to roughly 17 mm. Encoding
0.017 min therpi_framebox geometry ensures that any LiDAR tower placed above the SBC in the next stage will clear the fan intake. - Center of mass balance across the support triangle: Shifting heavy compute boards or batteries too far backward can move the combined center of mass behind the drive axle (
x < 0), causing the robot to tip backward onto its rear edge when accelerating. Keepingrpi_frameslightly forward of the axle (x = +0.010 m) maintains positive downward load on the front caster atx = +0.075 m.
In RViz2, expand the RobotModel display properties and enable Collision Enabled alongside Visual Enabled. Confirm that esp32s3_frame and rpi_base sit cleanly on the chassis deck without overlapping and that rpi_frame floats 3 mm above rpi_base. With the compute and MCU coordinate frames established, continue to Designing LiDAR and IMU Sensor Frames in URDF: laser_frame and imu_link to mount the 2D laser scanner origin and inertial measurement frame.