Skip to content

Instantly share code, notes, and snippets.

@rje1974
Created November 15, 2020 21:24
Show Gist options
  • Save rje1974/5ed3fe57b45722de3a683b734c538c77 to your computer and use it in GitHub Desktop.
Save rje1974/5ed3fe57b45722de3a683b734c538c77 to your computer and use it in GitHub Desktop.
Located at /root/catkin_ws/src/ros_lawn_tractor/lawn_tractor_sim/urdf/lawn_tractor.urdf.xacro
<?xml version="1.0"?>
<robot name="lawn_tractor" xmlns:xacro='http://www.ros.org/wiki/xacro'>
<!-- TODO: collision link element to be added -->
<!-- TODO: inertial link element to be added -->
<!-- define base link, center of rear axle for an ackermann vehicle -->
<link name="base_link">
<visual>
<origin xyz='0.55 0 0' rpy='0 0 ${pi}' />
<geometry>
<mesh filename="package://lawn_tractor_sim/meshes/lawn_tractor.dae" scale='1 1 1'/>
</geometry>
</visual>
</link>
<!-- define base footprint (virtual link) -->
<link name="base_footprint" />
<!-- define gps link -->
<link name="gps">
<visual>
<origin xyz='0 0 0' rpy='0 0 0' />
<geometry>
<sphere radius='0.05' />
</geometry>
<material name='red'>
<color rgba='1 0 0 0.5' />
</material>
</visual>
</link>
<!-- define camera link -->
<link name="camera">
<visual>
<origin xyz='0 0 0' rpy='0 0 0' />
<geometry>
<sphere radius='0.05' />
</geometry>
<material name='red'>
<color rgba='1 0 0 0.5' />
</material>
</visual>
</link>
<!-- xacro macro definition -->
<!-- default inertia -->
<xacro:macro name='default_inertia' params='mass x:=0 y:=0 z:=0'>
<inertial>
<origin xyz='${x} ${y} ${z}' />
<mass value='${mass}' />
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0" />
</inertial>
</xacro:macro>
<!-- define base footprint joint -->
<joint name="base_footprint_joint" type="fixed">
<parent link="base_footprint"/>
<child link="base_link"/>
<origin xyz="0 0 0.25" rpy="0 0 0" />
</joint>
<!-- define gps joint -->
<!-- define gps joint -->
<joint name="gps_joint" type="fixed">
<parent link="base_link"/>
<child link="gps"/>
<origin xyz="1.25 0 1.0" rpy="0 0 0" />
</joint>
<!-- define camera joint -->
<joint name="camera_joint" type="fixed">
<parent link="base_link"/>
<child link="camera"/>
<origin xyz="1.5 0 0.5" rpy="${-pi/2} 0 ${-pi/2}" />
</joint>
<!-- define ultrasonic sensor joint -->
<joint name="range_joint" type="fixed">
<parent link="base_link"/>
<child link="base_laser_link"/>
<origin xyz="1.5 0 0.75" rpy="0 0 0" />
</joint>
</robot>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment