Skip to content

Extended DifferentialDrive class to use IMU and PID to drive straight when using arcade drive #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kensthilaire
Copy link

We've noticed that the XRP is unable to drive straight due to surface textures, friction with the rollers, etc. Students find it frustrating that they have a hard time controlling the XRP, especially with the new support for gamepad control. I had previously added behavior at the application level to use the IMU with PID to allow the XRP to maintain a constant heading and thought that it would be better if the XRP library supported this capability natively.

The proposed changes extend the DifferentialDrive class to allow it to drive straight under arcade control. When enabled by the presence of the IMU parameter during instantiation, the new behavior will maintain a course heading when driving straight (turn value of 0.0). If a turn is requested, the new behavior will set a turning indicator and apply the derived left/right motor speeds without correction. Then once the turn value is 0.0 again, the heading will be reset based and the XRP will follow this new course heading until another turn is requested.

No attempt was made to refactor either the straight() or turn() behavior to match the arcade() changes, but that can be easily done so that the implementations better match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant