HoloLib
High-performance holonomic (X-Drive) control library for VEX V5
Loading...
Searching...
No Matches
ModularLift Class Reference

A modular controller for various lift mechanisms. More...

#include <modular_lift.h>

Public Member Functions

 ModularLift (const std::vector< LiftMotorConfig > &m_configs, LiftMechanism t, LiftConfig c)
 Construct a new ModularLift object.
 
 ~ModularLift ()
 Destroy the ModularLift object.
 
float getLiftRadians (float motor_degrees)
 Convert raw motor degrees into lift arm radians (or meters for cascade).
 
void setPayload (float mass_kg)
 Set the mass of the current payload to update feed-forward calculations dynamically.
 
float calculateFeedforward (float current_motor_degrees)
 Calculate the required feed-forward voltage to hold the lift at its current position.
 
void moveTo (float target_motor_degrees)
 Command the lift to move to a target position.
 
void cancel ()
 Cancel the current movement command.
 
void waitUntilDone ()
 Block the current thread until the lift reaches its target position.
 
bool isRunning ()
 Check if the lift is currently trying to reach a target position.
 

Detailed Description

A modular controller for various lift mechanisms.

Handles background task processing, feed-forward calculations based on physics, and LQR/state-feedback control for accurate positioning.

Definition at line 55 of file modular_lift.h.

Constructor & Destructor Documentation

◆ ModularLift()

ModularLift::ModularLift ( const std::vector< LiftMotorConfig > &  m_configs,
LiftMechanism  t,
LiftConfig  c 
)

Construct a new ModularLift object.

Parameters
m_configsVector of motor configurations for the lift.
tThe type of lift mechanism (e.g. FOUR_BAR, CASCADE).
cThe configuration containing physical constants and control gains.

◆ ~ModularLift()

ModularLift::~ModularLift ( )

Destroy the ModularLift object.

Cleans up the background task and associated resources.

Member Function Documentation

◆ getLiftRadians()

float ModularLift::getLiftRadians ( float  motor_degrees)

Convert raw motor degrees into lift arm radians (or meters for cascade).

Parameters
motor_degreesThe raw sensor value in degrees.
Returns
float The calculated position.

◆ setPayload()

void ModularLift::setPayload ( float  mass_kg)

Set the mass of the current payload to update feed-forward calculations dynamically.

Parameters
mass_kgMass of the payload in kilograms.

◆ calculateFeedforward()

float ModularLift::calculateFeedforward ( float  current_motor_degrees)

Calculate the required feed-forward voltage to hold the lift at its current position.

Parameters
current_motor_degreesThe current position of the lift.
Returns
float The calculated feed-forward voltage (in millivolts or specific units).

◆ moveTo()

void ModularLift::moveTo ( float  target_motor_degrees)

Command the lift to move to a target position.

Parameters
target_motor_degreesThe target position in motor degrees.

◆ cancel()

void ModularLift::cancel ( )

Cancel the current movement command.

◆ waitUntilDone()

void ModularLift::waitUntilDone ( )

Block the current thread until the lift reaches its target position.

◆ isRunning()

bool ModularLift::isRunning ( )

Check if the lift is currently trying to reach a target position.

Returns
true if running, false otherwise.