Status Signals#
Phoenix Pro expands the functionality of status signals with the introduction of the StatusSignalValue
(Java, C++).
Using Status Signals#
v5 |
// get latest TalonFX selected sensor position
// units are encoder ticks
int sensorPos = m_talonFX.getSelectedSensorPosition();
// latency is unknown
// cannot synchronously wait for new data
// get latest TalonFX selected sensor position
// units are encoder ticks
int sensorPos = m_talonFX.GetSelectedSensorPosition();
// latency is unknown
// cannot synchronously wait for new data
|
Pro |
// acquire a refreshed TalonFX rotor position signal
var rotorPosSignal = m_talonFX.getRotorPosition();
// because we are calling getRotorPosition() every loop,
// we do not need to call refresh()
//rotorPosSignal.refresh();
// retrieve position value that we just refreshed
// units are rotations
var rotorPos = rotorPosSignal.getValue();
// get latency of the signal
var rotorPosLatency = rotorPosSignal.getTimestamp().getLatency();
// synchronously wait 20 ms for new data
rotorPosSignal.waitForUpdate(0.020);
// acquire a refreshed TalonFX rotor position signal
auto& rotorPosSignal = m_talonFX.GetRotorPosition();
// because we are calling GetRotorPosition() every loop,
// we do not need to call Refresh()
//rotorPosSignal.Refresh();
// retrieve position value that we just refreshed
// units are rotations, uses the units library
auto rotorPos = rotorPosSignal.GetValue();
// get latency of the signal
auto rotorPosLatency = rotorPosSignal.GetTimestamp().GetLatency();
// synchronously wait 20 ms for new data
rotorPosSignal.WaitForUpdate(20_ms);
|
Changing Update Frequency (Status Frame Period)#
v5 |
// slow down the Status 2 frame (selected sensor data) to 5 Hz (200ms)
m_talonFX.setStatusFramePeriod(StatusFrameEnhanced.Status_2_Feedback0, 200);
// slow down the Status 2 frame (selected sensor data) to 5 Hz (200ms)
m_talonFX.SetStatusFramePeriod(StatusFrameEnhanced::Status_2_Feedback0, 200);
|
Pro |
// slow down the position signal to 5 Hz
m_talonFX.getPosition().setUpdateFrequency(5);
// slow down the position signal to 5 Hz
m_talonFX.GetPosition().SetUpdateFrequency(5_Hz);
|
Important
Currently in Phoenix Pro, when different status signal frequencies are specified for signals that share a status frame, the last specified frequency is applied to the status frame. As a result, users should apply the slowest status frame frequencies first and the fastest frequencies last.
Common Signals#
Several status signals have changed name or form in Phoenix Pro.
General Signals#
Phoenix 5 |
Phoenix Pro |
---|---|
|
|
|
|
|
|
Talon FX Signals#
Phoenix 5 |
Phoenix Pro |
---|---|
|
|
|
StatorCurrent (motoring +, braking -),TorqueCurrent (forward +, reverse -) |
|
|
|
|
|
|
|
|
|
|
CANcoder Signals#
Phoenix 5 |
Phoenix Pro |
---|---|
|
|
Pigeon 2 Signals#
Note
Many Pigeon 2 signal getters in Phoenix 5 fill an array, such as YawPitchRoll
. In Phoenix Pro, these signals have been broken up into their individual components, such as Yaw
, Pitch
, and Roll
.
Phoenix 5 |
Phoenix Pro |
---|---|
|
|
|
|
|
|
|
|
|
|