Skip to content

Commit 0349ed7

Browse files
authored
Feature: Add Realsense d405 to URDF (#382)
* Add Realsense d405 to URDF * Add newline EoF
1 parent b0f6d92 commit 0349ed7

2 files changed

Lines changed: 171 additions & 1 deletion

File tree

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
<?xml version="1.0"?>
2+
3+
<!--
4+
# Copyright 2023 RealSense, Inc. All Rights Reserved.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
-->
18+
19+
<!--
20+
This is the URDF model for the RealSense 405 camera, in its
21+
aluminum peripherial evaluation case.
22+
-->
23+
24+
<robot name="sensor_d405" xmlns:xacro="http://ros.org/wiki/xacro">
25+
<!-- Includes -->
26+
<xacro:include filename="$(find realsense2_description)/urdf/_materials.urdf.xacro" />
27+
<xacro:include filename="$(find realsense2_description)/urdf/_usb_plug.urdf.xacro" />
28+
29+
<xacro:macro name="sensor_d405" params="parent *origin name:=camera use_nominal_extrinsics:=false">
30+
<xacro:arg name="add_plug" default="false" />
31+
<xacro:property name="M_PI" value="3.1415926535897931" />
32+
33+
<!-- The following values are approximate, and the camera node
34+
publishing TF values with actual calibrated camera extrinsic values -->
35+
<xacro:property name="d405_cam_depth_to_infra1_offset" value="0.0"/>
36+
<xacro:property name="d405_cam_depth_to_infra2_offset" value="-0.018"/>
37+
<xacro:property name="d405_cam_depth_to_color_offset" value="0.0"/>
38+
39+
<!-- The following values model the aluminum peripherial case for the
40+
d405 camera, with the camera joint represented by the actual
41+
peripherial camera tripod mount -->
42+
<xacro:property name="d405_cam_width" value="0.042"/>
43+
<xacro:property name="d405_cam_height" value="0.042"/>
44+
<xacro:property name="d405_cam_depth" value="0.023"/>
45+
<xacro:property name="d405_cam_mount_from_center_offset" value="0.01465"/>
46+
<!-- glass cover is 0.1 mm inwards from front aluminium plate -->
47+
<xacro:property name="d405_glass_to_front" value="0.1e-3"/>
48+
<!-- see datasheet Revision 017, Table. 4-16 page 97 -->
49+
<xacro:property name="d405_zero_depth_to_glass" value="3.7e-3"/>
50+
<!-- convenience precomputation to avoid clutter-->
51+
<xacro:property name="d405_mesh_x_offset" value="${d405_cam_mount_from_center_offset-d405_glass_to_front-d405_zero_depth_to_glass}"/>
52+
53+
<!-- The following offset is relative to the physical d405 camera peripherial
54+
camera tripod mount -->
55+
<xacro:property name="d405_cam_depth_px" value="${d405_cam_mount_from_center_offset}"/>
56+
<xacro:property name="d405_cam_depth_py" value="0.009"/>
57+
<xacro:property name="d405_cam_depth_pz" value="${d405_cam_height/2}"/>
58+
59+
<!-- camera body, with origin at bottom screw mount -->
60+
<joint name="${name}_joint" type="fixed">
61+
<xacro:insert_block name="origin" />
62+
<parent link="${parent}"/>
63+
<child link="${name}_bottom_screw_frame" />
64+
</joint>
65+
<link name="${name}_bottom_screw_frame"/>
66+
67+
<joint name="${name}_link_joint" type="fixed">
68+
<origin xyz="${d405_mesh_x_offset} ${d405_cam_depth_py} ${d405_cam_depth_pz}" rpy="0 0 0"/>
69+
<parent link="${name}_bottom_screw_frame"/>
70+
<child link="${name}_link" />
71+
</joint>
72+
73+
<link name="${name}_link">
74+
<visual>
75+
<!-- the mesh origin is at front plate in between the two infrared camera axes -->
76+
<origin xyz="${d405_zero_depth_to_glass + d405_glass_to_front} ${-d405_cam_depth_py} 0" rpy="${M_PI/2} 0 ${M_PI/2}"/>
77+
<geometry>
78+
<mesh filename="package://realsense2_description/meshes/d405.stl" scale="0.001 0.001 0.001" />
79+
</geometry>
80+
<material name="aluminum"/>
81+
</visual>
82+
<collision>
83+
<origin xyz="${d405_zero_depth_to_glass-d405_cam_depth/2} ${-d405_cam_depth_py} 0" rpy="0 0 0"/>
84+
<geometry>
85+
<box size="${d405_cam_depth} ${d405_cam_width} ${d405_cam_height}"/>
86+
</geometry>
87+
</collision>
88+
<inertial>
89+
<!-- The following are not reliable values, and should not be used for modeling -->
90+
<mass value="0.072" />
91+
<origin xyz="0 0 0" />
92+
<inertia ixx="0.003881243" ixy="0.0" ixz="0.0" iyy="0.000498940" iyz="0.0" izz="0.003879257" />
93+
</inertial>
94+
</link>
95+
96+
<!-- Use the nominal extrinsics between camera frames if the calibrated extrinsics aren't being published. e.g. running the device in simulation -->
97+
<xacro:if value="${use_nominal_extrinsics}">
98+
<!-- camera depth joints and links -->
99+
<joint name="${name}_depth_joint" type="fixed">
100+
<origin xyz="0 0 0" rpy="0 0 0"/>
101+
<parent link="${name}_link"/>
102+
<child link="${name}_depth_frame" />
103+
</joint>
104+
<link name="${name}_depth_frame"/>
105+
106+
<joint name="${name}_depth_optical_joint" type="fixed">
107+
<origin xyz="0 0 0" rpy="${-M_PI/2} 0 ${-M_PI/2}" />
108+
<parent link="${name}_depth_frame" />
109+
<child link="${name}_depth_optical_frame" />
110+
</joint>
111+
<link name="${name}_depth_optical_frame"/>
112+
113+
<!-- camera left IR joints and links -->
114+
<joint name="${name}_infra1_joint" type="fixed">
115+
<origin xyz="0 ${d405_cam_depth_to_infra1_offset} 0" rpy="0 0 0" />
116+
<parent link="${name}_link" />
117+
<child link="${name}_infra1_frame" />
118+
</joint>
119+
<link name="${name}_infra1_frame"/>
120+
121+
<joint name="${name}_infra1_optical_joint" type="fixed">
122+
<origin xyz="0 0 0" rpy="${-M_PI/2} 0 ${-M_PI/2}" />
123+
<parent link="${name}_infra1_frame" />
124+
<child link="${name}_infra1_optical_frame" />
125+
</joint>
126+
<link name="${name}_infra1_optical_frame"/>
127+
128+
<!-- camera right IR joints and links -->
129+
<joint name="${name}_infra2_joint" type="fixed">
130+
<origin xyz="0 ${d405_cam_depth_to_infra2_offset} 0" rpy="0 0 0" />
131+
<parent link="${name}_link" />
132+
<child link="${name}_infra2_frame" />
133+
</joint>
134+
<link name="${name}_infra2_frame"/>
135+
136+
<joint name="${name}_infra2_optical_joint" type="fixed">
137+
<origin xyz="0 0 0" rpy="${-M_PI/2} 0 ${-M_PI/2}" />
138+
<parent link="${name}_infra2_frame" />
139+
<child link="${name}_infra2_optical_frame" />
140+
</joint>
141+
<link name="${name}_infra2_optical_frame"/>
142+
143+
<!-- camera color joints and links -->
144+
<joint name="${name}_color_joint" type="fixed">
145+
<origin xyz="0 ${d405_cam_depth_to_color_offset} 0" rpy="0 0 0" />
146+
<parent link="${name}_link" />
147+
<child link="${name}_color_frame" />
148+
</joint>
149+
<link name="${name}_color_frame"/>
150+
151+
<joint name="${name}_color_optical_joint" type="fixed">
152+
<origin xyz="0 0 0" rpy="${-M_PI/2} 0 ${-M_PI/2}" />
153+
<parent link="${name}_color_frame" />
154+
<child link="${name}_color_optical_frame" />
155+
</joint>
156+
<link name="${name}_color_optical_frame"/>
157+
</xacro:if>
158+
159+
<xacro:if value="$(arg add_plug)">
160+
<xacro:usb_plug parent="${name}_link" name="${name}_usb_plug">
161+
<origin xyz="${-0.00153-d405_mesh_x_offset} ${d405_cam_width/2-d405_cam_depth_py} 0" rpy="${M_PI} 0 0"/>
162+
</xacro:usb_plug>
163+
</xacro:if>
164+
</xacro:macro>
165+
</robot>

clearpath_sensors_description/urdf/intel_realsense.urdf.xacro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
<robot xmlns:xacro="http://ros.org/wiki/xacro">
33
<xacro:macro name="intel_realsense" params="name parent_link model *origin
44
update_rate:=30.0 image_height:=480 image_width:=640">
5-
5+
<xacro:if value="${model == 'd405'}">
6+
<xacro:include filename="$(find clearpath_sensors_description)/urdf/intel/d405.urdf.xacro" />
7+
<xacro:sensor_d405 name="${name}" parent="${parent_link}">
8+
<xacro:insert_block name="origin" />
9+
</xacro:sensor_d405>
10+
</xacro:if>
611
<xacro:if value="${model == 'd415'}">
712
<xacro:include filename="$(find clearpath_sensors_description)/urdf/intel/d415.urdf.xacro" />
813
<xacro:sensor_d415 name="${name}" parent="${parent_link}">

0 commit comments

Comments
 (0)