Skip to content

Commit be569a6

Browse files
authored
Backport Fix: Ouster URDF Parameters (#266)
* Add base parameter to Ouster URDF * Add base and cap to Ouster description generator
1 parent 4c9fefe commit be569a6

File tree

2 files changed

+49
-32
lines changed

2 files changed

+49
-32
lines changed

clearpath_generator_common/clearpath_generator_common/description/sensors.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,19 @@ def __init__(self, sensor: BaseLidar3D) -> None:
133133
class OusterOS1Description(Lidar3dDescription):
134134
SAMPLES_HORIZONTAL = 'samples_h'
135135
SAMPLES_VERTICAL = 'samples_v'
136+
BASE_TYPE = 'base'
137+
CAP_TYPE = 'cap'
136138

137-
def __init__(self, sensor: BaseLidar3D) -> None:
139+
def __init__(self, sensor: OusterOS1) -> None:
138140
super().__init__(sensor)
139141

140142
del self.parameters[self.ANGULAR_RESOLUTION_H]
141143
del self.parameters[self.ANGULAR_RESOLUTION_V]
142144
self.parameters.update({
143145
self.SAMPLES_HORIZONTAL: 1024,
144-
self.SAMPLES_VERTICAL: 64
146+
self.SAMPLES_VERTICAL: 64,
147+
self.BASE_TYPE: sensor.base_type,
148+
self.CAP_TYPE: sensor.cap_type,
145149
})
146150

147151
class ImuDescription(BaseDescription):

clearpath_sensors_description/urdf/ouster_os1.urdf.xacro

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
name
2222
parent_link
2323
cap:=halo
24+
base:=base
2425
*origin
2526
samples_h:=1024 min_ang_h:=${-pi} max_ang_h:=${pi}
2627
samples_v:=64 min_ang_v:=${-21.2 * pi/180} max_ang_v:=${21.2 * pi/180}
@@ -32,9 +33,16 @@
3233
<xacro:property name="lidar_height" value="0.05835"/>
3334
<xacro:property name="lidar_diameter" value="0.087"/>
3435

35-
<xacro:property name="base_mass" value="0."/>
36-
<xacro:property name="base_height" value="0.0225"/>
37-
<xacro:property name="base_length" value="0.110"/>
36+
<xacro:if value="${base == 'base'}">
37+
<xacro:property name="base_mass" value="0.0"/>
38+
<xacro:property name="base_height" value="0.0225"/>
39+
<xacro:property name="base_length" value="0.110"/>
40+
</xacro:if>
41+
<xacro:unless value="${base == 'base'}">
42+
<xacro:property name="base_mass" value="0.0"/>
43+
<xacro:property name="base_height" value="0.0"/>
44+
<xacro:property name="base_length" value="0.0"/>
45+
</xacro:unless>
3846

3947
<xacro:property name="fins_mass" value="0.079"/>
4048
<xacro:property name="fins_height" value="0.022"/>
@@ -46,33 +54,38 @@
4654

4755

4856
<!-- Base Link -->
49-
<link name="${name}_base_link">
50-
<inertial>
51-
<mass value="${base_mass}"/>
52-
<origin xyz="0 0 ${base_height/2}"/>
53-
<xacro:ouster_box_inertia
54-
mass="${base_mass}"
55-
x="${base_length}"
56-
y="${base_length}"
57-
z="${base_height}"
58-
/>
59-
</inertial>
60-
<visual>
61-
<material name="ouster_grey">
62-
<color rgba="0.8 0.8 0.8 1.0"/>
63-
</material>
64-
<origin xyz="0 0 ${base_height}"/>
65-
<geometry>
66-
<mesh filename="package://clearpath_sensors_description/meshes/ouster/os1_base.dae"/>
67-
</geometry>
68-
</visual>
69-
<collision>
70-
<origin xyz="0 0 ${base_height/2}"/>
71-
<geometry>
72-
<box size="${base_length} ${base_length} ${base_height}"/>
73-
</geometry>
74-
</collision>
75-
</link>
57+
<xacro:if value="${base == 'base'}">
58+
<link name="${name}_base_link">
59+
<inertial>
60+
<mass value="${base_mass}"/>
61+
<origin xyz="0 0 ${base_height/2}"/>
62+
<xacro:ouster_box_inertia
63+
mass="${base_mass}"
64+
x="${base_length}"
65+
y="${base_length}"
66+
z="${base_height}"
67+
/>
68+
</inertial>
69+
<visual>
70+
<material name="ouster_grey">
71+
<color rgba="0.8 0.8 0.8 1.0"/>
72+
</material>
73+
<origin xyz="0 0 ${base_height}"/>
74+
<geometry>
75+
<mesh filename="package://clearpath_sensors_description/meshes/ouster/os1_base.dae"/>
76+
</geometry>
77+
</visual>
78+
<collision>
79+
<origin xyz="0 0 ${base_height/2}"/>
80+
<geometry>
81+
<box size="${base_length} ${base_length} ${base_height}"/>
82+
</geometry>
83+
</collision>
84+
</link>
85+
</xacro:if>
86+
<xacro:unless value="${base == 'base'}">
87+
<link name="${name}_base_link" />
88+
</xacro:unless>
7689

7790
<!-- Lidar Link -->
7891
<link name="${name}_link">

0 commit comments

Comments
 (0)