DiffDriveController (Skid Steering) isn't publishing to /cmd_vel
Hello!
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">
<type>transmission_interface/SimpleTransmission</type>
<joint name="${prefix}_${suffix}_wheel_joint">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="${prefix}_${suffix}_Motor">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
This is my yaml file:
rover_joint_publisher:
type: "joint_state_controller/JointStateController"
publish_rate: 50
rover_velocity_controller:
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_*
linear:
x:
has_velocity_limits : true
max_velocity : 1.0 # m/s
has_acceleration_limits: true
max_acceleration : 3.0 # m/s^2
angular:
z:
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:
/rover/gazebo_ros_control:
pid_gains:
front_left_wheel_joint:
p: 1.0
i: 0.0
d: 0.0
front_right_wheel_joint:
p: 1.0
i: 0.0
d: 0.0
rear_left_wheel_joint:
p: 1.0
i: 0.0
d: 0.0
rear_right_wheel_joint:
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" />
</node>
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:
/client_count
/clock
/connected_clients
/diagnostics
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/set_link_state
/gazebo/set_model_state
/imu/data
/odometry/filtered
/rosout
/rosout_agg
/rover/camera1/camera1_info
/rover/camera1/image_raw
/rover/camera1/image_raw/compressed
/rover/camera1/image_raw/compressed/parameter_descriptions
/rover/camera1/image_raw/compressed/parameter_updates
/rover/camera1/image_raw/compressedDepth
/rover/camera1/image_raw/compressedDepth/parameter_descriptions
/rover/camera1/image_raw/compressedDepth/parameter_updates
/rover/camera1/image_raw/theora
/rover/camera1/image_raw/theora/parameter_descriptions
/rover/camera1/image_raw/theora/parameter_updates
/rover/camera1/parameter_descriptions
/rover/camera1/parameter_updates
/rover/camera2/camera2_info
/rover/camera2/image_raw
/rover/camera2/image_raw/compressed
/rover/camera2/image_raw/compressed/parameter_descriptions
/rover/camera2/image_raw/compressed/parameter_updates
/rover/camera2/image_raw/compressedDepth
/rover/camera2/image_raw/compressedDepth/parameter_descriptions
/rover/camera2/image_raw/compressedDepth/parameter_updates
/rover/camera2/image_raw/theora
/rover/camera2/image_raw/theora/parameter_descriptions
/rover/camera2/image_raw/theora/parameter_updates
/rover/camera2/parameter_descriptions
/rover/camera2/parameter_updates
/rover/cmd_vel
/rover/gazebo_ros_control/pid_gains/front_left_wheel_joint/parameter_descriptions
/rover/gazebo_ros_control/pid_gains/front_left_wheel_joint/parameter_updates
/rover/gazebo_ros_control/pid_gains/front_right_wheel_joint/parameter_descriptions
/rover/gazebo_ros_control/pid_gains/front_right_wheel_joint/parameter_updates
/rover/gazebo_ros_control/pid_gains/rear_left_wheel_joint/parameter_descriptions
/rover/gazebo_ros_control/pid_gains/rear_left_wheel_joint/parameter_updates
/rover/gazebo_ros_control/pid_gains/rear_right_wheel_joint/parameter_descriptions
/rover/gazebo_ros_control/pid_gains/rear_right_wheel_joint/parameter_updates
/rover/imu
/rover/laser/scan
/rover_velocity_controller/odom
/set_pose
/tf
/tf_static
Any help would be appreciated.
Thanks!
Asked by goateehige on 2019-07-01 02:44:54 UTC
Comments
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?
Asked by pavel92 on 2019-07-01 03:26:21 UTC
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.
Asked by goateehige on 2019-07-01 03:39:50 UTC
Maybe its listening to different cmd_vel topic so you will need to remap it. How many velocity topics are there?
Asked by pavel92 on 2019-07-01 04:06:32 UTC
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
Asked by pavel92 on 2019-07-01 04:08:19 UTC
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
Asked by goateehige on 2019-07-01 04:25:08 UTC
what happens if you publish something directly on /rover/cmd_vel?
Asked by pavel92 on 2019-07-01 06:28:54 UTC
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.
Asked by goateehige on 2019-07-01 07:30:49 UTC