3#include <frc/DigitalInput.h>
4#include <frc/trajectory/TrapezoidProfile.h>
5#include <frc/util/Color8Bit.h>
6#include <frc2/command/CommandPtr.h>
7#include <frc2/command/SubsystemBase.h>
8#include <units/angle.h>
9#include <units/angular_velocity.h>
10#include <units/length.h>
11#include <units/velocity.h>
40 units::compound_unit<Distance, units::inverse<units::seconds>>;
43 units::compound_unit<Velocity, units::inverse<units::seconds>>;
132 std::optional<Distance_t> _absoluteEncoderDistancePerRevolution,
134 std::optional<frc::DigitalInput *> _minLimitSwitch,
135 std::optional<frc::DigitalInput *> _maxLimitSwitch,
bool _reversed,
137 std::optional<std::function<std::string(
Distance_t)>>
139 std::function<
bool()> _ignoreLimit,
140 frc::TrapezoidProfile<Distance>::Constraints _profileConstraints)
144 _absoluteEncoderDistancePerRevolution},
161 bool ignoreEncoder =
false) = 0;
170 bool ignoreEncoder =
false) = 0;
245 virtual frc2::CommandPtr
Home() = 0;
virtual void EnablePid()=0
Enable absolute movements.
virtual bool AtLimitSwitchMax()=0
Only check the limit switch for maximum extent.
units::unit_t< Distance > Distance_t
virtual void DisablePid()=0
Stop and disable any in-progress absolute movements.
virtual bool AtMax()=0
Check if axis is at the maximum extent of motion.
virtual frc2::CommandPtr MoveToPositionRelative(Distance_t position)=0
Start moving to the position given the current distance and relative position.
virtual frc2::CommandPtr MoveToPositionAbsolute(Distance_t position)=0
Start moving to the absolute position.
units::compound_unit< Distance, units::inverse< units::seconds > > Velocity
units::compound_unit< Velocity, units::inverse< units::seconds > > Acceleration
virtual Distance_t GetCurrentPosition()=0
Get the current position in terms of converted distance.
virtual bool AtHome()=0
Check if axis is at the mimimum extent of motion.
virtual void Stop()=0
Stop the axis.
virtual void ResetEncoder()=0
Reset encoder back to 0 ticks.
virtual bool IsEnabled()=0
Check if absolute positioning is active.
units::unit_t< Acceleration > Acceleration_t
units::unit_t< Velocity > Velocity_t
virtual frc2::CommandPtr Home()=0
Start the homing sequence.
virtual void RunMotorVelocity(Velocity_t speed, bool ignoreEncoder=false)=0
Run at the given velocity; disables any in-progress absolute movements.
virtual void RunMotorSpeedDefault(bool ignoreEncoder=false)=0
Run at the default motor speed.
virtual void RunMotorPercentage(double percentSpeed, bool ignoreEncoder=false)=0
Run at the given velocity percentage; disables any in-progress absolute movements.
virtual bool AtLimitSwitchMin()=0
Only check the limit switch for mimimum extent.
The configuration for single-axis mechanisms.
frc::TrapezoidProfile< Distance >::Constraints profileConstraints
Motion profile constraints.
Distance_t tolerance
Absolute positioning goal is reached within a range of +/- this value.
Distance_t minDistance
Minimum extent of motion.
Velocity_t defaultSpeed
Default movement speed; used when homing.
bool reversed
Motion is reversed if true; only used for simulations currently.
Distance_t encoderDistancePerRevolution
double velocityScalar
Multiply the motor output by this factor.
std::function< bool()> ignoreLimit
If true, soft limits will be disabled.
Distance_t maxDistance
Maximum extent of motion.
std::optional< std::function< std::string(Distance_t)> > conversionFunction
Optional. Will be called on each loop; useful for outputting values to SmartDashboard in a different ...
SingleAxisMechanism mechanismConfig
Simulation configuration.
std::optional< frc::DigitalInput * > minLimitSwitch
Optional. Will check for the limit switch being active when seeing if at limit.
std::optional< Distance_t > absoluteEncoderDistancePerRevolution
Similar to encoderDistancePerRevolution but using the absolute encoder.
std::optional< frc::DigitalInput * > maxLimitSwitch
Optional. Will check for the limit switch being active when seeing if at limit.
SingleAxisConfig(Distance_t _minDistance, Distance_t _maxDistance, Distance_t _encoderDistancePerRevolution, std::optional< Distance_t > _absoluteEncoderDistancePerRevolution, Velocity_t _defaultSpeed, double _velocityScalar, Distance_t _tolerance, std::optional< frc::DigitalInput * > _minLimitSwitch, std::optional< frc::DigitalInput * > _maxLimitSwitch, bool _reversed, SingleAxisMechanism _mechanismConfig, std::optional< std::function< std::string(Distance_t)> > _conversionFunction, std::function< bool()> _ignoreLimit, frc::TrapezoidProfile< Distance >::Constraints _profileConstraints)
Describes the axis for simulation.
units::meter_t minimumLength
units::degree_t minimumAngle