RobotnikAutomation / summit_xl_sim

Packages for the simulation of the Summit XL, Summit XL HL and Summit-X (including X-WAM) robots
BSD 2-Clause "Simplified" License
67 stars 41 forks source link

Tuning PID in gazebo for SUMMIT XL Robot #30

Open Eswar1991 opened 4 years ago

Eswar1991 commented 4 years ago

Hi all, We are trying to move SUMMIT XL robot in a straight line and circle in gazebo. In connection with this task, we used PID controller for wheel actuation joints to obtain accurate output motion and response.

For this purpose, we have changed the launch files of summit xl robot to tune the pid gains as shown below:

  <param name="/robot/gazebo_ros_control/pid_gains/$(arg prefix)front_right_wheel_joint/i" type="double" value="$(arg i)" />
  <param name="/robot/gazebo_ros_control/pid_gains/$(arg prefix)front_right_wheel_joint/d" type="double" value="$(arg d)" />

  <param name="/robot/gazebo_ros_control/pid_gains/$(arg prefix)front_left_wheel_joint/p" type="double" value="$(arg p)" />
  <param name="/robot/gazebo_ros_control/pid_gains/$(arg prefix)front_left_wheel_joint/i" type="double" value="$(arg i)" />
  <param name="/robot/gazebo_ros_control/pid_gains/$(arg prefix)front_left_wheel_joint/d" type="double" value="$(arg d)" />

  <param name="/robot/gazebo_ros_control/pid_gains/robot_back_right_wheel_joint/p" type="double" value="$(arg p)" />
  <param name="/robot/gazebo_ros_control/pid_gains/robot_back_right_wheel_joint/i" type="double" value="$(arg i)" />
  <param name="/robot/gazebo_ros_control/pid_gains/robot_back_right_wheel_joint/d" type="double" value="$(arg d)" />

  <param name="/robot/gazebo_ros_control/pid_gains/robot_back_left_wheel_joint/p" type="double" value="$(arg p)" />
  <param name="/robot/gazebo_ros_control/pid_gains/robot_back_left_wheel_joint/i" type="double" value="$(arg i)" />
  <param name="/robot/gazebo_ros_control/pid_gains/robot_back_left_wheel_joint/d" type="double" value="$(arg d)" />

However, the outputs are not desirable. The effect of d-gain is to mitigate the oscillations in response patterns of velocity, which is not happening.

image

In both planar and differential drive plugins, it can be seen that the response patterns oscillates, and it doesn't reduce even by increasing d-gain.

For some values of p (>=100) with i & d being zero, the robot moves/ oscillates around the finish point, although the motion is complete.

Please see the below gif where the robot moves in a circle and after reaching the finsh point, it oscillates about that point (p=100, i=0, d=0)

https://lh3.googleusercontent.com/-K-9B7Z6JKZM/XuSAtjxyopI/AAAAAAAAAzQ/GQo42t1xkRMtWb1GvtGmQmNNkxQo14H0QCK8BGAsYHg/s0/gif2.gif

With reduced value of p, this behavior vanishes, but the circle formed is of greater dimension than the actual... With both p and d enabled, the robot begins to oscillate at the start itself. p:100 i:0 d:10 https://lh3.googleusercontent.com/-K-0_LrgqTR0/XuSBNUx0urI/AAAAAAAAAzo/x-gdf77g14cqAmhhKIurU7czDIrGK_5TgCK8BGAsYHg/s0/gif3.gif

We are being confused with this, as these behaviours are new and not getting aligned with our knowledge on PID Control theory. Is the summit xl being properly configured for manual tuning of PID gains in simulation? Is there any problem in this configuration? Or, do we need to change the approach we used? Is it preferrable to do PID tuning in gazebo?

Any help on this issue would be appreciated.

jgomezgadea commented 4 years ago

Hi @Eswar1991 ,

We are having a lot of problems with gazebo physics, we also have this one.

To correct that, actually, our simulation has a fake control of the wheels. Our purpose of the simulation is to test different algorithms that can work using the cmd_vel topic and odometry, so that fake simulation is not using any of the PID parameters.

Sorry for the inconvenience.