Class SensorlessArm

  • All Implemented Interfaces:
    Sendable, Subsystem

    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.
    • Constructor Detail

      • SensorlessArm

        public SensorlessArm​(SpeedController motor,
                             DigitalInput loweredLimitSensor,
                             DigitalInput raisedLimitSensor,
                             double speed,
                             double feedForward)
        Create a SensorlessArm
        Parameters:
        motor - Arm motor
        loweredLimitSensor - Limit sensor at the bottom of the arm's range of motion
        raisedLimitSensor - Limit sensor at the top of the arm's range of motion
        speed - How fast the arm should move downwards as a percentage output
        feedForward - 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