CTRE Phoenix C++ 5.33.1
|
Collection of sensors available to a motor controller. More...
#include <ctre/phoenix/motorcontrol/SensorCollection.h>
Public Member Functions | |
SensorCollection (ctre::phoenix::motorcontrol::can::BaseTalon &motorController) | |
Constructor for SensorCollection. More... | |
int | GetAnalogIn () |
Get the position of whatever is in the analog pin of the Talon, regardless of whether it is actually being used for feedback. More... | |
ErrorCode | SetAnalogPosition (int newPosition, int timeoutMs=0) |
Sets analog position. More... | |
int | GetAnalogInRaw () |
Get the position of whatever is in the analog pin of the Talon, regardless of whether it is actually being used for feedback. More... | |
int | GetAnalogInVel () |
Get the velocity of whatever is in the analog pin of the Talon, regardless of whether it is actually being used for feedback. More... | |
int | GetQuadraturePosition () |
Get the quadrature position of the Talon, regardless of whether it is actually being used for feedback. More... | |
ErrorCode | SetQuadraturePosition (int newPosition, int timeoutMs=0) |
Change the quadrature reported position. More... | |
ErrorCode | SyncQuadratureWithPulseWidth (int bookend0, int bookend1, bool bCrossZeroOnInterval, int offset=0, int timeoutMs=0) |
Change the quadrature reported position based on pulse width. More... | |
int | GetQuadratureVelocity () |
Get the quadrature velocity, regardless of whether it is actually being used for feedback. More... | |
int | GetPulseWidthPosition () |
Gets pulse width position, regardless of whether it is actually being used for feedback. More... | |
ErrorCode | SetPulseWidthPosition (int newPosition, int timeoutMs=0) |
Sets pulse width position. More... | |
int | GetPulseWidthVelocity () |
Gets pulse width velocity, regardless of whether it is actually being used for feedback. More... | |
int | GetPulseWidthRiseToFallUs () |
Gets pulse width rise to fall time. More... | |
int | GetPulseWidthRiseToRiseUs () |
Gets pulse width rise to rise time. More... | |
int | GetPinStateQuadA () |
Gets pin state quad a. More... | |
int | GetPinStateQuadB () |
Gets pin state quad b. More... | |
int | GetPinStateQuadIdx () |
Gets pin state quad index. More... | |
int | IsFwdLimitSwitchClosed () |
Is forward limit switch closed. More... | |
int | IsRevLimitSwitchClosed () |
Is reverse limit switch closed. More... | |
Friends | |
class | ctre::phoenix::motorcontrol::can::BaseTalon |
Collection of sensors available to a motor controller.
For best performance and update-rate, we recommend using the configSelectedFeedbackSensor() and getSelectedSensor*() routines. However there are occasions where accessing raw sensor values may be useful or convenient. Particularly if you are seeding one sensor based on another, or need to circumvent sensor-phase.
Use the getSensorCollection() routine inside your motor controller to create a sensor collection.
ctre::phoenix::motorcontrol::SensorCollection::SensorCollection | ( | ctre::phoenix::motorcontrol::can::BaseTalon & | motorController | ) |
Constructor for SensorCollection.
motorController | Talon Motor Controller to connect Collection to |
int ctre::phoenix::motorcontrol::SensorCollection::GetAnalogIn | ( | ) |
Get the position of whatever is in the analog pin of the Talon, regardless of whether it is actually being used for feedback.
This method relies on the Status 4 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetAnalogInRaw | ( | ) |
Get the position of whatever is in the analog pin of the Talon, regardless of whether it is actually being used for feedback.
This method relies on the Status 4 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetAnalogInVel | ( | ) |
Get the velocity of whatever is in the analog pin of the Talon, regardless of whether it is actually being used for feedback.
This method relies on the Status 4 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetPinStateQuadA | ( | ) |
Gets pin state quad a.
This method relies on the Status 3 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetPinStateQuadB | ( | ) |
Gets pin state quad b.
This method relies on the Status 3 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetPinStateQuadIdx | ( | ) |
Gets pin state quad index.
This method relies on the Status 3 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetPulseWidthPosition | ( | ) |
Gets pulse width position, regardless of whether it is actually being used for feedback.
This method relies on the Status 8 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetPulseWidthRiseToFallUs | ( | ) |
Gets pulse width rise to fall time.
This method relies on the Status 8 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetPulseWidthRiseToRiseUs | ( | ) |
Gets pulse width rise to rise time.
This method relies on the Status 8 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetPulseWidthVelocity | ( | ) |
Gets pulse width velocity, regardless of whether it is actually being used for feedback.
This method relies on the Status 8 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetQuadraturePosition | ( | ) |
Get the quadrature position of the Talon, regardless of whether it is actually being used for feedback.
This method relies on the Status 3 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::GetQuadratureVelocity | ( | ) |
Get the quadrature velocity, regardless of whether it is actually being used for feedback.
This method relies on the Status 3 message, which has a default period of 150ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::IsFwdLimitSwitchClosed | ( | ) |
Is forward limit switch closed.
This method relies on the Status 1 message, which has a default period of 10ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
int ctre::phoenix::motorcontrol::SensorCollection::IsRevLimitSwitchClosed | ( | ) |
Is reverse limit switch closed.
This method relies on the Status 1 message, which has a default period of 10ms. For more information, see: https://phoenix-documentation.readthedocs.io/en/latest/ch18_CommonAPI.html
ErrorCode ctre::phoenix::motorcontrol::SensorCollection::SetAnalogPosition | ( | int | newPosition, |
int | timeoutMs = 0 |
||
) |
Sets analog position.
newPosition | The new position. |
timeoutMs | Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed. |
ErrorCode ctre::phoenix::motorcontrol::SensorCollection::SetPulseWidthPosition | ( | int | newPosition, |
int | timeoutMs = 0 |
||
) |
Sets pulse width position.
newPosition | The position value to apply to the sensor. |
timeoutMs | Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed. |
ErrorCode ctre::phoenix::motorcontrol::SensorCollection::SetQuadraturePosition | ( | int | newPosition, |
int | timeoutMs = 0 |
||
) |
Change the quadrature reported position.
Typically this is used to "zero" the sensor. This only works with Quadrature sensor. To set the selected sensor position regardless of what type it is, see SetSelectedSensorPosition in the motor controller class.
newPosition | The position value to apply to the sensor. |
timeoutMs | Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed. |
ErrorCode ctre::phoenix::motorcontrol::SensorCollection::SyncQuadratureWithPulseWidth | ( | int | bookend0, |
int | bookend1, | ||
bool | bCrossZeroOnInterval, | ||
int | offset = 0 , |
||
int | timeoutMs = 0 |
||
) |
Change the quadrature reported position based on pulse width.
This can be used to effectively make quadrature absolute. For rotary mechanisms with >360 movement (such as typical swerve modules) bookend0 and bookend1 can be both set to 0 and bCrossZeroOnInterval can be set to true. For mechanisms with less than 360 travel (such as arms), bookend0 and bookend1 should be set to the pulse width values at the two extremes. If the interval crosses over the pulse width value of 0 (or any multiple of 4096), bCrossZeroOnInterval should be true and otherwise should be false. An offset can also be set.
bookend0 | value at extreme 0 |
bookend1 | value at extreme 1 |
bCrossZeroOnInterval | value at extreme 1 |
offset | (Optional) Value to add to pulse width |
timeoutMs | (Optional) How long to wait for confirmation. Pass zero so that call does not block. |
|
friend |