Invalid robot movement with diff_drive_controller

I set the diff_drive_controller for my 4 wheel robot. After running this it seems to be properly configured because I have:

pawel@lenovo:~/catkin_ws$ rostopic list
/clicked_point
/clock
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/set_link_state
/gazebo/set_model_state
/initialpose
/joint_states
/move_base_simple/goal
/my_robot/front_laser_scan
/my_robot/rear_laser_scan
/my_robot_velocity_controller/cmd_vel
/my_robot_velocity_controller/odom
/my_robot_velocity_controller/parameter_descriptions
/my_robot_velocity_controller/parameter_updates
/rosout
/rosout_agg
/tf
/tf_static

During loading controller i received the following errors, but due to the informations I’ve found it’s not a case:

[ERROR] [1619603315.098793222, 411.090000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/left_front_wheel_joint
[ERROR] [1619603315.099420542, 411.090000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/left_rear_wheel_joint
[ERROR] [1619603315.099978211, 411.090000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/right_front_wheel_joint
[ERROR] [1619603315.100714205, 411.090000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/right_rear_wheel_joint

After publishing simple messages on the /my_robot_velocity_controller/cmd_vel topic to verify the controller, I saw that while turning, the robot act strangely. I mean not simply change the orientation but also significantly change the position. Please find attached video: diff_drive_test

This is my yaml file:

joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 50
        
my_robot_velocity_controller:
    type: "diff_drive_controller/DiffDriveController"
    left_wheel: ['left_front_wheel_joint', 'left_rear_wheel_joint']
    right_wheel: ['right_front_wheel_joint', 'right_rear_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: 5
    velocity_rolling_window_size: 2

    # Robot parameters
    # wheel_separation : 0.346
    # wheel_radius : 0.075

    # Base frame_id
    base_frame_id: base_footprint

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

    # Wheel separation and radius multipliers
    wheel_separation_multiplier: 1.0 # 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       : 2.0   # m/s^2
    angular:
        z:
            has_velocity_limits    : true
            max_velocity           : 2.0   # rad/s
            has_acceleration_limits: true
            max_acceleration       : 2.0   # rad/s^2

Here you can find my urdf file and launch files as well:
urdf
launch

I’d be thankful for any advice, how to solve it out.

i am not sure if this could help but try adding those pid constants:

pid: {p: 1.0, i: 1.0, d: 0.0}
1 Like

After adding PID constants to YAML, the robot still rotate strangely and errors about PID occurred :confused:

Yaml file:

joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 50
        
my_robot_velocity_controller:
    type: "diff_drive_controller/DiffDriveController"
    left_wheel: ['left_front_wheel_joint', 'left_rear_wheel_joint']
    right_wheel: ['right_front_wheel_joint', 'right_rear_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: 5
    velocity_rolling_window_size: 2

    pid: {p: 1.0, i: 1.0, d: 0.0}

    # Robot parameters
    # wheel_separation : 0.346
    # wheel_radius : 0.075

    # Base frame_id
    base_frame_id: base_footprint

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

    # Wheel separation and radius multipliers
    wheel_separation_multiplier: 1.0 # 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       : 2.0   # m/s^2
    angular:
        z:
            has_velocity_limits    : true
            max_velocity           : 2.0   # rad/s
            has_acceleration_limits: true
            max_acceleration       : 2.0   # rad/s^2

Errors:

[ERROR] [1619868739.883282839, 411.194000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/left_front_wheel_joint
[ERROR] [1619868739.884173593, 411.194000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/left_rear_wheel_joint
[ERROR] [1619868739.884992159, 411.194000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/right_front_wheel_joint
[ERROR] [1619868739.885741026, 411.194000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/right_rear_wheel_joint