Package ca.retrylife.frc.templates.arms
Class SensorlessArm
- java.lang.Object
-
- edu.wpi.first.wpilibj2.command.SubsystemBase
-
- ca.retrylife.frc.templates.arms.SensorlessArm
-
public class SensorlessArm extends SubsystemBase
The SensorlessArm class is designed to control any type of arm that does not have a rotational sensor (like an encoder or potentiometer). At 5024, we have used these in 2019 (climber) and 2020 (intake). The physical system must consist of an arm that can be in one of two positions, and a limit switch (or other digital input) at each stopping point. Since there is no good sensor for this system, a strong motor must be used, otherwise the arm will not hold its position at all. If the arm needs to hold position, add an encoder.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SensorlessArm.SystemState
-
Constructor Summary
Constructors Constructor Description SensorlessArm(SpeedController motor, DigitalInput loweredLimitSensor, DigitalInput raisedLimitSensor, double speed, double feedForward)
Create a SensorlessArm
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SensorlessArm.SystemState
getLastKnownPosition()
Get the last known position of the armvoid
periodic()
void
setDesiredPosition(SensorlessArm.SystemState position)
Set the desired position for the armvoid
stop()
Stop the arm-
Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystem
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
getCurrentCommand, getDefaultCommand, register, setDefaultCommand, simulationPeriodic
-
-
-
-
Constructor Detail
-
SensorlessArm
public SensorlessArm(SpeedController motor, DigitalInput loweredLimitSensor, DigitalInput raisedLimitSensor, double speed, double feedForward)
Create a SensorlessArm- Parameters:
motor
- Arm motorloweredLimitSensor
- Limit sensor at the bottom of the arm's range of motionraisedLimitSensor
- Limit sensor at the top of the arm's range of motionspeed
- How fast the arm should move downwards as a percentage outputfeedForward
- How much faster the arm should move going up than it should going down
-
-
Method Detail
-
periodic
public void periodic()
-
setDesiredPosition
public void setDesiredPosition(SensorlessArm.SystemState position)
Set the desired position for the arm- Parameters:
position
- Desired position
-
getLastKnownPosition
public SensorlessArm.SystemState getLastKnownPosition()
Get the last known position of the arm- Returns:
- Last position
-
stop
public void stop()
Stop the arm
-
-