Skip to content

Arm

The arm subsystem is for a single arm. It can be used to move to a position and respond to manual commands.

To create an arm subsystem, you can use the following code:

wom::Arm *arm = new wom::Arm(config); // config is a ArmConfig

Parameters

TypeNameDescriptionSee Also
wom::ArmConfigconfigThe configuration for the arm

Config

TypeNameDescriptionSee Also
std::stringpathThe path to the arm in the NT tables
wom::GearboxleftGearboxThe left gearbox for the arm
wom::GearboxrightGearboxThe right gearbox for the arm
wom::CANSparkMaxEncoderarmEncoderThe encoder for the arm
wom::utils::PIDConfig<units::radian, units::volt>pidConfigThe PID configuration for the armPID Config
wom::utils::PIDConfig<units::radians_per_second, units::volt>velocityConfigThe velocity PID configuration for the armPID Config
units::kilogram_tarmMassThe mass of the arm
units::kilogram_tloadMassThe mass of the load
units::meter_tarmLengthThe length of the arm
units::radian_tminAngleThe minimum angle of the arm
units::radian_tmaxAngleThe maximum angle of the arm
units::radian_tinitialAngleThe initial angle of the arm
units::radian_tangleOffsetThe angle offset of the arm

States

wom::ArmState is an enum of states for the arm.

NameValueDescription
kIdle0The arm is idle
kAngle1The arm is in angle mode
kRaw2The arm is in raw mode
kVelocity3The arm is in velocity mode

Methods

SetIdle

Sets the arm to idle mode.

void SetIdle();

Usage

arm->SetIdle();

SetAngle

Sets the arm to angle mode.

void SetAngle(units::radian_t angle);

Usage

arm->SetAngle(90_deg);

SetRaw

Sets the arm to raw mode.

void SetRaw(units::volt_t voltage);

Usage

arm->SetRaw(12_V);

SetVelocity

Sets the arm to velocity mode.

void SetVelocity(units::radians_per_second_t velocity);

Usage

arm->SetVelocity(100_rad_per_s);

SetState

Sets the state of the arm.

void SetState(wom::ArmState state);

See States for the possible states.

Usage

arm->SetState(wom::ArmState::kAngle);

SetArmSpeedLimit

Sets the arm speed limit.

void SetArmSpeedLimit(double limit);

Usage

arm->SetArmSpeedLimit(0.5);

GetConfig

Returns the arm config.

wom::ArmConfig GetConfig();

Usage

wom::ArmConfig config = arm->GetConfig();

GetAngle

Returns the arm angle.

units::radian_t GetAngle();

Usage

units::radian_t angle = arm->GetAngle();

MaxSpeed

Returns the maximum speed of the arm.

units::radians_per_second_t MaxSpeed();

Usage

units::radians_per_second_t maxSpeed = arm->MaxSpeed();

GetArmVelocity

Returns the arm velocity.

units::radians_per_second_t GetArmVelocity();

Usage

units::radians_per_second_t velocity = arm->GetArmVelocity();

IsStable

Returns whether the arm is stable.

bool IsStable();

Usage

bool stable = arm->IsStable();