LeoRover / leo_simulator

Simulator ROS packages for Leo Rover.
MIT License
15 stars 7 forks source link

Jerky movements while rotating in-place #8

Open sparsh-b opened 2 years ago

sparsh-b commented 2 years ago

Hello @bjsowa @szlachcic !

I've spawned the leo rover in Gazebo using this repo & initiated teleop with keyboard using this repo. When I try to rotate the rover in-place, it doesn't rotate all the time & even when it rotates, it does so jerkily. I'm uploading the video of the motion here.

Description of the video: 1) When I command the rover to rotate continuously (by pressing 'l' key), it starts to rotate but suddenly stops after a short time (Although a non-zero angular.z is continuously being written to the twist msg on cmd_vel topic - As seen in the bottom terminal of the video) 2) Then, I command it to move forward in a straight line (by pressing 'i' key). It moves in a curved line. (Although only linear.x is non-zero in the twist msg on cmd_vel topic - As seen in the bottom terminal of the video) 3) Then, I stop pressing any key but the rover still rotates around (the twist msg has on cmd_vel has no non-zero component during this time period). 4) It looks as if the rover stops executing the commands it receives but accumulates them & resumes executing them at a later point of time.

Can you please help me understand why this is happening & how to fix it? Any help is greatly appreciated!

bjsowa commented 2 years ago

The problem is that the wheels have problems overcoming the static friction, the robot appears to have stopped but there is still torque applied and the integral component of the PID controller increases. Then, when you start driving forward the integral components take a while to decrease, that's why the robot does an arc path.

The friction parameters were fine-tuned to world that uses the ODE cone friction model. You can try our marsyard worlds or you can try this one:

<?xml version="1.0" ?>
<sdf version="1.7">
  <world name="default">
    <physics type="ode">
      <ode>
        <solver>
          <friction_model>cone_model</friction_model>
        </solver>
      </ode>
    </physics>

    <!-- A global light source -->
    <include>
      <uri>model://sun</uri>
    </include>
    <!-- A ground plane -->
    <include>
      <uri>model://ground_plane</uri>
    </include>
  </world>
</sdf>

Save this to a file, then run:

roslaunch leo_gazebo leo_gazebo world_name:=<absolute path to the world file>

The rover still moves a little jerky but it doesn't get stuck anymore when rotating in-place.