ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Hello @manuelmelvin,

Unfortunately, using the differential driver gazebo plugin like this will not work. But the good news is that you can use in a different way, like they do for Husky or Jackal robots (https://github.com/s-mostafa-a/Original-Husky).

Basically, it's about using the diff_drive_controller (http://wiki.ros.org/diff_drive_controller)

I've cloned your repo and worked on one of my own, see below the main modifications I've done or if you prefer, check in my public repository the merge I've done to master branch (https://bitbucket.org/theconstructcore/p3dx/commits/ed1e237e2a36a1c2d23cd5edcbed2059cf0c88f2)

p3dx_description/urdf/pioneer3dx.gazebo (just comment the plugin code)

<!--
    <gazebo>
        <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
            <alwaysOn>true</alwaysOn>
            <updateRate>100</updateRate>
            <leftJoint>base_right_wheel_joint</leftJoint>
            <rightJoint>base_left_wheel_joint</rightJoint>
            <wheelSeparation>0.39</wheelSeparation>
            <wheelDiameter>0.15</wheelDiameter>
            <torque>5</torque>
            <commandTopic>${ns}/cmd_vel</commandTopic>
            <odometryTopic>${ns}/odom</odometryTopic>
            <odometryFrame>odom</odometryFrame>
            <robotBaseFrame>base_link</robotBaseFrame>
        </plugin>
    </gazebo>
    -->

p3dx_description/urdf/pioneer3dx_wheel.xacro (change hardwareInterface value to VelocityJointInterface)

    <transmission name="${parent}_${suffix}_wheel_trans">
      <type>pr2_mechanism_model/SimpleTransmission</type>
      <joint name="base_${suffix}_wheel_joint">
        <hardwareInterface>VelocityJointInterface</hardwareInterface>
      </joint>
      <actuator name="base_${suffix}_wheel_motor">
        <mechanicalReduction>${reflect * 624/35 * 80/19}</mechanicalReduction>
      </actuator>
    </transmission>

p3dx_gazebo/launch/gazebo.launch (Spawn the differential drive controller)

<launch>

    <!-- these are the arguments you can pass this launch file, for example 
        paused:=true -->
    <arg name="paused" default="false" />
    <arg name="use_sim_time" default="true" />
    <arg name="gui" default="true" />
    <arg name="headless" default="false" />
    <arg name="debug" default="false" />

    <!-- We resume the logic in empty_world.launch, changing only the name of 
        the world to be launched -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <!--<arg name="world_name" value="$(find p3dx_gazebo)/worlds/p3dx.world" />-->
        <arg name="debug" value="$(arg debug)" />
        <arg name="gui" value="$(arg gui)" />
        <arg name="paused" value="$(arg paused)" />
        <arg name="use_sim_time" value="$(arg use_sim_time)" />
        <arg name="headless" value="$(arg headless)" />
    </include>

    <group ns="/p3dx">

        <!-- Load the URDF into the ROS Parameter Server -->

        <param name="robot_description"
            command="$(find xacro)/xacro.py --inorder '$(find p3dx_description)/urdf/pioneer3dx.xacro'" />

        <!-- Run a python script to the send a service call to gazebo_ros to spawn 
            a URDF robot -->
        <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
            respawn="false" output="screen" args="-urdf -param robot_description -model p3dx" />

        <rosparam command="load" file="$(find p3dx_control)/config/control.yaml" />

        <node name="base_controller_spawner" pkg="controller_manager" type="spawner"
            args="--namespace=/p3dx
            p3dx_joint_publisher
            p3dx_velocity_controller
            --shutdown-timeout 3"
            output="screen"/>

        <!-- ros_control p3rd launch file -->
        <!-- <include file="$(find p3dx_control)/launch/control.launch" /> -->
    </group>

</launch>

p3dx_control/config/control.yaml (create a new file to configure the controller)

p3dx_joint_publisher:
  type: "joint_state_controller/JointStateController"
  publish_rate: 50

p3dx_velocity_controller:
  type: "diff_drive_controller/DiffDriveController"
  left_wheel: 'base_right_wheel_joint'
  right_wheel: 'base_left_wheel_joint'
  publish_rate: 50
  pose_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  cmd_vel_timeout: 0.25
  wheel_separation : 0.39
  wheel_radius : 0.15

I hope it can help you.

Cheers!

Hello @manuelmelvin,

Unfortunately, using the differential driver gazebo plugin like this will not work. But the good news is that you can use in a different way, like they do for Husky or Jackal robots (https://github.com/s-mostafa-a/Original-Husky).

Basically, it's about using the diff_drive_controller (http://wiki.ros.org/diff_drive_controller)

I've cloned your repo and worked on one of my own, see below the main modifications I've done or if you prefer, check in my public repository the merge I've done to master branch (https://bitbucket.org/theconstructcore/p3dx/commits/ed1e237e2a36a1c2d23cd5edcbed2059cf0c88f2)

Yet, you can run my ROSJect using this ROSDS link (https://rds.theconstructsim.com/tc_projects/use_project_share_link/438ff787-1c07-44ff-8fb0-b7a21f4014b2)

Here it goes the modifications:

p3dx_description/urdf/pioneer3dx.gazebo (just comment the plugin code)

<!--
    <gazebo>
        <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
            <alwaysOn>true</alwaysOn>
            <updateRate>100</updateRate>
            <leftJoint>base_right_wheel_joint</leftJoint>
            <rightJoint>base_left_wheel_joint</rightJoint>
            <wheelSeparation>0.39</wheelSeparation>
            <wheelDiameter>0.15</wheelDiameter>
            <torque>5</torque>
            <commandTopic>${ns}/cmd_vel</commandTopic>
            <odometryTopic>${ns}/odom</odometryTopic>
            <odometryFrame>odom</odometryFrame>
            <robotBaseFrame>base_link</robotBaseFrame>
        </plugin>
    </gazebo>
    -->

p3dx_description/urdf/pioneer3dx_wheel.xacro (change hardwareInterface value to VelocityJointInterface)

    <transmission name="${parent}_${suffix}_wheel_trans">
      <type>pr2_mechanism_model/SimpleTransmission</type>
      <joint name="base_${suffix}_wheel_joint">
        <hardwareInterface>VelocityJointInterface</hardwareInterface>
      </joint>
      <actuator name="base_${suffix}_wheel_motor">
        <mechanicalReduction>${reflect * 624/35 * 80/19}</mechanicalReduction>
      </actuator>
    </transmission>

p3dx_gazebo/launch/gazebo.launch (Spawn the differential drive controller)

<launch>

    <!-- these are the arguments you can pass this launch file, for example 
        paused:=true -->
    <arg name="paused" default="false" />
    <arg name="use_sim_time" default="true" />
    <arg name="gui" default="true" />
    <arg name="headless" default="false" />
    <arg name="debug" default="false" />

    <!-- We resume the logic in empty_world.launch, changing only the name of 
        the world to be launched -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <!--<arg name="world_name" value="$(find p3dx_gazebo)/worlds/p3dx.world" />-->
        <arg name="debug" value="$(arg debug)" />
        <arg name="gui" value="$(arg gui)" />
        <arg name="paused" value="$(arg paused)" />
        <arg name="use_sim_time" value="$(arg use_sim_time)" />
        <arg name="headless" value="$(arg headless)" />
    </include>

    <group ns="/p3dx">

        <!-- Load the URDF into the ROS Parameter Server -->

        <param name="robot_description"
            command="$(find xacro)/xacro.py --inorder '$(find p3dx_description)/urdf/pioneer3dx.xacro'" />

        <!-- Run a python script to the send a service call to gazebo_ros to spawn 
            a URDF robot -->
        <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
            respawn="false" output="screen" args="-urdf -param robot_description -model p3dx" />

        <rosparam command="load" file="$(find p3dx_control)/config/control.yaml" />

        <node name="base_controller_spawner" pkg="controller_manager" type="spawner"
            args="--namespace=/p3dx
            p3dx_joint_publisher
            p3dx_velocity_controller
            --shutdown-timeout 3"
            output="screen"/>

        <!-- ros_control p3rd launch file -->
        <!-- <include file="$(find p3dx_control)/launch/control.launch" /> -->
    </group>

</launch>

p3dx_control/config/control.yaml (create a new file to configure the controller)

p3dx_joint_publisher:
  type: "joint_state_controller/JointStateController"
  publish_rate: 50

p3dx_velocity_controller:
  type: "diff_drive_controller/DiffDriveController"
  left_wheel: 'base_right_wheel_joint'
  right_wheel: 'base_left_wheel_joint'
  publish_rate: 50
  pose_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  cmd_vel_timeout: 0.25
  wheel_separation : 0.39
  wheel_radius : 0.15

I hope it can help you.

Cheers!

Hello @manuelmelvin,

Unfortunately, using the differential driver gazebo plugin like this will not work. But the good news is that you can use in a different way, like they do for Husky or Jackal robots (https://github.com/s-mostafa-a/Original-Husky).

Basically, it's about using the diff_drive_controller (http://wiki.ros.org/diff_drive_controller)

By doing this, you can set the variable cmd_vel_timeout as your needs.

I've cloned your repo and worked on one of my own, see below the main modifications I've done or if you prefer, check in my public repository the merge I've done to master branch (https://bitbucket.org/theconstructcore/p3dx/commits/ed1e237e2a36a1c2d23cd5edcbed2059cf0c88f2)

Yet, you can run my ROSJect using this ROSDS link (https://rds.theconstructsim.com/tc_projects/use_project_share_link/438ff787-1c07-44ff-8fb0-b7a21f4014b2)

Here it goes the modifications:

p3dx_description/urdf/pioneer3dx.gazebo (just comment the plugin code)

<!--
    <gazebo>
        <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
            <alwaysOn>true</alwaysOn>
            <updateRate>100</updateRate>
            <leftJoint>base_right_wheel_joint</leftJoint>
            <rightJoint>base_left_wheel_joint</rightJoint>
            <wheelSeparation>0.39</wheelSeparation>
            <wheelDiameter>0.15</wheelDiameter>
            <torque>5</torque>
            <commandTopic>${ns}/cmd_vel</commandTopic>
            <odometryTopic>${ns}/odom</odometryTopic>
            <odometryFrame>odom</odometryFrame>
            <robotBaseFrame>base_link</robotBaseFrame>
        </plugin>
    </gazebo>
    -->

p3dx_description/urdf/pioneer3dx_wheel.xacro (change hardwareInterface value to VelocityJointInterface)

    <transmission name="${parent}_${suffix}_wheel_trans">
      <type>pr2_mechanism_model/SimpleTransmission</type>
      <joint name="base_${suffix}_wheel_joint">
        <hardwareInterface>VelocityJointInterface</hardwareInterface>
      </joint>
      <actuator name="base_${suffix}_wheel_motor">
        <mechanicalReduction>${reflect * 624/35 * 80/19}</mechanicalReduction>
      </actuator>
    </transmission>

p3dx_gazebo/launch/gazebo.launch (Spawn the differential drive controller)

<launch>

    <!-- these are the arguments you can pass this launch file, for example 
        paused:=true -->
    <arg name="paused" default="false" />
    <arg name="use_sim_time" default="true" />
    <arg name="gui" default="true" />
    <arg name="headless" default="false" />
    <arg name="debug" default="false" />

    <!-- We resume the logic in empty_world.launch, changing only the name of 
        the world to be launched -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <!--<arg name="world_name" value="$(find p3dx_gazebo)/worlds/p3dx.world" />-->
        <arg name="debug" value="$(arg debug)" />
        <arg name="gui" value="$(arg gui)" />
        <arg name="paused" value="$(arg paused)" />
        <arg name="use_sim_time" value="$(arg use_sim_time)" />
        <arg name="headless" value="$(arg headless)" />
    </include>

    <group ns="/p3dx">

        <!-- Load the URDF into the ROS Parameter Server -->

        <param name="robot_description"
            command="$(find xacro)/xacro.py --inorder '$(find p3dx_description)/urdf/pioneer3dx.xacro'" />

        <!-- Run a python script to the send a service call to gazebo_ros to spawn 
            a URDF robot -->
        <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
            respawn="false" output="screen" args="-urdf -param robot_description -model p3dx" />

        <rosparam command="load" file="$(find p3dx_control)/config/control.yaml" />

        <node name="base_controller_spawner" pkg="controller_manager" type="spawner"
            args="--namespace=/p3dx
            p3dx_joint_publisher
            p3dx_velocity_controller
            --shutdown-timeout 3"
            output="screen"/>

        <!-- ros_control p3rd launch file -->
        <!-- <include file="$(find p3dx_control)/launch/control.launch" /> -->
    </group>

</launch>

p3dx_control/config/control.yaml (create a new file to configure the controller)

p3dx_joint_publisher:
  type: "joint_state_controller/JointStateController"
  publish_rate: 50

p3dx_velocity_controller:
  type: "diff_drive_controller/DiffDriveController"
  left_wheel: 'base_right_wheel_joint'
  right_wheel: 'base_left_wheel_joint'
  publish_rate: 50
  pose_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  cmd_vel_timeout: 0.25
  wheel_separation : 0.39
  wheel_radius : 0.15

I hope it can help you.

Cheers!

Hello @manuelmelvin,

Unfortunately, using the differential driver gazebo plugin like this will not work. But the good news is that you can use in a different way, like they do for Husky or Jackal robots (https://github.com/s-mostafa-a/Original-Husky).

Basically, it's about using the diff_drive_controller (http://wiki.ros.org/diff_drive_controller)

By doing this, you can set the variable cmd_vel_timeout as your needs.

I've cloned your repo and worked on one of my own, see below the main modifications I've done or if you prefer, check in my public repository the merge I've done to master branch (https://bitbucket.org/theconstructcore/p3dx/commits/ed1e237e2a36a1c2d23cd5edcbed2059cf0c88f2)

Yet, you can run my ROSJect using this ROSDS link (https://rds.theconstructsim.com/tc_projects/use_project_share_link/438ff787-1c07-44ff-8fb0-b7a21f4014b2)

Or watch this video to follow the instructions: https://www.youtube.com/watch?v=x8iedoVgv8k

Here it goes the modifications:

p3dx_description/urdf/pioneer3dx.gazebo (just comment the plugin code)

<!--
    <gazebo>
        <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
            <alwaysOn>true</alwaysOn>
            <updateRate>100</updateRate>
            <leftJoint>base_right_wheel_joint</leftJoint>
            <rightJoint>base_left_wheel_joint</rightJoint>
            <wheelSeparation>0.39</wheelSeparation>
            <wheelDiameter>0.15</wheelDiameter>
            <torque>5</torque>
            <commandTopic>${ns}/cmd_vel</commandTopic>
            <odometryTopic>${ns}/odom</odometryTopic>
            <odometryFrame>odom</odometryFrame>
            <robotBaseFrame>base_link</robotBaseFrame>
        </plugin>
    </gazebo>
    -->

p3dx_description/urdf/pioneer3dx_wheel.xacro (change hardwareInterface value to VelocityJointInterface)

    <transmission name="${parent}_${suffix}_wheel_trans">
      <type>pr2_mechanism_model/SimpleTransmission</type>
      <joint name="base_${suffix}_wheel_joint">
        <hardwareInterface>VelocityJointInterface</hardwareInterface>
      </joint>
      <actuator name="base_${suffix}_wheel_motor">
        <mechanicalReduction>${reflect * 624/35 * 80/19}</mechanicalReduction>
      </actuator>
    </transmission>

p3dx_gazebo/launch/gazebo.launch (Spawn the differential drive controller)

<launch>

    <!-- these are the arguments you can pass this launch file, for example 
        paused:=true -->
    <arg name="paused" default="false" />
    <arg name="use_sim_time" default="true" />
    <arg name="gui" default="true" />
    <arg name="headless" default="false" />
    <arg name="debug" default="false" />

    <!-- We resume the logic in empty_world.launch, changing only the name of 
        the world to be launched -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <!--<arg name="world_name" value="$(find p3dx_gazebo)/worlds/p3dx.world" />-->
        <arg name="debug" value="$(arg debug)" />
        <arg name="gui" value="$(arg gui)" />
        <arg name="paused" value="$(arg paused)" />
        <arg name="use_sim_time" value="$(arg use_sim_time)" />
        <arg name="headless" value="$(arg headless)" />
    </include>

    <group ns="/p3dx">

        <!-- Load the URDF into the ROS Parameter Server -->

        <param name="robot_description"
            command="$(find xacro)/xacro.py --inorder '$(find p3dx_description)/urdf/pioneer3dx.xacro'" />

        <!-- Run a python script to the send a service call to gazebo_ros to spawn 
            a URDF robot -->
        <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
            respawn="false" output="screen" args="-urdf -param robot_description -model p3dx" />

        <rosparam command="load" file="$(find p3dx_control)/config/control.yaml" />

        <node name="base_controller_spawner" pkg="controller_manager" type="spawner"
            args="--namespace=/p3dx
            p3dx_joint_publisher
            p3dx_velocity_controller
            --shutdown-timeout 3"
            output="screen"/>

        <!-- ros_control p3rd launch file -->
        <!-- <include file="$(find p3dx_control)/launch/control.launch" /> -->
    </group>

</launch>

p3dx_control/config/control.yaml (create a new file to configure the controller)

p3dx_joint_publisher:
  type: "joint_state_controller/JointStateController"
  publish_rate: 50

p3dx_velocity_controller:
  type: "diff_drive_controller/DiffDriveController"
  left_wheel: 'base_right_wheel_joint'
  right_wheel: 'base_left_wheel_joint'
  publish_rate: 50
  pose_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  cmd_vel_timeout: 0.25
  wheel_separation : 0.39
  wheel_radius : 0.15

I hope it can help you.

Cheers!