How can acceleration and deceleration ramps be set for a differential drive robot?

asked 2019-01-11 02:40:38 -0500

curi_ROS gravatar image

I am trying to control a differential drive robot by using the JointVelocityController. The controller seems to be tracking the commands well when I just use P (P=1) controller with simple velocity limits. The output velocity is exactly the commanded velocity, without any ramps.

My goal is to avoid really steep ramps. I thought using acceleration limits on the controllers will allow me to modify the ramping. However, when acceleration limits are added into the mix, the bot doesn't or decelerate or stop.

While accelerating: It reaches the command value 0.06 m/s but then hits the max velocity limit of 0.2 m/s.

When the controller receives the command velocity 0 m/s, the bot doesn't stop at all, but instead maintains the max velocity limit of 0.2 m/s.

I checked the odometry and communication, and they seem fine. Below is the config file:

robot_joint_publisher:
  type: "joint_state_controller/JointStateController"
  publish_rate: 100 

left_wheel_controller:
  type: "velocity_controllers/JointVelocityController"
  joint: main_left_wheel
  pid:
    p: 1
    i: 0.0
    i_clamp: 0
    d: 0

right_wheel_controller:
  type: "velocity_controllers/JointVelocityController"
  joint: main_right_wheel
  pid:
    p: 1
    i: 0.0
    i_clamp: 0
    d: 0

joint_limits:
  main_left_wheel:
    has_velocity_limits: true
    max_velocity: 0.2
    has_acceleration_limits: false
    max_acceleration: 0.2
    has_jerk_limits: false
    max_jerk: 0.2
#has_effort_limits: false
#max_effort: 1.0



  main_right_wheel:
    has_velocity_limits: true
    max_velocity: 0.2
    has_acceleration_limits: false
    max_acceleration: 0.2
    has_jerk_limits: false
    max_jerk: 0.2
#has_effort_limits: false
#max_effort: 1.0

loop_hz: 100

My aim is to navigate autonomously but for that I need to make sure that the command velocities are controlled and sent over a long time, rather than being sent immediately. How can this be achieved? I don't want to use YOCS velocity smoother, if I can help it.

edit retag flag offensive close merge delete

Comments

You're using joint_velocity_controller/JointVelocityController and that is a so called ForwardCommandController. There is no real control there, just passthrough of the setpoint. That would be why you see the step on the output.

The assumption for these types of controllers ..

gvdhoorn gravatar image gvdhoorn  ( 2019-01-11 02:55:37 -0500 )edit

.. is that there is an underlying controller (in the hardware, or a further software system) communicated with by the hw interface that does the actual control. The ros_controllers controller merely acts as an abstraction.

I know this isn't obvious from the outside, but see the comments in ..

gvdhoorn gravatar image gvdhoorn  ( 2019-01-11 02:57:19 -0500 )edit

.. the source here.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-11 02:57:34 -0500 )edit

So does the PID control of a Joint Velocity Controller also not have any effect on the commanded value?

curi_ROS gravatar image curi_ROS  ( 2019-01-11 03:02:00 -0500 )edit

If you're referring to the gains, then if I understand everything correctly: no. At least not with ForwardCommandControllers.

Btw: I've posted this as a comment as it's not an answer. I merely wanted to explain what I believe you see happening.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-11 03:03:46 -0500 )edit