6#include <rev/SparkMax.h>
7#include <rev/config/SparkMaxConfig.h>
8#include <rev/sim/SparkMaxSim.h>
11#include "valkyrie/controllers/BaseController.h"
15enum NeoControllerType { NEO, NEO_550 };
19 NeoController(valor::NeoControllerType,
int canID, valor::NeutralMode mode,
bool inverted);
21 static constexpr frc::DCMotor getMotorSpec(NeoControllerType controllerType) {
22 switch (controllerType) {
24 return frc::DCMotor::NEO550();
26 return frc::DCMotor::NEO();
30 void ApplyConfig()
override;
36 units::turns_per_second_t
GetSpeed()
const override;
38 void SetEncoderPosition(units::turn_t position)
override;
40 units::turn_t GetAbsoluteEncoderPosition()
const override;
42 void SetContinuousWrap(
bool wrap,
bool saveImmediately =
false);
44 void PositionSetter(units::turn_t positon, Output feedforward,
int slot = 0)
override;
45 void SpeedSetter(units::turns_per_second_t speed, Output feedforward,
int slot = 0)
override;
51 void SetForwardLimit(units::turn_t forward,
bool saveImmediately =
false)
override;
53 void SetReverseLimit(units::turn_t reverse,
bool saveImmediately =
false)
override;
55 void SetGearRatios(
double rotorToSensor,
double sensorToMech,
bool saveImmediately =
false)
override;
57 void SetCurrentLimits(units::ampere_t statorCurrentLimit,
bool saveImmediately =
false);
59 void SetNeutralMode(valor::NeutralMode mode,
bool saveImmediately =
false)
override;
61 void SetOpenLoopRamp(units::second_t time,
bool saveImmediately =
false)
override;
63 void PowerSetter(Output out)
override;
67 units::volt_t CalculateAppliedVoltage()
override;
69 using BaseController::SetSimState;
70 void SetSimState(units::turn_t pos, units::turns_per_second_t vel, units::turns_per_second_squared_t accel)
override;
71 void SetSimState(frc::sim::DCMotorSim&)
override;
72 void SetSimState(frc::sim::FlywheelSim&)
override;
75 static constexpr units::ampere_t STATOR_CURRENT_LIMIT = 40_A;
79 rev::spark::SparkMaxConfig config;
80 std::unique_ptr<rev::spark::SparkMax> followerMotor;
81 rev::spark::SparkMaxSim sim;
BaseController(frc::DCMotor _motorSpec)
Construct a new Valor Controller object.
Definition BaseController.h:65
void SpeedSetter(units::turns_per_second_t speed, Output feedforward, int slot=0) override
Send the motor to a specific speed.
units::turns_per_second_t GetSpeed() const override
Get the motors speed.
units::ampere_t GetCurrent() const override
Get the motors output current.
units::turn_t GetPosition() const override
Get the motors position.
void SetGearRatios(double rotorToSensor, double sensorToMech, bool saveImmediately=false) override
Set the gear ratios for the motor.
void PositionSetter(units::turn_t positon, Output feedforward, int slot=0) override
Send the motor to a specific position.
void SetForwardLimit(units::turn_t forward, bool saveImmediately=false) override
Set the forward soft limit for the motor.
void SetNeutralMode(valor::NeutralMode mode, bool saveImmediately=false) override
Set the neutral mode of the motor.
void SetReverseLimit(units::turn_t reverse, bool saveImmediately=false) override
Set the reverse soft limit for the motor.
void SetupFollower(int canID, bool followerInverted=false) override
If a motor is paired with another motor, setup that other motor as a follower.
void LoggablePeriodic() override
Periodic callback for logging updates.
void SetPIDF(valor::PIDF<> pidf, int slot=0, bool saveImmediately=false) override
Change the PIDF values for the motor.
Container to hold PID and feed forward values for the motor controller.
Definition PIDF.h:26