How can acceleration and deceleration ramps be set for a differential drive robot?
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.
You're using
joint_velocity_controller/JointVelocityController
and that is a so calledForwardCommandController
. 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 ..
.. 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 ..
.. the source here.
So does the PID control of a Joint Velocity Controller also not have any effect on the commanded value?
If you're referring to the gains, then if I understand everything correctly: no. At least not with
ForwardCommandController
s.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.