Created
April 2, 2024 20:45
-
-
Save soumya997/f1fc8d627e28f1d0dd2fda1d55c6bfae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <robot name="sam_bot" | |
| xmlns:xacro="http://ros.org/wiki/xacro"> | |
| <!-- Define robot constants --> | |
| <xacro:property name="base_width" value="0.31"/> | |
| <xacro:property name="base_length" value="0.42"/> | |
| <xacro:property name="base_height" value="0.18"/> | |
| <xacro:property name="wheel_radius" value="0.10"/> | |
| <xacro:property name="wheel_width" value="0.04"/> | |
| <xacro:property name="wheel_ygap" value="0.025"/> | |
| <xacro:property name="wheel_zoff" value="0.05"/> | |
| <xacro:property name="wheel_xoff" value="0.12"/> | |
| <xacro:property name="caster_xoff" value="0.14"/> | |
| <!-- Define some commonly used intertial properties --> | |
| <xacro:macro name="box_inertia" params="m w h d"> | |
| <inertial> | |
| <origin xyz="0 0 0" rpy="${pi/2} 0 ${pi/2}"/> | |
| <mass value="${m}"/> | |
| <inertia ixx="${(m/12) * (h*h + d*d)}" ixy="0.0" ixz="0.0" iyy="${(m/12) * (w*w + d*d)}" iyz="0.0" izz="${(m/12) * (w*w + h*h)}"/> | |
| </inertial> | |
| </xacro:macro> | |
| <xacro:macro name="cylinder_inertia" params="m r h"> | |
| <inertial> | |
| <origin xyz="0 0 0" rpy="${pi/2} 0 0" /> | |
| <mass value="${m}"/> | |
| <inertia ixx="${(m/12) * (3*r*r + h*h)}" ixy = "0" ixz = "0" iyy="${(m/12) * (3*r*r + h*h)}" iyz = "0" izz="${(m/2) * (r*r)}"/> | |
| </inertial> | |
| </xacro:macro> | |
| <xacro:macro name="sphere_inertia" params="m r"> | |
| <inertial> | |
| <mass value="${m}"/> | |
| <inertia ixx="${(2/5) * m * (r*r)}" ixy="0.0" ixz="0.0" iyy="${(2/5) * m * (r*r)}" iyz="0.0" izz="${(2/5) * m * (r*r)}"/> | |
| </inertial> | |
| </xacro:macro> | |
| <!-- Robot Base --> | |
| <link name="base_link"> | |
| <visual> | |
| <geometry> | |
| <box size="${base_length} ${base_width} ${base_height}"/> | |
| </geometry> | |
| <material name="DarkBlue"> | |
| <color rgba="0.09 0.30 0.46 1.0"/> | |
| </material> | |
| </visual> | |
| <collision> | |
| <geometry> | |
| <box size="${base_length} ${base_width} ${base_height}"/> | |
| </geometry> | |
| </collision> | |
| <xacro:box_inertia m="1" w="${base_width}" d="${base_length}" h="${base_height}"/> | |
| </link> | |
| <!-- Robot Footprint --> | |
| <link name="base_footprint"> | |
| <xacro:box_inertia m="0" w="0" d="0" h="0"/> | |
| </link> | |
| <joint name="base_joint" type="fixed"> | |
| <parent link="base_link"/> | |
| <child link="base_footprint"/> | |
| <origin xyz="0.0 0.0 ${-(wheel_radius+wheel_zoff)}" rpy="0 0 0"/> | |
| </joint> | |
| <!-- Wheels --> | |
| <xacro:macro name="wheel" params="prefix x_reflect y_reflect"> | |
| <link name="${prefix}_link"> | |
| <visual> | |
| <origin xyz="0 0 0" rpy="${pi/2} 0 0"/> | |
| <geometry> | |
| <cylinder radius="${wheel_radius}" length="${wheel_width}"/> | |
| </geometry> | |
| <material name="LightBlue"> | |
| <color rgba="0.11 0.37 0.56 1.0"/> | |
| </material> | |
| </visual> | |
| <collision> | |
| <origin xyz="0 0 0" rpy="${pi/2} 0 0"/> | |
| <geometry> | |
| <cylinder radius="${wheel_radius}" length="${wheel_width}"/> | |
| </geometry> | |
| </collision> | |
| <xacro:cylinder_inertia m="2.5" r="${wheel_radius}" h="${wheel_width}"/> | |
| </link> | |
| <joint name="${prefix}_joint" type="continuous"> | |
| <parent link="base_link"/> | |
| <child link="${prefix}_link"/> | |
| <origin xyz="${x_reflect*wheel_xoff} ${y_reflect*(base_width/2+wheel_ygap)} ${-wheel_zoff}" rpy="0 0 0"/> | |
| <axis xyz="0 1 0"/> | |
| <dynamics damping="0.2"/> | |
| </joint> | |
| </xacro:macro> | |
| <xacro:wheel prefix="drivewhl_l" x_reflect="-1" y_reflect="1" /> | |
| <xacro:wheel prefix="drivewhl_r" x_reflect="-1" y_reflect="-1" /> | |
| <link name="front_caster"> | |
| <visual> | |
| <geometry> | |
| <sphere radius="${(wheel_radius+wheel_zoff-(base_height/2))}"/> | |
| </geometry> | |
| <material name="DarkBlue"> | |
| <color rgba="0.09 0.30 0.46 1.0"/> | |
| </material> | |
| </visual> | |
| <collision> | |
| <origin xyz="0 0 0" rpy="0 0 0"/> | |
| <geometry> | |
| <sphere radius="${(wheel_radius+wheel_zoff-(base_height/2))}"/> | |
| </geometry> | |
| </collision> | |
| <xacro:sphere_inertia m="0.005" r="${(wheel_radius+wheel_zoff-(base_height/2))}"/> | |
| </link> | |
| <joint name="caster_joint" type="fixed"> | |
| <parent link="base_link"/> | |
| <child link="front_caster"/> | |
| <origin xyz="${caster_xoff} 0.0 ${-(base_height/2)}" rpy="0 0 0"/> | |
| </joint> | |
| <link name="imu_link"> | |
| <visual> | |
| <geometry> | |
| <box size="0.1 0.1 0.1"/> | |
| </geometry> | |
| </visual> | |
| <collision> | |
| <geometry> | |
| <box size="0.1 0.1 0.1"/> | |
| </geometry> | |
| </collision> | |
| <xacro:box_inertia m="0.001" w="0.1" d="0.1" h="0.1"/> | |
| </link> | |
| <gazebo reference="imu_link"> | |
| <sensor name="imu_sensor" type="imu"> | |
| <ignition_frame_id>imu_link</ignition_frame_id> | |
| <plugin filename="ignition-gazebo-imu-system" name="ignition::gazebo::systems::Imu"> | |
| </plugin> | |
| <topic>imu</topic> | |
| <always_on>true</always_on> | |
| <update_rate>100</update_rate> | |
| <visualize>true</visualize> | |
| <imu> | |
| <angular_velocity> | |
| <x> | |
| <noise type="gaussian"> | |
| <mean>0.0</mean> | |
| <stddev>2e-4</stddev> | |
| <bias_mean>0.0000075</bias_mean> | |
| <bias_stddev>0.0000008</bias_stddev> | |
| </noise> | |
| </x> | |
| <y> | |
| <noise type="gaussian"> | |
| <mean>0.0</mean> | |
| <stddev>2e-4</stddev> | |
| <bias_mean>0.0000075</bias_mean> | |
| <bias_stddev>0.0000008</bias_stddev> | |
| </noise> | |
| </y> | |
| <z> | |
| <noise type="gaussian"> | |
| <mean>0.0</mean> | |
| <stddev>2e-4</stddev> | |
| <bias_mean>0.0000075</bias_mean> | |
| <bias_stddev>0.0000008</bias_stddev> | |
| </noise> | |
| </z> | |
| </angular_velocity> | |
| <linear_acceleration> | |
| <x> | |
| <noise type="gaussian"> | |
| <mean>0.0</mean> | |
| <stddev>1.7e-2</stddev> | |
| <bias_mean>0.1</bias_mean> | |
| <bias_stddev>0.001</bias_stddev> | |
| </noise> | |
| </x> | |
| <y> | |
| <noise type="gaussian"> | |
| <mean>0.0</mean> | |
| <stddev>1.7e-2</stddev> | |
| <bias_mean>0.1</bias_mean> | |
| <bias_stddev>0.001</bias_stddev> | |
| </noise> | |
| </y> | |
| <z> | |
| <noise type="gaussian"> | |
| <mean>0.0</mean> | |
| <stddev>1.7e-2</stddev> | |
| <bias_mean>0.1</bias_mean> | |
| <bias_stddev>0.001</bias_stddev> | |
| </noise> | |
| </z> | |
| </linear_acceleration> | |
| </imu> | |
| </sensor> | |
| </gazebo> | |
| <joint name="imu_joint" type="fixed"> | |
| <parent link="base_link"/> | |
| <child link="imu_link"/> | |
| <origin xyz="0 0 0.01"/> | |
| </joint> | |
| <ros2_control name="IgnitionSystem" type="system"> | |
| <hardware> | |
| <plugin>ign_ros2_control/IgnitionSystem</plugin> | |
| </hardware> | |
| <joint name="drivewhl_l_joint"> | |
| <command_interface name="velocity"> | |
| <param name="min">-1</param> | |
| <param name="max">1</param> | |
| </command_interface> | |
| <state_interface name="position"/> | |
| <state_interface name="velocity"/> | |
| </joint> | |
| <joint name="drivewhl_r_joint"> | |
| <command_interface name="velocity"> | |
| <param name="min">-1</param> | |
| <param name="max">1</param> | |
| </command_interface> | |
| <state_interface name="position"/> | |
| <state_interface name="velocity"/> | |
| </joint> | |
| </ros2_control> | |
| <gazebo> | |
| <plugin filename="ign_ros2_control-system" name="ign_ros2_control::IgnitionROS2ControlPlugin"> | |
| <parameters>$(find sam_bot_nav2_gz)/config/diff_drive_controller_velocity.yaml</parameters> | |
| </plugin> | |
| </gazebo> | |
| <link name="lidar_link"> | |
| <inertial> | |
| <origin xyz="0 0 0" rpy="0 0 0"/> | |
| <mass value="0.125"/> | |
| <inertia ixx="0.001" ixy="0" ixz="0" iyy="0.001" iyz="0" izz="0.001" /> | |
| </inertial> | |
| <collision> | |
| <origin xyz="0 0 0" rpy="0 0 0"/> | |
| <geometry> | |
| <cylinder radius="0.0508" length="0.055"/> | |
| </geometry> | |
| </collision> | |
| <visual> | |
| <origin xyz="0 0 0" rpy="0 0 0"/> | |
| <geometry> | |
| <cylinder radius="0.0508" length="0.055"/> | |
| </geometry> | |
| <material name="LightBlue"> | |
| <color rgba="0.11 0.37 0.56 1.0"/> | |
| </material> | |
| </visual> | |
| </link> | |
| <joint name="lidar_joint" type="fixed"> | |
| <parent link="base_link"/> | |
| <child link="lidar_link"/> | |
| <origin xyz="0 0 0.12" rpy="0 0 0"/> | |
| </joint> | |
| <gazebo reference="lidar_link"> | |
| <sensor name="lidar" type="gpu_lidar"> | |
| <ignition_frame_id>lidar_link</ignition_frame_id> | |
| <topic>scan</topic> | |
| <always_on>true</always_on> | |
| <visualize>true</visualize> | |
| <update_rate>5</update_rate> | |
| <ray> | |
| <scan> | |
| <horizontal> | |
| <samples>360</samples> | |
| <resolution>1.000000</resolution> | |
| <min_angle>0.000000</min_angle> | |
| <max_angle>6.280000</max_angle> | |
| </horizontal> | |
| </scan> | |
| <range> | |
| <min>0.120000</min> | |
| <max>3.5</max> | |
| <resolution>0.015000</resolution> | |
| </range> | |
| <noise> | |
| <type>gaussian</type> | |
| <mean>0.0</mean> | |
| <stddev>0.01</stddev> | |
| </noise> | |
| </ray> | |
| </sensor> | |
| </gazebo> | |
| <link name="camera_link"> | |
| <visual> | |
| <origin xyz="0 0 0" rpy="0 0 0"/> | |
| <geometry> | |
| <box size="0.015 0.130 0.022"/> | |
| </geometry> | |
| <material name="LightBlue"> | |
| <color rgba="0.11 0.37 0.56 1.0"/> | |
| </material> | |
| </visual> | |
| <collision> | |
| <origin xyz="0 0 0" rpy="0 0 0"/> | |
| <geometry> | |
| <box size="0.015 0.130 0.022"/> | |
| </geometry> | |
| </collision> | |
| <inertial> | |
| <origin xyz="0 0 0" rpy="0 0 0"/> | |
| <mass value="0.035"/> | |
| <inertia ixx="0.001" ixy="0" ixz="0" iyy="0.001" iyz="0" izz="0.001" /> | |
| </inertial> | |
| </link> | |
| <joint name="camera_joint" type="fixed"> | |
| <parent link="base_link"/> | |
| <child link="camera_link"/> | |
| <origin xyz="0.215 0 0.05" rpy="0 0 0"/> | |
| </joint> | |
| <link name="camera_frame"/> | |
| <joint name="camera_frame_joint" type="fixed"> | |
| <origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}"/> | |
| <parent link="camera_link"/> | |
| <child link="camera_frame"/> | |
| </joint> | |
| <gazebo reference="camera_link"> | |
| <sensor name="robot_cam" type="camera"> | |
| <camera> | |
| <horizontal_fov>1.047</horizontal_fov> | |
| <image> | |
| <width>320</width> | |
| <height>240</height> | |
| </image> | |
| <clip> | |
| <near>0.1</near> | |
| <far>100</far> | |
| </clip> | |
| </camera> | |
| <always_on>1</always_on> | |
| <update_rate>30</update_rate> | |
| <visualize>true</visualize> | |
| <topic>robot_cam</topic> | |
| <enable_metrics>true</enable_metrics> | |
| </sensor> | |
| </gazebo> | |
| </robot> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment