3#include <ctre/phoenix6/CANcoder.hpp>
4#include <ctre/phoenix6/TalonFX.hpp>
6#include "rmb/motorcontrol/AngularPositionController.h"
8#include "units/angle.h"
9#include "units/angular_acceleration.h"
10#include "units/angular_velocity.h"
11#include "units/base.h"
12#include "units/current.h"
13#include "units/time.h"
18namespace TalonFXPositionControllerHelper {
21 bool inverted =
false;
23 double minOutput = -1.0,
95 units::second_t rampRate = 0.0_s;
99 double p = 0.0, i = 0.0, d = 0.0, ff = 0.0;
104 units::second_t rampRate = 0.0_s;
109 units::radian_t minPosition =
110 -std::numeric_limits<units::radian_t>::infinity();
111 units::radian_t maxPosition =
112 std::numeric_limits<units::radian_t>::infinity();
114 bool continuousWrap =
122 bool useSmartMotion =
124 units::radians_per_second_t maxVelocity = 0.0_rad_per_s,
125 minVelocity = 0.0_rad_per_s;
126 units::radians_per_second_squared_t maxAcceleration = 0.0_rad_per_s_sq;
129enum LimitSwitchConfig { Disabled, NormalyOpen, NormalyClosed };
132 double sensorToMechanismRatio = 1.0;
133 LimitSwitchConfig forwardSwitch = Disabled, reverseSwitch = Disabled;
139 units::radian_t magnetOffset = 0.0_rad;
152 std::optional<TalonFXPositionControllerHelper::CANCoderConfig>
244 mutable ctre::phoenix6::hardware::TalonFX motorcontroller;
247 mutable std::optional<ctre::phoenix6::hardware::CANcoder> canCoder;
251 float sensorToMechanismRatio = 0.0;
253 const bool usingCANCoder;
Definition AngularPositionController.h:19
Definition TalonFXPositionController.h:143
TalonFXPositionController(const CreateInfo &createInfo)
units::radian_t getMaxPosition() const override
units::radian_t getTargetPosition() const override
units::radian_t getPosition() const override
void follow(const TalonFXPositionController &parentController, bool inverted)
virtual double getPower() const override
units::radian_t getMinPosition() const override
void setPosition(units::radian_t position) override
units::radians_per_second_t getVelocity() const override
void setPower(double power) override
units::radian_t getTolerance() const override
Definition TalonFXPositionController.h:234
void setEncoderPosition(units::radian_t position=0_rad) override
the master namespace of librmb
Definition LogitechGamepad.h:9
Definition TalonFXPositionController.h:145
Definition TalonFXPositionController.h:136
describes current limits for the motor. This was copied (and slightly modified to include units:: typ...
Definition TalonFXPositionController.h:30
units::second_t supplyTimeThreshold
Allows unlimited current for a period of time before current limiting occurs. Current threshold is th...
Definition TalonFXPositionController.h:91
units::ampere_t supplyCurrentLimit
The amount of supply current allowed. This is only applicable for non-torque current control modes....
Definition TalonFXPositionController.h:61
units::ampere_t statorCurrentLimit
The amount of current allowed in the motor (motoring and regen current). This is only applicable for ...
Definition TalonFXPositionController.h:42
bool statorCurrentLimitEnable
Enable motor stator current limiting.
Definition TalonFXPositionController.h:48
bool supplyCurrentLimitEnable
Enable motor supply current limiting.
Definition TalonFXPositionController.h:68
units::ampere_t supplyCurrentThreshold
Delay supply current limiting until current exceeds this threshold for longer than SupplyTimeThreshol...
Definition TalonFXPositionController.h:80
Definition TalonFXPositionController.h:131
Definition TalonFXPositionController.h:19
Definition TalonFXPositionController.h:94
Definition TalonFXPositionController.h:98
Definition TalonFXPositionController.h:121
Definition TalonFXPositionController.h:108