RIT VEXU Core API
|
#include <lift.h>
Classes | |
struct | lift_cfg_t |
Public Member Functions | |
Lift (motor_group &lift_motors, lift_cfg_t &lift_cfg, map< T, double > &setpoint_map, limit *homing_switch=NULL) | |
void | control_continuous (bool up_ctrl, bool down_ctrl) |
void | control_manual (bool up_btn, bool down_btn, int volt_up, int volt_down) |
void | control_setpoints (bool up_step, bool down_step, vector< T > pos_list) |
bool | set_position (T pos) |
bool | set_setpoint (double val) |
double | get_setpoint () |
void | hold () |
void | home () |
bool | get_async () |
void | set_async (bool val) |
void | set_sensor_function (double(*fn_ptr)(void)) |
void | set_sensor_reset (void(*fn_ptr)(void)) |
LIFT A general class for lifts (e.g. 4bar, dr4bar, linear, etc) Uses a PID to hold the lift at a certain height under load, and to move the lift to different heights
|
inline |
Construct the Lift object and begin the background task that controls the lift.
Usage example: /code{.cpp} enum Positions {UP, MID, DOWN}; map<Positions, double> setpt_map { {DOWN, 0.0}, {MID, 0.5}, {UP, 1.0} }; Lift<Positions> my_lift(motors, lift_cfg, setpt_map); /endcode
|
inline |
Control the lift with an "up" button and a "down" button. Use PID to hold the lift when letting go.
up_ctrl | Button controlling the "UP" motion |
down_ctrl | Button controlling the "DOWN" motion |
|
inline |
Control the lift with manual controls (no holding voltage)
up_btn | Raise the lift when true |
down_btn | Lower the lift when true |
volt_up | Motor voltage when raising the lift |
volt_down | Motor voltage when lowering the lift |
|
inline |
Control the lift in "steps". When the "up" button is pressed, the lift will go to the next position as defined by pos_list. Order matters!
up_step | A button that increments the position of the lift. |
down_step | A button that decrements the position of the lift. |
pos_list | A list of positions for the lift to go through. The higher the index, the higher the lift should be (generally). |
|
inline |
|
inline |
|
inline |
Target the class's setpoint. Calculate the PID output and set the lift motors accordingly.
|
inline |
A blocking function that automatically homes the lift based on a sensor or hard stop, and sets the position to 0. A watchdog times out after 3 seconds, to avoid damage.
|
inline |
Enables or disables the background task. Note that running the control functions, or set_position functions will immediately re-enable the task for autonomous use.
val | Whether or not the background thread should run the lift |
|
inline |
Enable the background task, and send the lift to a position, specified by the setpoint map from the constructor.
pos | A lift position enum type |
|
inline |
Creates a custom hook for any other type of sensor to be used on the lift. Example: /code{.cpp} my_lift.set_sensor_function( [](){return my_sensor.position();} ); /endcode
fn_ptr | Pointer to custom sensor function |
|
inline |
Creates a custom hook to reset the sensor used in set_sensor_function(). Example: /code{.cpp} my_lift.set_sensor_reset( my_sensor.resetPosition ); /endcode
|
inline |