RIT VEXU Core API
|
#include <flywheel.h>
Public Member Functions | |
Flywheel (vex::motor_group &motors, Feedback &feedback, FeedForward &helper, const double ratio, Filter &filt) | |
double | get_target () const |
double | getRPM () const |
vex::motor_group & | get_motors () const |
void | spin_manual (double speed, directionType dir=fwd) |
void | spin_rpm (double rpm) |
void | stop () |
bool | is_on_target () |
check if the feedback controller thinks the flywheel is on target | |
screen::Page * | Page () const |
Creates a page displaying info about the flywheel. | |
AutoCommand * | SpinRpmCmd (int rpm) |
Creates a new auto command to spin the flywheel at the desired velocity. | |
AutoCommand * | WaitUntilUpToSpeedCmd () |
Creates a new auto command that will hold until the flywheel has its target as defined by its feedback controller. | |
Friends | |
int | spinRPMTask (void *wheelPointer) |
a Flywheel class that handles all control of a high inertia spinning disk It gives multiple options for what control system to use in order to control wheel velocity and functions alerting the user when the flywheel is up to speed. Flywheel is a set and forget class. Once you create it you can call spin_rpm or stop on it at any time and it will take all necessary steps to accomplish this
Flywheel::Flywheel | ( | vex::motor_group & | motors, |
Feedback & | feedback, | ||
FeedForward & | helper, | ||
const double | ratio, | ||
Filter & | filt ) |
Create the Flywheel object using PID + feedforward for control.
motors | pointer to the motors on the fly wheel |
feedback | a feedback controleller |
helper | a feedforward config (only kV is used) to help the feedback controller along |
ratio | ratio of the gears from the motor to the flywheel just multiplies the velocity |
filter | the filter to use to smooth noisy motor readings |
motor_group & Flywheel::get_motors | ( | ) | const |
Returns the motors
double Flywheel::get_target | ( | ) | const |
Return the target_rpm that the flywheel is currently trying to achieve
Return the current value that the target_rpm should be set to
double Flywheel::getRPM | ( | ) | const |
return the velocity of the flywheel
|
inline |
check if the feedback controller thinks the flywheel is on target
screen::Page * Flywheel::Page | ( | ) | const |
Creates a page displaying info about the flywheel.
void Flywheel::spin_manual | ( | double | speed, |
directionType | dir = fwd ) |
Spin motors using voltage; defaults forward at 12 volts FOR USE BY OPCONTROL AND AUTONOMOUS - this only applies if the target_rpm thread is not running
speed | - speed (between -1 and 1) to set the motor |
dir | - direction that the motor moves in; defaults to forward |
Spin motors using voltage; defaults forward at 12 volts FOR USE BY OPCONTROL AND AUTONOMOUS - this only applies if the RPM thread is not running
speed | - speed (between -1 and 1) to set the motor |
dir | - direction that the motor moves in; defaults to forward |
void Flywheel::spin_rpm | ( | double | input_rpm | ) |
starts or sets the target_rpm thread at new value what control scheme is dependent on control_style
rpm | - the target_rpm we want to spin at |
starts or sets the RPM thread at new value what control scheme is dependent on control_style
input_rpm | - set the current RPM |
|
inline |
Creates a new auto command to spin the flywheel at the desired velocity.
rpm | the rpm to spin at |
void Flywheel::stop | ( | ) |
Stops the motors. If manually spinning, this will do nothing just call spin_mainual(0.0) to send 0 volts
stop the RPM thread and the wheel
|
inline |
Creates a new auto command that will hold until the flywheel has its target as defined by its feedback controller.
|
friend |
Runs a thread that keeps track of updating flywheel RPM and controlling it accordingly