4am-robotics / cob_control

The cob_control stack includes packages that are used to do low level control tasks with Care-O-bot hardware over ROS.
www.care-o-bot.org
Apache License 2.0
34 stars 62 forks source link

[cob_base_velocity_smoother] sawtooth behavior #92

Open fmessmer opened 8 years ago

fmessmer commented 8 years ago

I (still) think this is worth creating an issue: @ipa-bnm @ipa-fmw

When investigating the base command pipeline (twist_mux -> velocity_smoother -> control_plugin -> odometry_plugin), I found the following behavior for the "new" velocity smoother.

Tested with a cpp-node that publishes a sine signal onto a geometry_msgs::Twist topic (see #93) roslaunch cob_bringup velocity_smoother.launch robot:=cob4-1

100Hz smoother_100hz

50 Hz smoother_50hz

30Hz smoother_30hz

Maybe it's just a matter of improving the configuration....

@fmessmer FYI

fmessmer commented 8 years ago

What it does well is smoothing back to stop in case the publisher stops publishing

30Hz smoother_stop_command

fmessmer commented 8 years ago

For comparison this is the behavor of the "old" cob_base_velocity_smoother (in it's default configuration): rosrun cob_base_velocity_smoother cob_base_velocity_smoother

100Hz old_smoother_100hz

50Hz old_smoother_50hz

30Hz old_smoother_30hz

fmessmer commented 8 years ago

What the "old" smoother doesn't do well is smoothing back to 0.0: old_smoother_stop_command

fmessmer commented 8 years ago

The "new" smoother's publish rate is set to 100.0 Hz The "old" smoother's publish rate is set to 30.0 Hz

fmessmer commented 7 years ago

After some discussions with @ipa-bnm and @ipa-mdl, I see the point in the current implementation of cob_base_velocity_smoother as it is not really supposed to "smooth-out" steps/jumps in the raw input signal but limit the input only in case it's surpassing either the velocity limit or the acceleration limit. Otherwise it tries to follow the input signal as fast as possible - and as soon as the desired (input) velocity is reached keep publishing them.

Quoting @ipa-bnm:

Repeated publishing of the target velocity should not make a difference for the underlying base_twist_controller, as the input for the base_twist_controller would be the same if only published once...only that with the cob_base_velocity_smoother velocity and acceleration limits can be guaranteed on the Cartesian velocity!

If a real smoothing is desired/needed, the only possible way would be to introduce some lag, e.g. PT1 controller, as the "direction" of the input cannot be predicted.

Still, https://github.com/ipa320/cob_control/pull/133 introduces some cleanups and consitency fixes for the cob_base_velocity_smoother

fmessmer commented 7 years ago

Basically the question is: Are we ok with the described non-continuous "sawtooth" behaviour in the input signal of the base_twist_controller? The cob_base_velocity_smoother then would rather act as a limiter interface operating on the Cartesian velocity level. Maybe we could add this input limiting (i.e. acceleration limiting) to the base_twist_controller directly - saving one subscribe-publish-cycle

Or do we need something continuous, i.e. "stetig", as input for the base_twist_controller? I guess atm only input Cartesian and output joint velocities are limitable in base_twist_controller.

mathias-luedtke commented 7 years ago

I guess atm only input Cartesian and output joint velocities are limitable in base_twist_controller.

Only output velocities get limited. Drive velolcity by velocity limit, steer velocity by velocity and acceleration limit.

Are we ok with the described non-continuous "sawtooth" behaviour in the input signal of the base_twist_controller?

Can you prepare plots of the controllers response?

fmessmer commented 7 years ago

I think we definitely need to solve this together with "tuning" the configuration of the base_twist_controller... I will prepare configurability (see https://github.com/ipa320/cob_control/issues/91) and plots tomorrow...

fmessmer commented 7 years ago

Only output velocities get limited. Drive velocity by velocity limit, steer velocity by velocity and acceleration limit.

@ipa-mdl @ipa-mig @ipa-bnm FYI

Here is some information about limiting I found in the base_twist_controller:

mathias-luedtke commented 7 years ago

Not sure why we have d_phi_max AND max_steer_rate..

fmessmer commented 7 years ago

Here is a comparison of using the cob_base_velocity_smoother vs. not using the cob_base_velocity_smoother (ipa320/indigo_dev implementation/configuration):

  1. Step Linear 10Hz (wheels oriented in rotational direction) published to base_twist_controller directly step_linear_post_rotation_odometry
  2. Step Linear 10Hz (wheels oriented in rotational direction) published to velocity_smoother 50Hz step_linear_post_rotation_10hz_smoother_50hz
  3. Step Rotation 10Hz (wheels oriented in linear direction) published to base_twist_controller directly step_rotation_post_linear_odometry
  4. Step Rotation 10Hz (wheels oriented in linear direction) published to velocity_smoother 50Hz step_rotation_post_linear_10hz_smoother_50hz

From the plots, it seems that the smoother rather "slows down" the controller, for one due the additional pub-sub-cycle for another due to acceleration limiting, i.e. the ramp of the odometry is steeper, i.e. more reactive, without the smoother...and it seems that this higher ramp is allowed in the base_twist_controller...

But we need to repeat this experiment on real hardware