|
CTRE Phoenix 6 C++ 26.70.0-alpha-2
|
Information about the timestamp of a signal. More...
#include <ctre/phoenix6/Timestamp.hpp>
Public Types | |
| enum class | TimestampSource { System = 0 , CANivore = 1 , Device = 2 } |
| Source of the timestamp. More... | |
Public Member Functions | |
| constexpr | Timestamp ()=default |
| Constructs a new invalid Timestamp. | |
| constexpr | Timestamp (wpi::units::second_t time, TimestampSource source, bool valid=true) |
| Constructs a new Timestamp for the given source. | |
| constexpr wpi::units::second_t | GetTime () const |
| Gets the time of this timestamp. | |
| constexpr TimestampSource | GetSource () const |
| Gets the source of this timestamp. | |
| constexpr bool | IsValid () const |
| Gets whether this Timestamp is valid. | |
| wpi::units::second_t | GetLatency () const |
| Gets the latency of this timestamp compared to now. | |
Information about the timestamp of a signal.
|
strong |
Source of the timestamp.
| Enumerator | |
|---|---|
| System | Timestamp as reported by the system. This timestamp is captured when the system receives the signal value. This timestamp is present on all systems and is guaranteed to be monotonic. However, this timestamp is the least accurate due to latency from processing delays within the system. |
| CANivore | Timestamp as reported by the CANivore. This timestamp is captured when the CANivore receives the signal value. The CANivore is synchronized to the system monotonic clock and benefits from reduced latency over the TimestampSource::System timestamp. When used with CANivore, the only inaccuracy in this measurement is latency from CAN bus arbitration. |
| Device | This timestamp source requires Phoenix Pro. Timestamp as reported by the device. This timestamp is captured when the device transmits the signal value. Because it is timestamped in the device, it is the most accurate timestamp source. This timestamp is synchronized to the CANivore clock, which is itself synchronized to the system monotonic clock. As a result, this timestamp source requires a CANivore. It can be assumed there is no latency between this timestamp and when the data was taken. |
|
constexprdefault |
Constructs a new invalid Timestamp.
|
inlineconstexpr |
Constructs a new Timestamp for the given source.
| time | The time in seconds |
| source | The timestamp source |
| valid | Whether the timestamp is valid |
|
inline |
Gets the latency of this timestamp compared to now.
|
inlineconstexpr |
Gets the source of this timestamp.
|
inlineconstexpr |
Gets the time of this timestamp.
|
inlineconstexpr |
Gets whether this Timestamp is valid.