Skip to content

Commit

Permalink
Make IMU dimension specific
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan4253 committed Jan 26, 2025
1 parent 80e4862 commit dd941d5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
16 changes: 6 additions & 10 deletions common_xacro/urdf/sensor/imu.xacro
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<?xml version="1.0"?>

<!-- Brief: Standard IMU -->
<!-- Brief: IMU -->
<!-- Shape, Collision, Inertia: Box with relevant collision and constant inertia -->
<!-- Mounting Location: Bottom center of the IMU -->
<!-- Joint Type: fixed -->
<!-- Plugin: libgazebo_ros_imu_sensor.so -->
<!-- Param name: the name of the IMU. Published topic is /{name}_controller/out -->
<!-- Param mass: mass of the IMU -->
<!-- Param length: length of the IMU -->
<!-- Param width: width of the IMU -->
<!-- Param height: height of the IMU -->
<!-- Param parent: name of the parent link, defaulted to base_link -->
<!-- Param joint_origin: location of the IMU relative to parent link -->
<robot xmlns:xacro="http://ros.org/wiki/xacro" name="caster">
<xacro:macro name="imu" params="name mass length width height parent:=base_link *joint_origin">
<xacro:macro name="imu" params="name parent:=base_link *joint_origin">
<!-- Includes -->
<xacro:include filename="$(find common_xacro)/urdf/physics/inertia.xacro"/>

Expand All @@ -30,27 +26,27 @@

<!-- Imu link -->
<link name="${name}_link">
<xacro:box_inertia mass="${mass}" length="${length}" width="${width}" height="${height}">
<xacro:box_inertia mass="0.025" length="0.05" width="0.03" height="0.01">
<origin xyz="0 0 0" rpy="0 0 0" />
</xacro:box_inertia>

<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="${length} ${width} ${height}"/>
<box size="0.05 0.03 0.01"/>
</geometry>
</visual>

<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="${length} ${width} ${height}"/>
<box size="0.05 0.03 0.01"/>
</geometry>
</collision>
</link>

<joint name="${name}_joint" type="fixed">
<origin xyz="0 0 ${height/2}" rpy="0 0 0"/>
<origin xyz="0 0 0.005" rpy="0 0 0"/>
<parent link="${name}_base_link" />
<child link="${name}_link" />
</joint>
Expand Down
17 changes: 7 additions & 10 deletions marvin_simulation/urdf/constants.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,27 @@

<!-- Caster Constants -->
<xacro:property name="caster_x_offset" value="${-24.625*0.0254}" />

<xacro:property name="caster_radius" value="${3.5*0.0254}" />
<xacro:property name="caster_mass" value="0.1" />

<!-- Wheel Constants -->
<xacro:property name="track_width" value="${31*0.0254}" />

<xacro:property name="wheel_radius" value="${6.1875*0.0254}" />
<xacro:property name="wheel_width" value="${4*0.0254}" />
<xacro:property name="wheel_mass" value="5" />
<xacro:property name="track_width" value="${31*0.0254}" />

<!-- Lidar Constants -->
<xacro:property name="lidar_height" value="${32.55*0.0254}"/>

<!-- Camera Constants -->
<xacro:property name="camera_x_offset" value="${(4+2.66916)*0.0254}"/>
<xacro:property name="camera_z_offset" value="${(31-1.80395)*0.0254}"/>
<xacro:property name="camera_angle" value="${10 * 0.01745327777}"/>

<xacro:property name="camera_mass" value="0.230"/>
<xacro:property name="camera_length" value="0.04310"/>
<xacro:property name="camera_width" value="0.17525"/>
<xacro:property name="camera_height" value="0.03025"/>
<xacro:property name="camera_angle" value="${10 * 0.01745327777}"/>
<xacro:property name="camera_x_offset" value="${(4+2.66916)*0.0254}"/>
<xacro:property name="camera_z_offset" value="${(31-1.80395)*0.0254}"/>

<!-- IMU Constants -->
<xacro:property name="imu_mass" value="0.025"/>
<xacro:property name="imu_length" value="0.05"/>
<xacro:property name="imu_width" value="0.03"/>
<xacro:property name="imu_height" value="0.01"/>
</robot>
2 changes: 1 addition & 1 deletion marvin_simulation/urdf/marvin.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

<!-- IMU -->
<xacro:include filename="$(find common_xacro)/urdf/sensor/imu.xacro" />
<xacro:imu name="imu" mass="${imu_mass}" length="${imu_length}" width="${imu_width}" height="${imu_height}">
<xacro:imu name="imu">
<origin xyz="${-chassis_tower_length / 2 - chassis_electrical_length/2} 0 ${chassis_electrical_height}" rpy="0 0 0" />
</xacro:imu>

Expand Down

0 comments on commit dd941d5

Please sign in to comment.