Gazebo Diff Drive Plugin Drift
I am facing issue using the gazebo differential drive controller. The robot moves however it doesn't exactly move in a straight line when I issue /cmdvel x="0.05". The robot will start to drift gradually. Appreciate any help thanks. I have tried increasing the mass and also ensuring the inertia is not tilted. Also, when I check the /jointstates topic each of the wheel joint has slightly different position.
<?xml version="1.0" ?>
<robot name="alphabot" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:include filename="$(find alphabot_description)/urdf/materials.xacro" />
<xacro:include filename="$(find alphabot_description)/urdf/alphabot.trans" />
<xacro:include filename="$(find alphabot_description)/urdf/alphabot.gazebo" />
<link name="base_link">
<inertial>
<origin xyz="3.9964129120210354e-17 -1.949783532853795e-05 0.014547668321607015" rpy="0 0 0"/>
<mass value="0.2"/>
<inertia ixx="0.000125" iyy="0.000266" izz="0.000389" ixy="-0.0" iyz="-0.0" ixz="0.0"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/base_link.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="blue"/>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/base_link.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="spacer_1_1">
<inertial>
<origin xyz="-8.554354349876725e-08 -2.7824964554667986e-15 0.020056162439080906" rpy="0 0 0"/>
<mass value="0.05"/>
<inertia ixx="1e-06" iyy="1e-06" izz="0.0" ixy="-0.0" iyz="0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="-0.028948 -0.04191 -0.017048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/spacer_1_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="gold"/>
</visual>
<collision>
<origin xyz="-0.028948 -0.04191 -0.017048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/spacer_1_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="spacer_1_2">
<inertial>
<origin xyz="-8.554354354040061e-08 -2.7755575615628914e-15 0.020056162439080906" rpy="0 0 0"/>
<mass value="0.05"/>
<inertia ixx="1e-06" iyy="1e-06" izz="0.0" ixy="-0.0" iyz="0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="-0.028948 0.04191 -0.017048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/spacer_1_2.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="gold"/>
</visual>
<collision>
<origin xyz="-0.028948 0.04191 -0.017048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/spacer_1_2.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="spacer_1_3">
<inertial>
<origin xyz="8.554362094723156e-08 -2.7824964554667986e-15 0.02005616243908087" rpy="0 0 0"/>
<mass value="0.05"/>
<inertia ixx="1e-06" iyy="1e-06" izz="0.0" ixy="-0.0" iyz="0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="0.028948 0.04191 -0.017048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/spacer_1_3.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="gold"/>
</visual>
<collision>
<origin xyz="0.028948 0.04191 -0.017048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/spacer_1_3.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="spacer_1_4">
<inertial>
<origin xyz="8.554362097498713e-08 -2.7478019859472624e-15 0.02005616243908087" rpy="0 0 0"/>
<mass value="0.05"/>
<inertia ixx="1e-06" iyy="1e-06" izz="0.0" ixy="-0.0" iyz="0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="0.028948 -0.04191 -0.017048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/spacer_1_4.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="gold"/>
</visual>
<collision>
<origin xyz="0.028948 -0.04191 -0.017048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/spacer_1_4.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="ultasonic_1">
<inertial>
<origin xyz="0.033193707682986046 -9.529009860237083e-08 -0.0020378179399959465" rpy="0 0 0"/>
<mass value="0.02930398813229992"/>
<inertia ixx="6e-06" iyy="1e-06" izz="5e-06" ixy="-0.0" iyz="0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="-0.0 -0.0 -0.029095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/ultasonic_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="blue_2"/>
</visual>
<collision>
<origin xyz="-0.0 -0.0 -0.029095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/ultasonic_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="AA_1">
<inertial>
<origin xyz="1.7694179454963432e-16 -0.024725409875466925 -3.3167839298339774e-07" rpy="0 0 0"/>
<mass value="0.2"/>
<inertia ixx="1.3e-05" iyy="2e-06" izz="1.3e-05" ixy="0.0" iyz="-0.0" ixz="0.0"/>
</inertial>
<visual>
<origin xyz="0.02225 -0.026 -0.026048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/AA_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="white"/>
</visual>
<collision>
<origin xyz="0.02225 -0.026 -0.026048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/AA_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="AA_2">
<inertial>
<origin xyz="2.0816681711721685e-16 0.024725409875466935 -3.3167839298339774e-07" rpy="0 0 0"/>
<mass value="0.2"/>
<inertia ixx="1.3e-05" iyy="2e-06" izz="1.3e-05" ixy="-0.0" iyz="-0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="0.03775 0.026 -0.026048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/AA_2.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="white"/>
</visual>
<collision>
<origin xyz="0.03775 0.026 -0.026048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/AA_2.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="battery_case_1">
<inertial>
<origin xyz="-0.030001214328793938 -3.4027627677573753e-05 -0.008341128938452552" rpy="0 0 0"/>
<mass value="0.06781923232527433"/>
<inertia ixx="2.2e-05" iyy="8e-06" izz="2.8e-05" ixy="-0.0" iyz="0.0" ixz="0.0"/>
</inertial>
<visual>
<origin xyz="-0.0 -0.0 -0.029095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/battery_case_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="black"/>
</visual>
<collision>
<origin xyz="-0.0 -0.0 -0.029095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/battery_case_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="motor_1">
<inertial>
<origin xyz="-5.612031395152428e-11 -0.024604091884807677 -0.007047331744742258" rpy="0 0 0"/>
<mass value="0.05"/>
<inertia ixx="0.0" iyy="0.0" izz="0.0" ixy="-0.0" iyz="0.0" ixz="0.0"/>
</inertial>
<visual>
<origin xyz="-0.0 -0.0 -0.029095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/motor_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="silver"/>
</visual>
<collision>
<origin xyz="-0.0 -0.0 -0.029095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/motor_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="motor_2">
<inertial>
<origin xyz="5.6120382785351805e-11 0.024604091884807677 -0.007047331744742258" rpy="0 0 0"/>
<mass value="0.05"/>
<inertia ixx="0.0" iyy="0.0" izz="0.0" ixy="-0.0" iyz="-0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="-0.0 -0.0 -0.029095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/motor_2.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="silver"/>
</visual>
<collision>
<origin xyz="-0.0 -0.0 -0.029095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/motor_2.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="top_link_1">
<inertial>
<origin xyz="0.028960085543582276 0.04191000000000044 0.0024996683216068558" rpy="0 0 0"/>
<mass value="0.37189545514665234"/>
<inertia ixx="0.000281" iyy="0.000282" izz="0.000561" ixy="0.0" iyz="-0.0" ixz="0.0"/>
</inertial>
<visual>
<origin xyz="0.028948 0.04191 -0.057423" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/top_link_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="blue"/>
</visual>
<collision>
<origin xyz="0.028948 0.04191 -0.057423" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/top_link_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="pantilt_1_1">
<inertial>
<origin xyz="-0.0036327417220515914 -2.873247422695575e-15 0.0018087943330409653" rpy="0 0 0"/>
<mass value="0.02484644401179895"/>
<inertia ixx="2e-06" iyy="3e-06" izz="5e-06" ixy="0.0" iyz="-0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="-1.2e-05 0.0 -0.062423" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/pantilt_1_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="blue"/>
</visual>
<collision>
<origin xyz="-1.2e-05 0.0 -0.062423" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/pantilt_1_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="servo_emax_1_1">
<inertial>
<origin xyz="8.554358228704865e-08 1.254629415068201e-13 0.0035263014079521815" rpy="0 0 0"/>
<mass value="0.0035428307305659244"/>
<inertia ixx="0.0" iyy="0.0" izz="0.0" ixy="-0.0" iyz="-0.0" ixz="0.0"/>
</inertial>
<visual>
<origin xyz="-1.2e-05 0.0 -0.064423" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/servo_emax_1_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="silver"/>
</visual>
<collision>
<origin xyz="-1.2e-05 0.0 -0.064423" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/servo_emax_1_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="pantilt_2_1">
<inertial>
<origin xyz="-0.0044345407767680915 0.08095404581089227 0.003603404587610881" rpy="0 0 0"/>
<mass value="0.05139456940551715"/>
<inertia ixx="1e-05" iyy="1.1e-05" izz="1.4e-05" ixy="-0.0" iyz="-0.0" ixz="-2e-06"/>
</inertial>
<visual>
<origin xyz="-0.01175 0.081723 -0.091723" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/pantilt_2_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="black"/>
</visual>
<collision>
<origin xyz="-0.01175 0.081723 -0.091723" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/pantilt_2_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="servo_emax_2_1">
<inertial>
<origin xyz="-0.09208845165187876 -0.04184616942907199 -0.06897233167823215" rpy="0 0 0"/>
<mass value="0.0026502814230264554"/>
<inertia ixx="0.0" iyy="0.0" izz="0.0" ixy="-0.0" iyz="-0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="-0.118253 -0.025389 -0.180545" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/servo_emax_2_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="silver"/>
</visual>
<collision>
<origin xyz="-0.118253 -0.025389 -0.180545" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/servo_emax_2_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="pantilt_3_1">
<inertial>
<origin xyz="0.13325626443826744 -0.013095879873687058 0.02043119326869315" rpy="0 0 0"/>
<mass value="0.025707768034284914"/>
<inertia ixx="6e-06" iyy="3e-06" izz="4e-06" ixy="0.0" iyz="0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="0.098261 -0.0148 -0.102061" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/pantilt_3_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="black"/>
</visual>
<collision>
<origin xyz="0.098261 -0.0148 -0.102061" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/pantilt_3_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="servo_2_1">
<inertial>
<origin xyz="8.55435810034888e-08 0.012439350245232213 0.005558642662359281" rpy="0 0 0"/>
<mass value="0.048166128445804444"/>
<inertia ixx="4e-06" iyy="3e-06" izz="3e-06" ixy="-0.0" iyz="-0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="-0.027112 0.0112 -0.111573" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/servo_2_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="silver"/>
</visual>
<collision>
<origin xyz="-0.027112 0.0112 -0.111573" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/servo_2_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="servo_1_1">
<inertial>
<origin xyz="0.005559059884334861 -1.4876988529977098e-15 0.012439018566839363" rpy="0 0 0"/>
<mass value="0.048166128445804444"/>
<inertia ixx="3e-06" iyy="4e-06" izz="3e-06" ixy="-0.0" iyz="-0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="-1.2e-05 0.0 -0.073923" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/servo_1_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="light_blue"/>
</visual>
<collision>
<origin xyz="-1.2e-05 0.0 -0.073923" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/servo_1_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="camera_1">
<inertial>
<origin xyz="0.0054251818860430664 -1.398078701420058e-15 0.0006839016107979407" rpy="0 0 0"/>
<mass value="0.007223141621539521"/>
<inertia ixx="1e-06" iyy="1e-06" izz="1e-06" ixy="-0.0" iyz="-0.0" ixz="0.0"/>
</inertial>
<visual>
<origin xyz="-0.035312 -0.0007 -0.122273" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/camera_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="green"/>
</visual>
<collision>
<origin xyz="-0.035312 -0.0007 -0.122273" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/camera_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="ball_1">
<inertial>
<origin xyz="4.163336342344337e-17 0.0 -0.001000409009021104" rpy="0 0 0"/>
<mass value="0.005036225223550487"/>
<inertia ixx="0.0" iyy="0.0" izz="0.0" ixy="0.0" iyz="-0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="0.04 0.0 -0.007547" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/ball_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="silver"/>
</visual>
<collision>
<origin xyz="0.04 0.0 -0.007547" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/ball_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="housing_1">
<inertial>
<origin xyz="-0.03999999999999995 -1.7763568394002505e-17 -0.016681638158599674" rpy="0 0 0"/>
<mass value="0.003819569070267199"/>
<inertia ixx="0.0" iyy="0.0" izz="0.0" ixy="0.0" iyz="0.0" ixz="0.0"/>
</inertial>
<visual>
<origin xyz="-0.0 -0.0 -0.024095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/housing_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="white"/>
</visual>
<collision>
<origin xyz="-0.0 -0.0 -0.024095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/housing_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="ball_2">
<inertial>
<origin xyz="0.08000000000000003 -1.7763568394002505e-17 -0.0010004090090210953" rpy="0 0 0"/>
<mass value="0.005036225223550487"/>
<inertia ixx="0.0" iyy="0.0" izz="0.0" ixy="0.0" iyz="-0.0" ixz="0.0"/>
</inertial>
<visual>
<origin xyz="0.04 0.0 -0.007547" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/ball_2.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="silver"/>
</visual>
<collision>
<origin xyz="0.04 0.0 -0.007547" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/ball_2.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="housing_2">
<inertial>
<origin xyz="0.040000000000000015 -3.552713678800501e-17 -0.016681638158599674" rpy="0 0 0"/>
<mass value="0.003819569070267199"/>
<inertia ixx="0.0" iyy="0.0" izz="0.0" ixy="0.0" iyz="0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="-0.0 -0.0 -0.024095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/housing_2.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="white"/>
</visual>
<collision>
<origin xyz="-0.0 -0.0 -0.024095" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/housing_2.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="left_wheel_1">
<inertial>
<origin xyz="3.608732648937964e-06 0.07958937458754446 -2.519122826071668e-06" rpy="0 0 0"/>
<mass value="0.1"/>
<inertia ixx="1.8e-05" iyy="3.1e-05" izz="1.8e-05" ixy="-0.0" iyz="0.0" ixz="-0.0"/>
</inertial>
<visual>
<origin xyz="0.0 0.037 -0.022048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/left_wheel_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="black"/>
</visual>
<collision>
<origin xyz="0.0 0.037 -0.022048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/left_wheel_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<link name="right_wheel_1">
<inertial>
<origin xyz="-3.6087326488468997e-06 -0.005589374587544396 -2.5191228260612597e-06" rpy="0 0 0"/>
<mass value="0.1"/>
<inertia ixx="1.8e-05" iyy="3.1e-05" izz="1.8e-05" ixy="-0.0" iyz="-0.0" ixz="0.0"/>
</inertial>
<visual>
<origin xyz="0.0 0.037 -0.022048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/right_wheel_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="black"/>
</visual>
<collision>
<origin xyz="0.0 0.037 -0.022048" rpy="0 0 0"/>
<geometry>
<mesh filename="package://alphabot_description/meshes/right_wheel_1.stl" scale="0.001 0.001 0.001"/>
</geometry>
</collision>
</link>
<joint name="Rigid 6" type="fixed">
<origin xyz="0.028948 0.04191 0.017048" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="spacer_1_1"/>
</joint>
<joint name="Rigid 7" type="fixed">
<origin xyz="0.028948 -0.04191 0.017048" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="spacer_1_2"/>
</joint>
<joint name="Rigid 8" type="fixed">
<origin xyz="-0.028948 -0.04191 0.017048" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="spacer_1_3"/>
</joint>
<joint name="Rigid 9" type="fixed">
<origin xyz="-0.028948 0.04191 0.017048" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="spacer_1_4"/>
</joint>
<joint name="Rigid 10" type="fixed">
<origin xyz="0.0 0.0 0.029095" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="ultasonic_1"/>
</joint>
<joint name="Rigid 13" type="fixed">
<origin xyz="-0.02225 0.026 -0.003047" rpy="0 0 0"/>
<parent link="battery_case_1"/>
<child link="AA_1"/>
</joint>
<joint name="Rigid 14" type="fixed">
<origin xyz="-0.03775 -0.026 -0.003047" rpy="0 0 0"/>
<parent link="battery_case_1"/>
<child link="AA_2"/>
</joint>
<joint name="Rigid 15" type="fixed">
<origin xyz="0.0 0.0 0.029095" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="battery_case_1"/>
</joint>
<joint name="Rigid 16" type="fixed">
<origin xyz="0.0 0.0 0.029095" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="motor_1"/>
</joint>
<joint name="Rigid 17" type="fixed">
<origin xyz="0.0 0.0 0.029095" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="motor_2"/>
</joint>
<joint name="Rigid 20" type="fixed">
<origin xyz="0.0 0.0 0.040375" rpy="0 0 0"/>
<parent link="spacer_1_3"/>
<child link="top_link_1"/>
</joint>
<joint name="Rigid 21" type="fixed">
<origin xyz="0.02896 0.04191 0.005" rpy="0 0 0"/>
<parent link="top_link_1"/>
<child link="pantilt_1_1"/>
</joint>
<joint name="Rigid 22" type="fixed">
<origin xyz="0.0 0.0 0.002" rpy="0 0 0"/>
<parent link="pantilt_1_1"/>
<child link="servo_emax_1_1"/>
</joint>
<joint name="Rigid 24" type="fixed">
<origin xyz="0.011738 -0.081723 0.0178" rpy="0 0 0"/>
<parent link="servo_1_1"/>
<child link="pantilt_2_1"/>
</joint>
<joint name="Rigid 27" type="fixed">
<origin xyz="0.106503 0.107112 0.088822" rpy="0 0 0"/>
<parent link="pantilt_2_1"/>
<child link="servo_emax_2_1"/>
</joint>
<joint name="Rigid 29" type="fixed">
<origin xyz="-0.125373 0.026 -0.009512" rpy="0 0 0"/>
<parent link="servo_2_1"/>
<child link="pantilt_3_1"/>
</joint>
<joint name="Revolute 30" type="continuous">
<origin xyz="-0.091141 -0.036589 -0.068972" rpy="0 0 0"/>
<parent link="servo_emax_2_1"/>
<child link="servo_2_1"/>
<axis xyz="0.0 1.0 0.0"/>
<dynamics damping="0.1" friction="100"/>
<limit effort="130" lower="-1.57" upper="1.57" velocity="6.98"/>
</joint>
<joint name="Revolute 31" type="continuous">
<origin xyz="0.0 0.0 0.0095" rpy="0 0 0"/>
<parent link="servo_emax_1_1"/>
<child link="servo_1_1"/>
<axis xyz="-0.0 -0.0 1.0"/>
<dynamics damping="0.01" friction="1"/>
<limit effort="130" lower="-1.57" upper="1.57" velocity="6.98"/>
</joint>
<joint name="Rigid 32" type="fixed">
<origin xyz="0.133573 -0.0141 0.020212" rpy="0 0 0"/>
<parent link="pantilt_3_1"/>
<child link="camera_1"/>
</joint>
<joint name="Rigid 43" type="fixed">
<origin xyz="-0.04 -0.0 -0.016548" rpy="0 0 0"/>
<parent link="housing_1"/>
<child link="ball_1"/>
</joint>
<joint name="Rigid 44" type="fixed">
<origin xyz="0.0 0.0 0.024095" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="housing_1"/>
</joint>
<joint name="Rigid 45" type="fixed">
<origin xyz="-0.04 -0.0 -0.016548" rpy="0 0 0"/>
<parent link="housing_2"/>
<child link="ball_2"/>
</joint>
<joint name="Rigid 46" type="fixed">
<origin xyz="0.0 0.0 0.024095" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="housing_2"/>
</joint>
<joint name="Revolute 18" type="continuous">
<origin xyz="-0.0 -0.037 -0.007047" rpy="0 0 0"/>
<parent link="motor_2"/>
<child link="left_wheel_1"/>
<axis xyz="0.0 1.0 -0.0"/>
<dynamics damping="2" friction="2"/>
</joint>
<joint name="Revolute 19" type="continuous">
<origin xyz="-0.0 -0.037 -0.007047" rpy="0 0 0"/>
<parent link="motor_1"/>
<child link="right_wheel_1"/>
<axis xyz="0.0 1.0 -0.0"/>
<dynamics damping="2" friction="2"/>
</joint>
</robot>
gazebo file
<?xml version="1.0" ?>
<robot name="alphabot" xmlns:xacro="http://www.ros.org/wiki/xacro" >
<xacro:property name="blue" value="Gazebo/Blue" />
<xacro:property name="silver" value="Gazebo/Silver" />
<xacro:property name="black" value="Gazebo/Black" />
<xacro:property name="green" value="Gazebo/Green" />
<xacro:property name="gold" value="Gazebo/Gold" />
<xacro:property name="blue_2" value="Gazebo/SkyBlue" />
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/alphabot</robotNamespace>
</plugin>
<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
<!-- Plugin update rate in Hz -->
<updateRate>5</updateRate>
<!-- Name of left joint, defaults to `left_joint` -->
<leftJoint>Revolute 18</leftJoint>
<!-- Name of right joint, defaults to `right_joint` -->
<rightJoint>Revolute 19</rightJoint>
<!-- The distance from the center of one wheel to the other, in meters, defaults to 0.34 m -->
<wheelSeparation>0.08</wheelSeparation>
<!-- Diameter of the wheels, in meters, defaults to 0.15 m -->
<wheelDiameter>0.043</wheelDiameter>
<!-- Wheel acceleration, in rad/s^2, defaults to 0.0 rad/s^2 -->
<wheelAcceleration>1.0</wheelAcceleration>
<!-- Maximum torque which the wheels can produce, in Nm, defaults to 5 Nm -->
<wheelTorque>100</wheelTorque>
<!-- Topic to receive geometry_msgs/Twist message commands, defaults to `cmd_vel` -->
<commandTopic>cmd_vel</commandTopic>
<!-- Topic to publish nav_msgs/Odometry messages, defaults to `odom` -->
<odometryTopic>odom</odometryTopic>
<!-- Odometry frame, defaults to `odom` -->
<odometryFrame>odom</odometryFrame>
<!-- Robot frame to calculate odometry from, defaults to `base_footprint` -->
<robotBaseFrame>base_footprint</robotBaseFrame>
<!-- Odometry source, 0 for ENCODER, 1 for WORLD, defaults to WORLD -->
<odometrySource>1</odometrySource>
<!-- Set to true to publish transforms for the wheel links, defaults to false -->
<publishWheelTF>true</publishWheelTF>
<!-- Set to true to publish transforms for the odometry, defaults to true -->
<publishOdom>true</publishOdom>
<!-- Set to true to publish sensor_msgs/JointState on /joint_states for the wheel joints, defaults to false -->
<publishWheelJointState>true</publishWheelJointState>
<!-- Set to true to swap right and left wheels, defaults to true -->
<legacyMode>false</legacyMode>
</plugin>
</gazebo>
<gazebo reference="base_link">
<material>${blue}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
<gravity>true</gravity>
</gazebo>
<gazebo reference="spacer_1_1">
<material>${gold}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="spacer_1_2">
<material>${gold}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="spacer_1_3">
<material>${gold}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="spacer_1_4">
<material>${gold}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="ultasonic_1">
<sensor type="ray" name="TeraRanger">
<pose>0 0 0 0 0 0</pose>
<visualize>true</visualize>
<update_rate>50</update_rate>
<ray>
<scan>
<horizontal>
<samples>10</samples>
<resolution>1</resolution>
<min_angle>-0.14835</min_angle>
<max_angle>0.14835</max_angle>
</horizontal>
<vertical>
<samples>10</samples>
<resolution>1</resolution>
<min_angle>-0.14835</min_angle>
<max_angle>0.14835</max_angle>
</vertical>
</scan>
<range>
<min>0.01</min>
<max>0.2</max>
<resolution>0.02</resolution>
</range>
</ray>
<plugin filename="libgazebo_ros_range.so" name="gazebo_ros_range">
<gaussianNoise>0.005</gaussianNoise>
<alwaysOn>true</alwaysOn>
<updateRate>50</updateRate>
<topicName>sensor/ir_front</topicName>
<frameName>base_ir_front</frameName>
<radiation>INFRARED</radiation>
<fov>0.2967</fov>
</plugin>
</sensor>
<material>${blue_2}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="AA_1">
<material>${silver}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="AA_2">
<material>${silver}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="battery_case_1">
<material>${black}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="motor_1">
<material>${silver}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="motor_2">
<material>${silver}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="left_wheel_1">
<material>${black}</material>
<mu1>1000</mu1>
<mu2>1000</mu2>
<selfCollide>true</selfCollide>
<kp value="1000.0" />
<kd value="1.0" />
</gazebo>
<gazebo reference="right_wheel_1">
<material>${black}</material>
<mu1>1000</mu1>
<mu2>1000</mu2>
<selfCollide>true</selfCollide>
<kp value="1000.0" />
<kd value="1.0" />
</gazebo>
<gazebo reference="top_link_1">
<material>${blue}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="pantilt_1_1">
<material>${black}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="servo_emax_1_1">
<material>${silver}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="pantilt_2_1">
<material>${black}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="servo_emax_2_1">
<material>${silver}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="pantilt_3_1">
<material>${black}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="servo_2_1">
<material>${blue}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="servo_1_1">
<material>${blue}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="camera_1">
<sensor type="camera" name="camera1">
<update_rate>30.0</update_rate>
<camera name="head">
<horizontal_fov>1.3962634</horizontal_fov>
<image>
<width>800</width>
<height>800</height>
<format>R8G8B8</format>
</image>
<clip>
<near>0.02</near>
<far>300</far>
</clip>
<noise>
<type>gaussian</type>
<!-- Noise is sampled independently per pixel on each frame.
That pixel's noise value is added to each of its color
channels, which at that point lie in the range [0,1]. -->
<mean>0.0</mean>
<stddev>0.007</stddev>
</noise>
</camera>
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<alwaysOn>true</alwaysOn>
<updateRate>0.0</updateRate>
<cameraName>alphabot/camera1</cameraName>
<imageTopicName>image_raw</imageTopicName>
<cameraInfoTopicName>camera_info</cameraInfoTopicName>
<frameName>camera_link</frameName>
<hackBaseline>0.07</hackBaseline>
<distortionK1>0.0</distortionK1>
<distortionK2>0.0</distortionK2>
<distortionK3>0.0</distortionK3>
<distortionT1>0.0</distortionT1>
<distortionT2>0.0</distortionT2>
</plugin>
</sensor>
<material>${green}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="ball_1">
<material>${silver}</material>
<mu1>0.0001</mu1>
<mu2>0.0001</mu2>
<kp>0.1</kp>
<kd>0.1</kd>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="housing_1">
<material>${silver}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="ball_2">
<material>${silver}</material>
<mu1>0.0001</mu1>
<mu2>0.0001</mu2>
<kp>0.1</kp>
<kd>0.1</kd>
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="housing_2">
<material>${silver}</material>
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<selfCollide>true</selfCollide>
</gazebo>
</robot>
Asked by themightwarrior on 2023-04-24 07:48:12 UTC
Answers
There are a bunch of problems in your setup - too many for me to list them. My advice is to start with a complete, modern, working simulation that you download using apt
, like the turtlebot3 one. Start here:
http://wiki.ros.org/turtlebot3_simulations
The e-Manual has step-by-step instructions for running the simulation. Then checkout the source packages and begin customizing it one step at a time, making sure each change still works.
Asked by Mike Scheutzow on 2023-04-25 08:33:02 UTC
Comments
Could you modify this robot model so we can see it e.g. in this URDF viewer or in Foxglove Web? Maybe it will be easier to check its correctness
Asked by ljaniec on 2023-04-25 08:59:19 UTC