Skip to content

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