Skip to content

Acceleration deacceleration on straight(), Wheel delay, and adjusting built in PID values #2078

Answered by laurensvalk
techcatgato asked this question in Q&A
Discussion options

You must be logged in to vote

The drive base functions all use their own PID controller, so this code builds another on top of that. Two nested or conflicting controllers probably don't give you the desired result. If you'd like to build your own controllers, it is better to power the motors with motor.dc(value) so only your own controller if active.

Alternatively, you can change the P/I/D for the existing controllers to achieve a similar effect.


Then something to think about 💡

error = gyro.heading() - start_angle

...

 derivative = error - last_error

Numerical derivatives like these can be quite inaccurate. What is the mathematical expression for the time derivative of error in your case? Can you compute it exactl…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@techcatgato
Comment options

@techcatgato
Comment options

Answer selected by techcatgato
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants