support icon indicating copy to clipboard operation
support copied to clipboard

[Feature] Use angular velocity for drivebase control

Open laurensvalk opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. We currently use the gyro only for angular feedback (the P term) but not for angular velocity (the D term).

In some circumstances like driving slowly, using the angular velocity has better results.

So far we haven't done this because it also requires changing the Kd constant to get similar behavior as the normal drivebase.

It also reduces the damping effect induced by the observer for motor speed so we'd have to find another way to suppress oscillations. (E.g. with a secondary higher loop as the user method referenced below achieves).

Additional context Here is a video from Justin Pembroke that demonstrates a wobble when it accelerates straight ahead slowly. He has also indicated that it works better when using drive() where steering is a PD controller over the gyro, which achieves something similar as discussed above.

https://github.com/pybricks/support/assets/12326241/9e6887cd-4d08-4605-8e96-eee6c98991f5

laurensvalk avatar Jul 31 '23 08:07 laurensvalk

See also https://github.com/pybricks/pybricks-micropython/commit/26b8e6247419d42c049db0ab3e326dbf74c1294c

So far we haven't done this because it also requires changing the Kd constant to get similar behavior as the normal drivebase.

We can dynamically change this since we know whether use_gyro is True or False.

laurensvalk avatar Oct 01 '24 09:10 laurensvalk

Although the moment in the middle is probably just the motors reaching their maximum speed.

laurensvalk avatar Oct 01 '24 09:10 laurensvalk