Allows user to set PID parameters from network tables and update the motor configurations on updates. Also monitors status information from motors to aid tuning.
More...
#include <nt_motor_pid_tuner.h>
Allows user to set PID parameters from network tables and update the motor configurations on updates. Also monitors status information from motors to aid tuning.
- Note
- This runs a background thread to read statuses of motors without calling repeatedly
◆ NTMotorPIDTuner()
NTMotorPIDTuner::NTMotorPIDTuner |
( |
const std::string & |
tableName, |
|
|
std::initializer_list< ctre::phoenix::motorcontrol::can::BaseTalon * > |
motors, |
|
|
unsigned |
pidSlot, |
|
|
ClosedLoopSensorConversions |
sensorConversions = {} |
|
) |
| |
Construct a new NTMotorPIDTuner object.
- Parameters
-
tableName | Root table in which to make tuning and status keys |
motors | Pointers to motors that should be monitored and configured. Can be one motor if only one motor uses the control loop parameters |
pidSlot | PID slot to save tunes into |
sensorConversions | Sensor conversion factors to make status values human readable |
◆ ~NTMotorPIDTuner()
NTMotorPIDTuner::~NTMotorPIDTuner |
( |
| ) |
|
◆ UpdateClosedLoopMonitoringThread()
void NTMotorPIDTuner::UpdateClosedLoopMonitoringThread |
( |
| ) |
|
|
private |
Update statuses from all motors.
◆ m_pidSlot
const unsigned argos_lib::NTMotorPIDTuner::m_pidSlot |
|
private |
PID slot index actively used on motors.
◆ m_pMotors
const std::vector<ctre::phoenix::motorcontrol::can::BaseTalon*> argos_lib::NTMotorPIDTuner::m_pMotors |
|
private |
Motors being configured and monitored.
◆ m_pntTable
std::shared_ptr<nt::NetworkTable> argos_lib::NTMotorPIDTuner::m_pntTable |
|
private |
Network table containing status and tuning keys.
◆ m_sensorConversions
Sensor conversion factors used to translate raw sensor readings.
◆ m_statusUpdateThread
std::thread argos_lib::NTMotorPIDTuner::m_statusUpdateThread |
|
private |
Thread monitoring motors.
◆ m_threadMutex
std::mutex argos_lib::NTMotorPIDTuner::m_threadMutex |
|
private |
Lock to aid notifying thread of stop.
◆ m_threadStopCv
std::condition_variable argos_lib::NTMotorPIDTuner::m_threadStopCv |
|
private |
Used to notify thread to stop at shutdown.
◆ m_updateSubscriber
Subscriber to manage all updates from user inputs through network tables.
The documentation for this class was generated from the following files: