RobotDrive + PIDController = possible?

Is it possible to use the RobotDrive class and the PIDController class together so that each drive wheel has PID control?

Last year, my team (2342) used a PID controller to control the steering of our wheels. From my knowledge of a PID controller, I imagine you could, but I am not sure why you would want to. Can you please explain? Have you considered an Alpha-Beta filter?

PID’s are a great way to exert control over motors. The drive wheels are driven by motors. Put the two together…

Specifically, with friction losses and gearbox/pwm/motor variability, low speed robot movement could be enhanced if the drive wheel motors have software PID control. We usually do that by writing our own drive software, but if it can be done with existing libraries, why reinvent the wheel (ha ha).

The PID class requires you to supply a PIDOutput object that actually sets the values. By default the standard motor objects like Jaguar and Victor are already PIDOutput objects. But you can create your own PIDOutput object that works with the PID class and control either the turn rate or the forward speed.

You can see an example of how to do that by looking at the 2010 Image Demo in the list of example programs with the 2010 update. Look at the MyRobot.cpp file and find the SamplePIDOutput class. It’s pretty easy to do. The sample program uses the output of the PID loop to control the turn direction of the robot to keep the target centered in the camera field of view.

Thanks. I’ll give it a try.