7#include <condition_variable>
8#include <initializer_list>
15#include <ctre/phoenix6/core/CoreTalonFX.hpp>
28 template <
class Callable>
30 return toPhysicalUnitsFunction(units::angle::turn_t{1}).
template to<double>();
40 template <
class Callable>
42 return toPhysicalUnitsFunction(units::angle::turn_t{1.0} / units::time::second_t{1.0}).
template to<double>();
62 using BaseTalon = ctre::phoenix6::hardware::core::CoreTalonFX;
74 std::initializer_list<BaseTalon*> motors,
Allows user to set PID parameters from network tables and update the motor configurations on updates....
Definition nt_motor_pid_tuner.h:61
ClosedLoopSensorConversions m_sensorConversions
Sensor conversion factors used to translate raw sensor readings.
Definition nt_motor_pid_tuner.h:90
ctre::phoenix6::hardware::core::CoreTalonFX BaseTalon
Definition nt_motor_pid_tuner.h:62
argos_lib::NTSubscriber m_updateSubscriber
Subscriber to manage all updates from user inputs through network tables.
Definition nt_motor_pid_tuner.h:85
std::mutex m_threadMutex
Lock to aid notifying thread of stop.
Definition nt_motor_pid_tuner.h:92
const unsigned m_pidSlot
PID slot index actively used on motors.
Definition nt_motor_pid_tuner.h:87
std::thread m_statusUpdateThread
Thread monitoring motors.
Definition nt_motor_pid_tuner.h:94
std::shared_ptr< nt::NetworkTable > m_pntTable
Network table containing status and tuning keys.
Definition nt_motor_pid_tuner.h:88
std::condition_variable m_threadStopCv
Used to notify thread to stop at shutdown.
Definition nt_motor_pid_tuner.h:93
~NTMotorPIDTuner()
Destroy the NTMotorPIDTuner object.
Definition nt_motor_pid_tuner.cpp:109
void UpdateClosedLoopMonitoringThread()
Update statuses from all motors.
Definition nt_motor_pid_tuner.cpp:114
ctre::phoenix6::configs::SlotConfigs m_activeConfigs
Current PID configurations.
Definition nt_motor_pid_tuner.h:96
const std::vector< BaseTalon * > m_pMotors
Motors being configured and monitored.
Definition nt_motor_pid_tuner.h:86
Subscribes to Network Tables entry updates and calls a specified callback to use the new value.
Definition nt_subscriber.h:17
Definition swap_controllers_command.h:12
constexpr double GetVelocityConversionFactor(Callable toPhysicalUnitsFunction)
Generates a double value to convert sensor velocity values to physical units represented as a double.
Definition nt_motor_pid_tuner.h:41
constexpr double GetPositionConversionFactor(Callable toPhysicalUnitsFunction)
Generates a double value to convert sensor position values to physical units represented as a double.
Definition nt_motor_pid_tuner.h:29
Conversion factors to aid displaying sensor values as meaningful numbers.
Definition nt_motor_pid_tuner.h:48
double velocity
Multiply by this to convert sensor velocity units to physical units.
Definition nt_motor_pid_tuner.h:50
double setpoint
Multiply by this to convert sensor setpoint units to physical units (should be the same as either pos...
Definition nt_motor_pid_tuner.h:51
double position
Multiply by this to convert sensor position units to physical units.
Definition nt_motor_pid_tuner.h:49