Quote:
Originally Posted by Tparbotmail
The question I have is can this work well with the other classes, like arcade.
|
The RobotDrive arcadeDrive(double moveValue, double rotateValue) method can be used. The rotateValue would be derived from the yaw value from the navX-MXP. Since rotateValue is in units of -1 to 1, this value should be acquired from a PID controller. The navX-MXP AHRS class implements the PIDSource interface. So you can pass the AHRS class instance into the constructor of your PIDController object. Then, whenever you want to call arcadeDrive(), you'd ask your PID controller for it's latest output value, and pass that as the rotateValue to arcadeDrive().
To rotate in place, the moveValue would be 0, the rotateValue would be the output from the PID controller.
To drive straight (or rotate while moving), the moveValue would be the speed to move ahead, and the rotateValue would be the output from the PID controller.