Refactor the URDF into multiple parts.

Makes it easier to work on an individual part in isolation.
Also change the vscode devconsole visualiser to one that works with includes
This commit is contained in:
2026-05-07 20:41:18 +00:00
parent 68305b3848
commit 54ed5c6a82
11 changed files with 587 additions and 122 deletions
+58
View File
@@ -0,0 +1,58 @@
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- ─────────────────────────────────────────────────────────────────────
HC-SR04 ultrasonic range sensor
frame_id "ultrasonic" matches what ultrasonic_node publishes on
/ultrasonic/range. Mounted on the front face of the chassis,
pointing forward.
───────────────────────────────────────────────────────────────────── -->
<link name="ultrasonic">
<visual>
<geometry><box size="0.02 0.04 0.02"/></geometry>
<material name="light_grey"/>
</visual>
<collision>
<geometry><box size="0.02 0.04 0.02"/></geometry>
</collision>
<inertial>
<mass value="0.01"/>
<inertia ixx="0.000001" ixy="0" ixz="0"
iyy="0.000001" iyz="0" izz="0.000001"/>
</inertial>
</link>
<joint name="ultrasonic_joint" type="fixed">
<parent link="base_link"/>
<child link="ultrasonic"/>
<!-- Front-centre of the chassis, mid-height -->
<origin xyz="${base_length/2 + 0.01} 0.0 0.0" rpy="0 0 0"/>
</joint>
<!-- ─────────────────────────────────────────────────────────────────────
Gazebo sonar sensor (Gazebo Harmonic / gz-sim)
Simulated as a narrow-cone ray sensor. Data is published on gz topic
/ultrasonic/range and bridged to ROS 2 via ros_gz_bridge:
/ultrasonic/range (gz) → /ultrasonic/range (ROS 2, sensor_msgs/Range)
───────────────────────────────────────────────────────────────────── -->
<gazebo reference="ultrasonic">
<sensor name="sonar" type="sonar">
<always_on>1</always_on>
<update_rate>10</update_rate>
<visualize>true</visualize>
<topic>/ultrasonic/range</topic>
<gz_frame_id>ultrasonic</gz_frame_id>
<sonar>
<!-- HC-SR04 datasheet values -->
<min>${sonar_min_range}</min>
<max>${sonar_max_range}</max>
<!-- Half-angle of the cone in radians (~15° full FOV → 0.13 rad half-angle) -->
<radius>0.13</radius>
</sonar>
</sensor>
</gazebo>
</robot>