a2s-institute / youbot_simulation

Packages to run the KUKA youBot in the Gazebo simulation with ROS
23 stars 42 forks source link

youBot is not moving after adding gazebo_ros_control/gains #21

Open ghost opened 2 years ago

ghost commented 2 years ago

ROS Melodic, Gazebo 9.0, Ubuntu 18.04

I'm trying to control Kuka youBot in Gazebo but I'm having some issues. When I run the simulation I get these errors.

No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/wheel_joint_fl
No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/caster_joint_fl
No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/wheel_joint_fr
No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/caster_joint_fr
No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/wheel_joint_bl
No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/caster_joint_bl
No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/wheel_joint_br
No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/caster_joint_br

and when I don't send any twist commands, I've noticed the base is drifting slowly. I thought this is because the above errors since Gazebo didn't set the pid gains. One of the solutions I've found is to add the following lines to base_controller.yaml file

gazebo_ros_control/pid_gains:
    wheel_joint_fl: {p: 100.0, i: 0.0, d: 1.0}
    caster_joint_fl: {p: 100.0, i: 0.0, d: 1.0}
    wheel_joint_fr: {p: 100.0, i: 0.0, d: 1.0}
    caster_joint_fr: {p: 100.0, i: 0.0, d: 1.0}
    wheel_joint_bl: {p: 100.0, i: 0.0, d: 1.0}
    caster_joint_bl: {p: 100.0, i: 0.0, d: 1.0}
    wheel_joint_br: {p: 100.0, i: 0.0, d: 1.0}
    caster_joint_br: {p: 100.0, i: 0.0, d: 1.0}

The above errors disappeared and the base is firmly stationary. However, when I send the twist commands, it seems the base is not moving at all. Changing the pid gains didn't solve the problem. I've checked urdf files and they seem fine. Any suggestions?

Edit: After some investigation, it seems the non-zero d gain causing the base to move even if there is no input applied. However, still applying gazebo_ros_control forces the base to be stationary even if I apply inputs.