CTRE Phoenix 6 C++ 24.50.0-alpha-2
ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread Class Reference

Performs swerve module updates in a separate thread to minimize latency. More...

#include <ctre/phoenix6/swerve/impl/SwerveDrivetrainImpl.hpp>

Public Member Functions

 OdometryThread (SwerveDrivetrainImpl &drivetrain)
 
 ~OdometryThread ()
 
void Start ()
 
void Stop ()
 
bool IsOdometryValid () const
 
void SetThreadPriority (int priority)
 

Protected Member Functions

void Run ()
 

Protected Attributes

SwerveDrivetrainImpl_drivetrain
 
std::thread _thread
 
std::mutex _threadMtx
 
std::atomic< bool > _isRunning = false
 
std::vector< BaseStatusSignal * > _allSignals
 
LinearFilter< units::second_t > _lowPass = LinearFilter<units::second_t>::MovingAverage(kLowPassTaps)
 
bool _lastTimeValid = false
 
units::second_t _lastTime {}
 
units::second_t _averageLoopTime {}
 
std::atomic< int32_t > _successfulDaqs {}
 
std::atomic< int32_t > _failedDaqs {}
 
std::atomic< int > _threadPriorityToSet = START_THREAD_PRIORITY
 
int _lastThreadPriority = START_THREAD_PRIORITY
 

Static Protected Attributes

static constexpr int START_THREAD_PRIORITY = 1
 
static constexpr int kLowPassTaps = 50
 

Detailed Description

Performs swerve module updates in a separate thread to minimize latency.

Constructor & Destructor Documentation

◆ OdometryThread()

ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::OdometryThread ( SwerveDrivetrainImpl drivetrain)

◆ ~OdometryThread()

ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::~OdometryThread ( )
inline

Member Function Documentation

◆ IsOdometryValid()

bool ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::IsOdometryValid ( ) const
inline

◆ Run()

void ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::Run ( )
protected

◆ SetThreadPriority()

void ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::SetThreadPriority ( int  priority)
inline

◆ Start()

void ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::Start ( )
inline

◆ Stop()

void ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::Stop ( )
inline

Member Data Documentation

◆ _allSignals

std::vector<BaseStatusSignal *> ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_allSignals
protected

◆ _averageLoopTime

units::second_t ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_averageLoopTime {}
protected

◆ _drivetrain

SwerveDrivetrainImpl* ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_drivetrain
protected

◆ _failedDaqs

std::atomic<int32_t> ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_failedDaqs {}
protected

◆ _isRunning

std::atomic<bool> ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_isRunning = false
protected

◆ _lastThreadPriority

int ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_lastThreadPriority = START_THREAD_PRIORITY
protected

◆ _lastTime

units::second_t ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_lastTime {}
protected

◆ _lastTimeValid

bool ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_lastTimeValid = false
protected

◆ _lowPass

LinearFilter<units::second_t> ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_lowPass = LinearFilter<units::second_t>::MovingAverage(kLowPassTaps)
protected

◆ _successfulDaqs

std::atomic<int32_t> ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_successfulDaqs {}
protected

◆ _thread

std::thread ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_thread
protected

◆ _threadMtx

std::mutex ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_threadMtx
protected

◆ _threadPriorityToSet

std::atomic<int> ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::_threadPriorityToSet = START_THREAD_PRIORITY
protected

◆ kLowPassTaps

constexpr int ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::kLowPassTaps = 50
staticconstexprprotected

◆ START_THREAD_PRIORITY

constexpr int ctre::phoenix6::swerve::impl::SwerveDrivetrainImpl::OdometryThread::START_THREAD_PRIORITY = 1
staticconstexprprotected

The documentation for this class was generated from the following file: