DiffDriveController (Skid Steering) isn't publishing to /cmd_vel

asked 2019-07-01 03:11:15 -0600

goateehige gravatar image

updated 2019-07-01 04:53:04 -0600


I'm new to ROS and gazebo, and I've been facing some problems while trying to implement skid steering on my robot. Mainly, I am unable to move the robot at all. I tried to follow similar format to what was done on Jackal.

I am running ROS Melodic on Ubuntu 18.04.02 bionic

This is my transmission tag for the wheels:

<transmission name="${prefix}_${suffix}_trans">
    <joint name="${prefix}_${suffix}_wheel_joint">
    <actuator name="${prefix}_${suffix}_Motor">

This is my yaml file:

  type: "joint_state_controller/JointStateController"
  publish_rate: 50

  type: "diff_drive_controller/DiffDriveController"
  left_wheel: ['front_left_wheel', 'rear_left_wheel']
  right_wheel: ['front_right_wheel', 'rear_right_wheel']
  publish_rate: 50
  pose_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 0.03]
  twist_covariance_diagonal: [0.001, 0.001, 0.001, 1000000.0, 1000000.0, 0.03]
  cmd_vel_timeout: 0.25
  velocity_rolling_window_size: 2

  k_l: 0.1
  k_r: 0.1

  # Base frame_id
  base_frame_id: body

  # Odometry fused with IMU is published by robot_localization, so
  # no need to publish a TF based on encoders alone.
  enable_odom_tf: false

  # Wheel separation and radius multipliers
  wheel_separation_multiplier: 1.5 # default: 1.0
  wheel_radius_multiplier    : 1.0 # default: 1.0

  # Velocity and acceleration limits
  # Whenever a min_* is unspecified, default to -max_*
      has_velocity_limits    : true
      max_velocity           : 1.0   # m/s
      has_acceleration_limits: true
      max_acceleration       : 3.0   # m/s^2
      has_velocity_limits    : true
      max_velocity           : 2.0   # rad/s
      has_acceleration_limits: true
      max_acceleration       : 6.0 # rad/s^2

Since I've encountered some errors regarding the PID gains not being set, I have created a pid.yaml file and specified arbitrary pid gains:

      p: 1.0
      i: 0.0
      d: 0.0
      p: 1.0
      i: 0.0
      d: 0.0
      p: 1.0
      i: 0.0
      d: 0.0
      p: 1.0
      i: 0.0
      d: 0.0

Afterwards, I loaded both files into launch file, spawned the controllers and started EKF localization:

  <!-- Spawn controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner"
args="rover_joint_publisher rover_velocity_controller"/>

  <!-- Start EKF for localization -->
  <node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization">
    <rosparam command="load" file="$(find rover_control)/config/rover_localization.yaml" />

After launching on Gazebo, I can see that the robot is slowly dragging forward/backward on its own. This is due to the set PID gain. If I increase the proportional gain then it moves faster in an unpredictable manner.

Here is a video demonstrating low proportional gain: https://youtu.be/BH7cUZeZc74

I'm not sure what exactly is the problem, but I feel that the DiffDriveController isnt publishing to the /rover/cmd_vel.

These are the listed active topics:

/rover/camera1/image_raw/compressedDepth ...
edit retag flag offensive close merge delete


did you echo the cmd_vel topic to see if anything is being published? Also how are you moving the robot? Manual teleop or navigation?

pavel92 gravatar image pavel92  ( 2019-07-01 03:26:21 -0600 )edit

I am moving it using teleop_twist_keyboard incorporated in the launch file (so manual teleop). I tried to echo the cmd_vel topic and observed that if I publish on cmd_vel, it shows the data. However the robot isnt moving on gazebo.

goateehige gravatar image goateehige  ( 2019-07-01 03:39:50 -0600 )edit

Maybe its listening to different cmd_vel topic so you will need to remap it. How many velocity topics are there?

pavel92 gravatar image pavel92  ( 2019-07-01 04:06:32 -0600 )edit

If the robot is moving slowly as you indicated then it is getting somehow some velocity messages. You need to publish on that topic. Find which cmd_vel topic is the model using and publish to it something

pavel92 gravatar image pavel92  ( 2019-07-01 04:08:19 -0600 )edit

There is only one cmd_vel topic. I have updated the question with the list of active topics. Moving was probably not the right word, its as if its dragging on the ground. I also added a video of the movement

goateehige gravatar image goateehige  ( 2019-07-01 04:25:08 -0600 )edit

what happens if you publish something directly on /rover/cmd_vel?

pavel92 gravatar image pavel92  ( 2019-07-01 06:28:54 -0600 )edit

No response from the robot on gazebo. Also, I opened rqt_graph and saw that there wasn't any node connnecting between the teleop and cmd_vel which is also quite weird.

goateehige gravatar image goateehige  ( 2019-07-01 07:30:49 -0600 )edit