Elevator
The elevator subsystem is for a single elevator. It can be used to move to a position and respond to manual commands.
To create an elevator subsystem, you can use the following code:
Parameters
Type | Name | Description | See Also |
---|---|---|---|
wom::ElevatorConfig | config | The configuration for the elevator |
Config
Type | Name | Description | See Also |
---|---|---|---|
std::string | path | The path to the elevator in the NT tables | |
wom::Gearbox | leftGearbox | The left gearbox for the elevator | |
wom::Gearbox | rightGearbox | The right gearbox for the elevator | |
wom::CANSparkMaxEncoder | encoder | The encoder for the elevator | |
frc::DigitalInput* | topSensor | The top sensor for the elevator | |
frc::DigitalInput* | bottomSensor | The bottom sensor for the elevator | |
units::meter_t | radius | The radius of the elevator | |
units::kilogram_t | mass | The mass of the elevator | |
units::meter_t | maxHeight | The maximum height of the elevator | |
units::meter_t | minHeight | The minimum height of the elevator | |
units::meter_t | initialHeight | The initial height of the elevator | |
wom::PIDConfig<units::meter, units::volt> | pid | The PID configuration for the elevator | PID Config |
wom::PIDConfig<units::meters_per_second, units::volt> | velocityPID | The velocity PID configuration for the elevator | PID Config |
States
wom::ElevatorState is an enum of states for the elevator.
Name | Value | Description |
---|---|---|
kIdle | 0 | The elevator is idle |
kPID | 1 | The elevator is in PID mode |
kManual | 2 | The elevator is in manual mode |
kVelocity | 3 | The elevator is in velocity mode |
Methods
SetManual
Sets the elevator to manual mode.
Usage
SetPID
Sets the elevator to PID mode.
Usage
SetState
Sets the state of the elevator.
See States for the possible states.
Usage
SetVelocity
Sets the elevator to velocity mode.
Usage
GetElevatorEncoderPos
Returns the elevator encoder position.
Usage
SetElevatorSpeedLimit
Sets the elevator speed limit.
Usage
GetConfig
Gets the config of the elevator.
Returns wom::ElevatorConfig
(see above)
Usage
IsStable
Returns whether the elevator is stable.
Usage
GetState
Returns the state of the elevator.
Usage
GetHeight
Returns the height of the elevator.
Usage
MaxSpeed
Returns the maximum speed of the elevator.
Usage
GetElevatorVelocity
Returns the elevator velocity.