Differential Drive Configuration

Hi there,

I am a bit confused about the gazebo differential drive plugin as it over-write my urdf settings.
The right wheel and left wheel of the robot should be connected to the base_link instead of base_footpirnt.

and the publisher of them should be /robot_state_publisher instead of /gazebo???

here is my differential drive settings:

<gazebo>
    <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
        <legacyMode>true</legacyMode>
        <alwaysOn>true</alwaysOn>
        <publishWheelTF>true</publishWheelTF>
        <publishTf>1</publishTf>
        <wheelSeparation>1.1</wheelSeparation>
        <wheelDiameter>0.34</wheelDiameter>
        <publishWheelJointState>true</publishWheelJointState>
        <updateRate>100.0</updateRate>
        <leftJoint>left_wheel_joint</leftJoint>
        <rightJoint>right_wheel_joint</rightJoint>
        <wheelAcceleration>1.0</wheelAcceleration>
        <torque>20</torque>
        <commandTopic>/weeding_robot/cmd_vel</commandTopic>
        <odometryTopic>/odom</odometryTopic>
        <odometryFrame>/odom</odometryFrame>
        <robotBaseFrame>/base_footprint</robotBaseFrame>
    </plugin>
</gazebo>

and here is the wheel part of the urdf of the robot

<link name="left_wheel">
    <inertial>
         <origin xyz="0 0 0" rpy="0 0 0"/>
         <mass value="2.9" />
         <inertia ixx="0.0269397916667" ixy="0.0" ixz="0.0" iyy="0.0269397916667" iyz="0.0" izz="0.04440625"/>
    </inertial>

    <collision>
         <origin rpy="0 0 1.57" xyz="0.07 -0.175 -0.175"/>
         <geometry>
            <mesh filename="package://weeding_robot_description/models/wheelcollisionBox.STL" scale="0.001 0.001 0.001"/>
         </geometry>
    </collision>

    <visual>
        <origin rpy="1.57 0 0" xyz="-0.0677 0.142 -0.1420"/>
        <geometry>
            <mesh filename="package://weeding_robot_description/models/wheel.STL" scale="0.001 0.001 0.001"/>
        </geometry>

        <material name="grey"/>

    </visual>
</link>

<joint name="left_wheel_joint" type="continuous">
	<parent link="base_link"/>
	<child link="left_wheel"/>
    <origin xyz="-0.572 0.195 -0.03" rpy="0 3.14 0"/>
    <axis xyz="1 0 0"/>
</joint>

<transmission name="left_wheel_tran">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="left_wheel_joint">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="left_motor">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>

thanks for any help.

Hi @hank880907,

Could you please tell us the course, unit, and exercise you are following?

Hi,

This is my own project i am working on. I am really stuck on setting up the differential drive for my robot.

For the above code, I set up my robot by following the “your first robot with ROS” course. But the TF transform of the gazebo differential drive controller is not quit right.

I checked out this artical on your website for a clue. I follow the example to setup my ros differential drive control.

I got a correct TF

but however, There is 2 error and 1 warning messages appears.

[ INFO] [1610060624.028724329]: Loading gazebo_ros_control plugin
[ INFO] [1610060624.033328505]: Starting gazebo_ros_control plugin in namespace: /weeding_robot
[ERROR] [1610060624.137612399]: No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/left_wheel_joint
[ERROR] [1610060624.138676322]: No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/right_wheel_joint
[ INFO] [1610060624.142741545]: Loaded gazebo_ros_control.
[ INFO] [1610060624.142929066]: imu plugin missing <frameName>, defaults to <bodyName>
[ INFO] [1610060624.356928209]: Controller state will be published at 50Hz.
[ INFO] [1610060624.363246727]: Wheel separation will be multiplied by 1.
[ INFO] [1610060624.365520089]: Left wheel radius will be multiplied by 1.
[ INFO] [1610060624.365602781]: Right wheel radius will be multiplied by 1.
[ INFO] [1610060624.366356679]: Velocity rolling window size of 10.
[ INFO] [1610060624.367827937]: Velocity commands will be considered old if they are older than 0.25s.
[ INFO] [1610060624.368570075]: Allow mutiple cmd_vel publishers is enabled
[ INFO] [1610060624.371527635]: Base frame_id set to base_footprint
[ INFO] [1610060624.372639905]: Odometry frame_id set to odom
[ INFO] [1610060624.373339015]: Publishing to tf is enabled
[ INFO] [1610060624.421676840]: Odometry params : wheel separation 1.1, left wheel radius 0.34, right wheel radius 0.34
[ INFO] [1610060624.433937751]: Adding left wheel with joint name: left_wheel_joint and right wheel with joint name: right_wheel_joint
[ WARN] [1610060624.466911853]: updateConfig() called on a dynamic_reconfigure::Server that provides its own mutex. This can lead to deadlocks if updateConfig() is called during an update. Providing a mutex to the constructor is highly recommended in this case. Please forward this message to the node author.
[ INFO] [1610060624.481414113]: Dynamic Reconfigure:
DynamicParams:
    Odometry parameters:
    	left wheel radius: 1
    	right wheel radius: 1
    	wheel separation: 1
    Publication parameters:
    	Publish executed velocity command: 0
    	Publication rate: 50
    	Publish frame odom on tf: 1

Do you know if there’s anything wrong in my gazebo differential drive controller?

Or what might cause the problem?

thanks so much for helping me.