|
Re: How do you use the WPILib?
What classes do you use the most?
This year, we used the CANTalon in place of Encoder, PIDController, and DigitalInput.
SampleRobot
CANTalon
Solenoid
Timer
Do you edit any of the provided classes?
We edited the PIDController class to include dt in the I accumulation and error derivative calculations. In other cases, we replace classes. Some of the interfaces we've written already had equivalents in WPILib, but we didn't use the provided ones because we either didn't know about them, like the Preferences class, or we didn't like their implementation, like NetworkTables. There could also be some FUD with respect to the command-based paradigm versus our state machine classes (although we approached it differently than WPILib).
Do you extend any of the provided classes?
We wrap motor controllers in a GearBox template class when they control motors in the same physical gearbox. It allows us to control them as a single unit and includes an interface for shifting, encoders, and PID control.
What features do you wish WPILib had?
With regards to external features, one of my students wants the CANTalon PID interface and PIDController class to match so that one can switch between them easily.
Most of my complaints are about WPILib's implementation, and I'm trying to get them fixed. Const correctness was an issue, but a patch got accepted for that recently. There's also thread safety, which is being C++11'ified (if that's a thing) for maintainability. I wish WPILib handled ownership of objects properly with move semantics. Currently, one can pass pointers into classes like RobotDrive and still need to delete them externally later. (At least that's what the examples do.) It makes more sense for the RobotDrive instance to take ownership of them via smart pointers. I'm told there will be patches for that ready for review soon. The interfaces for classes could be smaller as well. I think some of it is common behavior and could be refactored back into its respective base classes.
|