Closed fjp closed 2 years ago
It appears that the PID gains aren't tuned correctly. The change in commit 4b308a5a0b60e0c8210a7dc20804a5867016ab62 lead to this issue.
After tuning the gains correctly or, alternatively, not loading the pid.yaml
file in diffbo_control.launch
can solve this issue.
When not using the pid.yaml
file, and therefore not setting the pid gains, the following error will appear in Gazebo:
[ERROR] [1644167650.124120487, 0.370000000]: No p gain specified for pid. Namespace: /diffbot/gazebo_ros_control/pid_gains/front_right_wheel_joint
[ERROR] [1644167650.124597413, 0.370000000]: No p gain specified for pid. Namespace: /diffbot/gazebo_ros_control/pid_gains/front_left_wheel_joint
To avoid this error I prefer to make use of pid.yaml
and tune the gains correctly.
Issue https://github.com/ros-simulation/gazebo_ros_pkgs/issues/886 explains what happens when the pid gains are set/not set:
I had the same question some weeks ago, and I think I understood what is happening. The point is that Gazebo allows you to use position and velocity control interfaces in a flexible way:
- if you do not specify the gains: when setting the position (velocity) command, the function
SetPosition
(SetParam
) is used (see here and here). This should mean that the command is applied exactly, and therefore I think the dynamics will not be taken into account.- you do specify gains: when you set a position (velocity) command, for each motor an effort is computed via the PID and the command is passed to
SetForce
(see here and here). Here you have a more realistic simulation that takes into account robot's dynamics.The reason why you get a weird behavior is probably that the gains are not well tuned. I would also consider adding gravity compensation for the manipulator (there should be a plugin in Gazebo doing it). Otherwise, if you do not care about the dynamics, simply unset the PID gains and forget about the error!
Running the following launch file results in spawning the robot in the origin (x, y, z= 0, 0, 0) of the world, even though the x, y, z location is set to non zero values in diffbot_gazebo/launch/diffbot_view.launch.