Skip to content

RSDSO-21561: Add D421 URDF model and mesh to realsense2_description - #3534

Merged
Nir-Az merged 5 commits into
realsenseai:ros2-developmentfrom
Nir-Az:add-d421-description
Jul 8, 2026
Merged

Nir-Az merged 5 commits into
realsenseai:ros2-developmentfrom
Nir-Az:add-d421-description

Conversation

@Nir-Az

@Nir-Az Nir-Az commented Jul 1, 2026 •

Copy link
Copy Markdown
Collaborator

Overview: Adds a URDF model and visual mesh for the RealSense Depth Module D421 to realsense2_description, so the D421 can be visualized/simulated in ROS 2 like the other D4xx devices.

Jira: RSDSO-21561

Changes

  • urdf/_d421.urdf.xacro — stand-alone sensor_d421 macro. The D421 is a bare single-board module (no enclosure, no cover glass, no tripod/bottom screw), so it does not reuse the cased-camera terms. Dual IR imagers + IR projector, no RGB/IMU; 50 mm baseline; dimensions 95 × 32 × 10.18 mm; mass 0.0375 kg.
  • urdf/test_d421_camera.urdf.xacro — standalone test wrapper (auto-discovered by view_model.launch.py).
  • meshes/d421.stl — visual mesh of the flat board (two imagers + projector).

No CMakeLists.txt/launch changes needed — urdf/ and meshes/ are glob-installed and the view launcher auto-lists any test_*.urdf.xacro.

Frames

  • camera_mount_frame — model origin, the centre of the back panel (back surface). A module is fastened flat against the user's rig, so this is the natural, physically-locatable attachment point.
  • camera_link — camera_link/depth origin at the centre of the left (infra1) imager on the front face, derived from the mount frame (forward by the board thickness, left by half the baseline). The ROS driver anchors its TF tree here, so it must stay on the left imager.
  • infra2 sits one 50 mm baseline to the right.

Data source: D421 Datasheet v1.1 + Leopard LI-DS5-OV9281 mechanical drawing.

Validation (ROS 2 Humble)

xacro processes the model cleanly (exit 0), and it loads and renders in rviz2 with camera_mount_frame as the fixed frame. Frame tree confirmed: camera_mount_frame → camera_link [0.01018, 0.025, 0] → {depth, infra1 @ 0, infra2 @ -0.050}.

Note: the mesh is a simplified board representation, to be replaced with a detailed CAD/STEP export when available. Board thickness is 10.18 mm from the mechanical drawing (the datasheet's two tables list 10.2 and 10.5 mm).

Render (rviz2)

D421 model in rviz2 — grey board with the two IR imagers and USB-C plug, TF axes with the origin at the back-panel centre:

D421 in rviz2

🤖 Generated by AI

@Nir-Az
Nir-Az requested a review from Gilaadb July 1, 2026 08:47

@Gilaadb Gilaadb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URDF followed D455/D435 family of cameras too stricktly. It describes sizes that don't physically exist in this module. For example, there is no bottom screw. it makes no sense to expect a user to use a non existing bottom screw as the attachment point of the camera's URDF to their rig/robot design. My suggestion is to rewrite this file as a stand-alone and not copy unrelated terms from other cased cameras.
To me, it makes most sense to define the origin as the center of the back plate, on he back surface of it. A user can easily derive it from where they attach the camera to their rig/robot.

@Nir-Az

Nir-Az commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

Rewrote _d421.urdf.xacro stand-alone, dropping the cased-camera terms that don't exist on this module (cover glass, bottom-screw / mount-from-centre offsets, bottom_screw_frame).

As suggested, the model origin is now the centre of the back panel (camera_mount_frame) - the flat surface a user actually mounts against. camera_link (the left-imager depth origin, where the ROS driver anchors the TF tree) is derived from it: forward by the board thickness and left by half the 50 mm baseline. Only physically-real values remain (95 x 32 x 10.2 mm, 50 mm baseline).

Validated on a Linux box with ROS 2 Humble: xacro processes cleanly and the model renders in rviz2 (see updated PR description). Please see the per-comment replies above; one open question on the exact board thickness.

@Nir-Az
Nir-Az requested a review from Gilaadb July 2, 2026 08:32
<xacro:if value="$(arg add_plug)">
<!-- USB-C connector on the bottom edge, board-centred -->
<xacro:usb_plug parent="${name}_link" name="${name}_usb_plug">
<origin xyz="${-d421_cam_depth/2} ${-d421_baseline/2} ${-d421_cam_height/2}" rpy="${M_PI/2} 0 0"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know if anyone cares, but this is not the location of the usb connector. it is not in the middle of the camera.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. The plug was board-centred as a placeholder and only rendered when add_plug:=true (off by default). Rather than ship a wrong location, I removed the usb_plug block entirely (also dropped the now-unused add_plug arg and _usb_plug include).

✅ Fixed in 66f4938.

🤖 Generated by AI

<!-- camera_link at the depth origin (left imager, front face): forward from
the back-panel centre by the board thickness, and left by half the baseline -->
<joint name="${name}_link_joint" type="fixed">
<origin xyz="${d421_cam_depth} ${d421_baseline/2} 0" rpy="0 0 0"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the x value, we need to accommodate the offset of the Z=0 origin.
We need to substract z' value specific for this module. I'm working on finding it out.
Image

@Nir-Az Nir-Az Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — camera_link should sit at the imager plane, not the front face, so x = d421_cam_depth - z'. Right now it uses the full board thickness (front face). Once you have z' for this module I will update the ${name}_link_joint origin (and the mesh offset if needed) to match. Ping me with the value.

⏸ Deferred — waiting on the module-specific z' offset.

🤖 Generated by AI

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What i've been told is that since D421 module doesn't have a stiffener then z' = 0.
It means the current calculation is accurate.

@Gilaadb Gilaadb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Nir-Az
Nir-Az merged commit 21517b1 into realsenseai:ros2-development Jul 8, 2026
9 checks passed
@Nir-Az
Nir-Az deleted the add-d421-description branch July 9, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants