ReduxLib C++ 2026.1.2
Loading...
Searching...
No Matches
redux::sensors::canandgyro::Canandgyro Class Reference

#include <Canandgyro.h>

Inheritance diagram for redux::sensors::canandgyro::Canandgyro:
Collaboration diagram for redux::sensors::canandgyro::Canandgyro:

Public Member Functions

 Canandgyro (int canID, std::string bus="halcan")
 
frc::Quaternion GetQuaternion ()
 
frc::Rotation3d GetRotation3d ()
 
frc::Rotation2d GetRotation2d ()
 
void UseDedicatedYawAngleFrame (bool use)
 
units::turn_t GetYaw ()
 
units::turn_t GetMultiturnYaw ()
 
units::turn_t GetPitch ()
 
units::turn_t GetRoll ()
 
units::turns_per_second_t GetAngularVelocityRoll ()
 
units::turns_per_second_t GetAngularVelocityPitch ()
 
units::turns_per_second_t GetAngularVelocityYaw ()
 
units::standard_gravity_t GetAccelerationX ()
 
units::standard_gravity_t GetAccelerationY ()
 
units::standard_gravity_t GetAccelerationZ ()
 
void StartCalibration ()
 
bool IsCalibrating ()
 
bool WaitForCalibrationToFinish (units::second_t timeout)
 
bool SetPoseRPY (units::turn_t newRoll, units::turn_t newPitch, units::turn_t newYaw, units::second_t timeout=20_ms, uint32_t retries=5)
 
bool SetPoseR3D (frc::Rotation3d newPose, units::second_t timeout=20_ms, uint32_t retries=5)
 
bool SetPose (frc::Quaternion newPose, units::second_t timeout=20_ms, uint32_t retries=5)
 
bool SetYaw (units::turn_t yaw, units::second_t timeout=20_ms, uint32_t retries=5)
 
CanandgyroFaults GetStickyFaults ()
 
CanandgyroFaults GetActiveFaults ()
 
units::celsius_t GetTemperature ()
 
CanandgyroStatus GetStatus ()
 
void ClearStickyFaults ()
 
void SetPartyMode (uint8_t level)
 
CanandgyroSettings GetSettings (units::second_t timeout=350_ms, units::second_t missingTimeout=20_ms, uint32_t attempts=3)
 
void StartFetchSettings ()
 
CanandgyroSettings GetSettingsAsync ()
 
CanandgyroSettings SetSettings (CanandgyroSettings &settings, units::second_t timeout=20_ms, uint32_t attempts=3)
 
CanandgyroSettings ResetFactoryDefaults (units::second_t timeout=350_ms)
 
redux::canand::CanandSettingsManager< CanandgyroSettings > & GetInternalSettingsManager ()
 
redux::frames::Frame< units::turn_t > & GetYawFrame ()
 
redux::frames::Frame< units::turn_t > & GetMultiturnYawFrame ()
 
redux::frames::Frame< frc::Quaternion > & GetAngularPositionFrame ()
 
redux::frames::Frame< AngularVelocity > & GetVelocityFrame ()
 
redux::frames::Frame< Acceleration > & GetAccelerationFrame ()
 
redux::frames::Frame< CanandgyroStatus > & GetStatusFrame ()
 
void HandleMessage (redux::canand::CanandMessage &msg) override
 
redux::canand::CanandAddressGetAddress () override
 
std::string GetDeviceClassName () override
 
redux::canand::CanandFirmwareVersion GetMinimumFirmwareVersion () override
 
- Public Member Functions inherited from redux::canand::CanandDevice
bool IsConnected (units::second_t timeout=2_s)
 
std::string GetDeviceName ()
 
virtual void PreHandleMessage (CanandMessage &msg)
 
virtual void CheckReceivedFirmwareVersion ()
 
bool SendCANMessage (uint8_t apiIndex, uint8_t *data, uint8_t length)
 
template<std::size_t len>
requires (len < 8U)
void SendCANMessage (uint8_t msgId, std::span< std::byte, len > data)
 

Protected Attributes

redux::frames::Frame< bool > calibrating {false, 0_ms}
 
redux::frames::Frame< units::turn_t > singleYaw {0.0_tr, 0_ms}
 
redux::frames::Frame< units::turn_t > multiYaw {0.0_tr, 0_ms}
 
redux::frames::Frame< frc::Quaternion > quat {frc::Quaternion(), 0_ms}
 
redux::frames::Frame< AngularVelocityvel {AngularVelocity{0_tps, 0_tps, 0_tps}, 0_ms}
 
redux::frames::Frame< Accelerationaccel {Acceleration{0_SG, 0_SG, 0_SG}, 0_ms}
 
redux::frames::Frame< CanandgyroStatusstatus {CanandgyroStatus{0, 0, false, 30_degC}, 0_ms}
 
redux::canand::CanandSettingsManager< CanandgyroSettingsstg {*this}
 

Detailed Description

Class for the CAN interface of the canandgyro.

The C++ vendordep uses the units library for all dimensioned values, including settings.

Operations that receive data from the device (position, velocity, faults, temperature) generally do not block. The object receives data asynchronously from the CAN packet receive thread and reads thus return the last data received.

Operations that set settings or change offsets will generally wait for up to 20ms by default as they will usually wait for a confirmation packet to be received in response – unless the blocking timeout is set to zero, in which case the operation swill not block.

Example code:

Canandgyro canandgyro{0}; // instantiates with device id 0
// Reading angular position
canandgyro.GetYaw(); // gets the yaw (Z-axis) value in units::turn_t [-180 deg inclusive..180 deg exclusive)
// This is probably what you want to use for robot heading.
canandgyro.GetMultiturnYaw(); // also gets yaw, except without a wraparound
canandgyro.GetPitch(); // pitch (Y-axis) value
canandgyro.GetRoll(); // roll (X-axis) value
canandgyro.GetRotation2d(); // Z-axis Rotation2d object
canandgyro.GetRotation3d(); // Full 3d rotation object
canandgyro.GetQuaternion(); // Raw rotation quaternion object
// Reading angular velocity (all in rotations per second)
canandgyro.GetAngularVelocityYaw();
canandgyro.GetAngularVelocityPitch();
canandgyro.GetAngularVelocityRoll();
// Linear acceleration (gravitational units)
canandgyro.GetAccelerationX();
canandgyro.GetAccelerationY();
canandgyro.GetAccelerationZ();
// Updating pose:
canandgyro.SetYaw(0.25_tr); // set yaw to 0.25 rotations positive
// set roll, pitch, yaw as 0.0, 0.1, and 0.25 rotations with 20 ms timeout
canandgyro.SetPoseRPY(0.0_tr, 0.1_tr, 0.25_tr, 20_ms);
// SetPose
// Manually calibrating:
// The Canandgyro automatically calibrates on boot, but you may want to force a calibration.
// Calibration takes several seconds!!!
canandgyro.StartCalibration(); // begin calibration
canandgyro.IsCalibrating(); // check if the gyro is still calibrating
canandgyro.WaitForCalibrationToFinish(5_s); // wait up to 5 seconds for calibration to finish.
// Faults
canandgyro.ClearStickyFaults(); // clears all sticky faults (including the power cycle flag).
// This call does not block.
// this flag will always be true on boot until the sticky faults have been cleared,
// so if this prints true the encoder has rebooted sometime between ClearStickyFaults and now.
CanandgyroFaults faults = canandgyro.GetStickyFaults(); // fetches faults
fmt::print("Device rebooted: {}\n", faults.powerCycle);
// Timestamped data
// gets current angular position + timestamp together
auto& quatFrameData = canandgyro.GetAngularPositionFrame();
quatFrameData.GetValue(); // fetched quaternion object
quatFrameData.GetValue().W(); // fetched quaternion W component
quatFrameData.GetTimestamp(); // timestamp of the quaternion data
Definition CanandgyroFaults.h:13
bool powerCycle
Definition CanandgyroFaults.h:35
Definition Canandgyro.h:110
units::turn_t GetYaw()
Definition Canandgyro.h:191

Constructor & Destructor Documentation

◆ Canandgyro()

redux::sensors::canandgyro::Canandgyro::Canandgyro ( int  canID,
std::string  bus = "halcan" 
)

Constructor with the device's id. This object will be constant with respect to whatever CAN id assigned to it, so if a device changes id it may change which device this object reads from.

Parameters
canIDthe device id to use
busthe message bus to use. Defaults to "halcan".

Member Function Documentation

◆ ClearStickyFaults()

void redux::sensors::canandgyro::Canandgyro::ClearStickyFaults ( )

Clears sticky faults.

It is recommended to clear this during initialization, so one can check if the encoder loses power during operation later.

This call does not block, so it may take up to the next status frame (default every 1000 ms) for the sticky faults to be updated.

◆ GetAccelerationFrame()

redux::frames::Frame< Acceleration > & redux::sensors::canandgyro::Canandgyro::GetAccelerationFrame ( )
inline

Returns the current acceleration frame, which includes CAN timestamp data.

Returns
the current acceleration frame

◆ GetAccelerationX()

units::standard_gravity_t redux::sensors::canandgyro::Canandgyro::GetAccelerationX ( )
inline

Gets the linear acceleration along the X axis.

Returns
linear acceleration

◆ GetAccelerationY()

units::standard_gravity_t redux::sensors::canandgyro::Canandgyro::GetAccelerationY ( )
inline

Gets the linear acceleration along the Y axis.

Returns
linear acceleration in Gs

◆ GetAccelerationZ()

units::standard_gravity_t redux::sensors::canandgyro::Canandgyro::GetAccelerationZ ( )
inline

Gets the linear acceleration along the Z axis.

Returns
linear acceleration

◆ GetActiveFaults()

CanandgyroFaults redux::sensors::canandgyro::Canandgyro::GetActiveFaults ( )
inline

Fetches active faults. Active faults are only active for as long as the error state exists.

Returns
canandgyroFaults of the active faults

◆ GetAddress()

redux::canand::CanandAddress & redux::sensors::canandgyro::Canandgyro::GetAddress ( )
overridevirtual

Returns the reference to the CanandAddress representing the combination of CAN bus and CAN device ID that this CanandDevice refers to.

Implementing device subclasses should likely construct a new CanandAddress in their constructor and return it here.

Returns
a reference to the CanandAddress for the device.

Implements redux::canand::CanandDevice.

◆ GetAngularPositionFrame()

redux::frames::Frame< frc::Quaternion > & redux::sensors::canandgyro::Canandgyro::GetAngularPositionFrame ( )
inline

Returns the current angular position frame, which includes CAN timestamp data.

Returns
the current angular position frame

◆ GetAngularVelocityPitch()

units::turns_per_second_t redux::sensors::canandgyro::Canandgyro::GetAngularVelocityPitch ( )
inline

Gets the angular velocity along the pitch (Y) axis.

Returns
angular velocity

◆ GetAngularVelocityRoll()

units::turns_per_second_t redux::sensors::canandgyro::Canandgyro::GetAngularVelocityRoll ( )
inline

Gets the angular velocity along the roll (X) axis.

Returns
angular velocity

◆ GetAngularVelocityYaw()

units::turns_per_second_t redux::sensors::canandgyro::Canandgyro::GetAngularVelocityYaw ( )
inline

Gets the angular velocity along the yaw (Z) axis.

Returns
angular velocity

◆ GetDeviceClassName()

std::string redux::sensors::canandgyro::Canandgyro::GetDeviceClassName ( )
inlineoverridevirtual

Returns a canonical class-wide device name.

Returns
std::string of a device type name

Reimplemented from redux::canand::CanandDevice.

◆ GetInternalSettingsManager()

redux::canand::CanandSettingsManager< CanandgyroSettings > & redux::sensors::canandgyro::Canandgyro::GetInternalSettingsManager ( )
inline

Returns the CanandSettingsManager associated with this device.

The CanandSettingsManager is an internal helper object. Teams are typically not expected to use it except for advanced cases (e.g. custom settings wrappers)

Returns
internal settings manager handle

◆ GetMinimumFirmwareVersion()

redux::canand::CanandFirmwareVersion redux::sensors::canandgyro::Canandgyro::GetMinimumFirmwareVersion ( )
inlineoverridevirtual

Returns the minimum firmware version this vendordep requires.

Returns
minimum firmware version

Reimplemented from redux::canand::CanandDevice.

◆ GetMultiturnYaw()

units::turn_t redux::sensors::canandgyro::Canandgyro::GetMultiturnYaw ( )
inline

Gets a multi-turn yaw (Z-axis) rotation that tracks to multiple continuous rotations.

Note that this relies on the dedicated multi-turn yaw packet so if it is disabled via setYawFramePeriod it will not return fresh data.

Returns
multi-turn yaw in rotational units.

◆ GetMultiturnYawFrame()

redux::frames::Frame< units::turn_t > & redux::sensors::canandgyro::Canandgyro::GetMultiturnYawFrame ( )
inline

Returns the current multi-turn yaw frame, which includes CAN timestamp data. redux::canand::FrameData objects are immutable.

Returns
the current yaw frame

◆ GetPitch()

units::turn_t redux::sensors::canandgyro::Canandgyro::GetPitch ( )
inline

Gets the pitch (Y-axis) rotation from [-0.5 rotations inclusive..0.5 exclusive).

Returns
pitch in rotational units.

◆ GetQuaternion()

frc::Quaternion redux::sensors::canandgyro::Canandgyro::GetQuaternion ( )
inline

Gets a quaternion object of the gyro's 3d rotation from the zero point

Returns
a Quaternion of the current Canandgyro pose

◆ GetRoll()

units::turn_t redux::sensors::canandgyro::Canandgyro::GetRoll ( )
inline

Gets the roll (X-axis) rotation from [-0.5 rotations inclusive..0.5 exclusive).

Returns
roll in rotational units.

◆ GetRotation2d()

frc::Rotation2d redux::sensors::canandgyro::Canandgyro::GetRotation2d ( )
inline

Gets an frc::Rotation2d object representing the rotation around the yaw axis from the zero point If you just want Z-axis rotation use GetYaw().

Returns
a Rotation2d of the current Canandgyro yaw

◆ GetRotation3d()

frc::Rotation3d redux::sensors::canandgyro::Canandgyro::GetRotation3d ( )
inline

Gets an frc::Rotation3d object of the gyro's 3d rotation from the zero point If you just want Z-axis rotation use GetYaw().

Returns
a Rotation3d of the current Canandgyro pose

◆ GetSettings()

CanandgyroSettings redux::sensors::canandgyro::Canandgyro::GetSettings ( units::second_t  timeout = 350_ms,
units::second_t  missingTimeout = 20_ms,
uint32_t  attempts = 3 
)
inline

Fetches the device's current configuration in a blocking manner.

This method works by requesting the device first send back all settings, and then waiting for up to a specified timeout for all settings to be received by the robot controller. If the timeout is zero, this step is skipped.

If there are settings that were not received by the timeout, then this function will attempt to individually fetched each setting for up to a specified number of attempts. If the fresh argument is true and the timeout argument is 0, then only this latter step runs, which can be used to only fetch settings that are missing from the known settings cache returned by GetSettingsAsync.

The resulting set of known (received) settings is then returned, complete or not.

This function blocks, so it is best to put this in init routines rather than a main loop.

// device declaration
Canandgyro canandgyro{0};
// in your init/other sequence
CanandgyroSettings stg = canandgyro.GetSettings();
if (stg.AllSettingsReceived()) {
// do your thing here
} else {
// handle missing settings
}
Definition CanandgyroSettings.h:54
redux::canand::CanandSettingsManager< CanandgyroSettings > stg
Definition Canandgyro.h:134

Advanced users can use this function to retry settings missed from StartFetchSettings:

// device declaration
Canandgyro canandgyro{0};
enc.StartFetchSettings(); // send a "fetch settings command"
// wait some amount of time
CanandgyroSettings stg = enc.GetSettingsAsync();
stg.AllSettingsReceived(); // may or may not be true
stg = enc.GetSettings(0_ms, 20_ms, 3); // Retry getitng the missing settings.
stg.AllSettingsReceived(); // far more likely to be true
bool AllSettingsReceived() const
Definition CanandSettings.h:56
void StartFetchSettings()
Definition Canandgyro.h:443
Parameters
timeoutmaximum number of seconds to wait for a settings operation before timing out (default 350_ms)
missingTimeoutmaximum number of seconds to wait for each settings retry before giving up
attemptsnumber of attempts to try and fetch values missing from the first pass
Returns
Received set of CanandgyroSettings of device configuration.

◆ GetSettingsAsync()

CanandgyroSettings redux::sensors::canandgyro::Canandgyro::GetSettingsAsync ( )
inline

Non-blockingly returns a CanandgyroSettings object of the most recent known settings values received from the encoder.

Most users will probably want to use canandgyro::GetSettings() instead.

One can call this after a Canandgyro::StartFetchSettings() call, and use CanandgyroSettings::AllSettingsReceived() to check if/when all values have been seen. As an example:

// device declaration
canandgyro enc{0};
// somewhere in an init function
enc.StartFetchSettings();
// ...
// somewhere in a loop function
CanandgyroSettings stg = enc.GetSettingsAsync();
if (stg.AllSettingsReceived()) {
// do something with the returned settings
fmt::print("Device status frame period: {}\n", *stg.GetStatusFramePeriod());
}

If this is called after Canandgyro::SetSettings(), this method will return a settings object where only the fields where the device has echoed the new values back will be populated. To illustrate this, consider the following:

// device declaration
Canandgyro enc{0};
// somewhere in a loop
stg_set.SetStatusFramePeriod(100_ms);
enc.SetSettings(stg_set);
CanandgyroSettings stg_get = enc.GetSettingsAsync();
// will likely return std::nullopt, as the device likely hasn't already responded to the settings set request
// after up to 100 ms...
stg_get = enc.GetSettingsAsync();
// will likely be a value equivalent to 100_ms, may still be std::nullopt if the device is disconnected, so be careful of blind dereferences
std::optional< units::second_t > GetStatusFramePeriod()
void SetStatusFramePeriod(units::second_t period)
Returns
CanandgyroSettings of currently known settings

◆ GetStatus()

CanandgyroStatus redux::sensors::canandgyro::Canandgyro::GetStatus ( )
inline

Get the contents of the previous status packet, which includes active faults, sticky faults, and temperature.

Returns
device status as a status struct

◆ GetStatusFrame()

redux::frames::Frame< CanandgyroStatus > & redux::sensors::canandgyro::Canandgyro::GetStatusFrame ( )
inline

Returns a handle to the current status frame, which includes CAN timestamp data.

Returns
the current status frame, as a CanandgyroStatus record.

◆ GetStickyFaults()

CanandgyroFaults redux::sensors::canandgyro::Canandgyro::GetStickyFaults ( )
inline

Fetches sticky faults. Sticky faults are the active faults, except once set they do not become unset until ClearStickyFaults() is called.

Returns
canandgyroFaults of the sticky faults

◆ GetTemperature()

units::celsius_t redux::sensors::canandgyro::Canandgyro::GetTemperature ( )
inline

Get onboard encoder temperature readings in degrees Celsius.

Returns
temperature in degrees Celsius

◆ GetVelocityFrame()

redux::frames::Frame< AngularVelocity > & redux::sensors::canandgyro::Canandgyro::GetVelocityFrame ( )
inline

Returns the current angular velocity frame, which includes CAN timestamp data.

Returns
the current angular velocity frame

◆ GetYaw()

units::turn_t redux::sensors::canandgyro::Canandgyro::GetYaw ( )
inline

Gets the yaw (Z-axis) rotation from [-0.5 rotations inclusive..0.5 exclusive).

This is probably the function you want to use for applications like field-centric control.

Returns
yaw in rotational units.

◆ GetYawFrame()

redux::frames::Frame< units::turn_t > & redux::sensors::canandgyro::Canandgyro::GetYawFrame ( )
inline

Returns the current single-turn yaw frame, which includes CAN timestamp data. redux::canand::FrameData objects are immutable.

Returns
the current yaw frame

◆ HandleMessage()

void redux::sensors::canandgyro::Canandgyro::HandleMessage ( redux::canand::CanandMessage msg)
overridevirtual

A callback called when a Redux CAN message is received and should be parsed. Subclasses of CanandDevice should override this to update their internal state accordingly.

HandleMessage will be called on all Redux CAN packets received by the vendordep that match the CanandAddress returned by CanandDevice::GetAddress().

Parameters
msga reference to a CanandMessage representing the received message. The message may not have lifetime outside the function call.

Implements redux::canand::CanandDevice.

◆ IsCalibrating()

bool redux::sensors::canandgyro::Canandgyro::IsCalibrating ( )
inline

Returns if the Canandgyro is known to be currently calibrating.

Returns
if the Canandgyro is calibrating

◆ ResetFactoryDefaults()

CanandgyroSettings redux::sensors::canandgyro::Canandgyro::ResetFactoryDefaults ( units::second_t  timeout = 350_ms)
inline

Resets the encoder to factory defaults, and then wait for all settings to be broadcasted back.

Parameters
timeouthow long to wait for the new settings to be confirmed by the encoder in seconds (suggested at least 0.35 seconds)
Returns
CanandgyroSettings object of received settings. Use CanandgyroSettings.AllSettingsReceived() to verify success.

◆ SetPartyMode()

void redux::sensors::canandgyro::Canandgyro::SetPartyMode ( uint8_t  level)

Controls "party mode" – an encoder identification tool that blinks the onboard LED various colors if level != 0.

This function does not block.

Parameters
levelthe party level value to set.

◆ SetPose()

bool redux::sensors::canandgyro::Canandgyro::SetPose ( frc::Quaternion  newPose,
units::second_t  timeout = 20_ms,
uint32_t  retries = 5 
)

Sets a new pose without recalibrating with an frc::Quaternion.

Parameters
newPosenew quaternion pose
timeoutthe timeout in seconds to wait for a pose set confirmation. Set to 0 to not check (always return true.)
retriesthe number of retries for the set pose operation.
Returns
true if a pose set confirmation was received (or if timeout is zero)

◆ SetPoseR3D()

bool redux::sensors::canandgyro::Canandgyro::SetPoseR3D ( frc::Rotation3d  newPose,
units::second_t  timeout = 20_ms,
uint32_t  retries = 5 
)
inline

Sets a new angular position without recalibrating with an frc::Rotation3d.

Parameters
newPosenew rotation3d pose
timeoutthe timeout in seconds to wait for a pose set confirmation. Set to 0 to not check (always return true.)
retriesthe number of retries for the set pose operation.
Returns
true if a pose set confirmation was received (or if timeout is zero)

◆ SetPoseRPY()

bool redux::sensors::canandgyro::Canandgyro::SetPoseRPY ( units::turn_t  newRoll,
units::turn_t  newPitch,
units::turn_t  newYaw,
units::second_t  timeout = 20_ms,
uint32_t  retries = 5 
)
inline

Sets a new angular position pose without recalibrating with a given roll/pitch/yaw. If you just want to set yaw, use SetYaw.

Parameters
newRollnew roll (x) pose
newPitchnew pitch (y) pose
newYawnew yaw (z) pose
timeoutthe timeout in seconds to wait for a pose set confirmation. Set to 0 to not check (always return true.)
retriesthe number of retries for the set pose operation.
Returns
true if a pose set confirmation was received (or if timeout is zero)

◆ SetSettings()

CanandgyroSettings redux::sensors::canandgyro::Canandgyro::SetSettings ( CanandgyroSettings settings,
units::second_t  timeout = 20_ms,
uint32_t  attempts = 3 
)
inline

Applies the settings from a CanandgyroSettings object to the Canandgyro. For more information, see the CanandgyroSettings class documentation.

Example:

Canandgyro enc{0};
// After configuring the settings object...
CanandgyroSettings failed = enc.SetSettings(stg);
if (failed.IsEmpty()) {
// success
} else {
// handle failed settings
}
bool IsEmpty() const
Definition CanandSettings.h:85
Parameters
settingsthe CanandgyroSettings to update the encoder with
timeoutmaximum time in seconds to wait for each setting to be confirmed. (default 0.020s, set to 0 to not check and not block).
attemptsthe maxinum number of attempts to write each individual settings
Returns
CanandgyroSettings object of unsuccessfully set settings.

◆ SetYaw()

bool redux::sensors::canandgyro::Canandgyro::SetYaw ( units::turn_t  yaw,
units::second_t  timeout = 20_ms,
uint32_t  retries = 5 
)

Sets a new yaw without recalibrating the Canandgyro. Blocks for up to 50 milliseconds by default to confirm the transaction.

Parameters
yawnew yaw angle in rotations
timeoutthe timeout in seconds to block to confirm the transaction (set 0 to not block)
retriesthe number of retries for the set pose operation.
Returns
true if a confirmation was received or the timeout is zero

◆ StartCalibration()

void redux::sensors::canandgyro::Canandgyro::StartCalibration ( )

Begins calibration on the Canandgyro.

This takes several seconds. To check the state of calibration, use IsCalibrating or WaitForCalibrationToFinish.

◆ StartFetchSettings()

void redux::sensors::canandgyro::Canandgyro::StartFetchSettings ( )
inline

Tells the Canandgyro to begin transmitting its settings; once they are all transmitted (after ~200-300ms), the values can be retrieved through the Canandgyro::GetSettingsAsync() function call

◆ UseDedicatedYawAngleFrame()

void redux::sensors::canandgyro::Canandgyro::UseDedicatedYawAngleFrame ( bool  use)
inline

Sets whether this object should use the dedicated yaw message for yaw angle instead of deriving it from the pose quaternion frame.

By default this is true, as the yaw angle frame is more precise and by default more frequent.

Parameters
useuse the yaw angle

◆ WaitForCalibrationToFinish()

bool redux::sensors::canandgyro::Canandgyro::WaitForCalibrationToFinish ( units::second_t  timeout)

Blocks the current thread until the Canandgyro has finished calibrating or until a timeout is reached.

Parameters
timeoutthe timeout in seconds to wait for a calibration confirmation.
Returns
true if the calibration has finished within the timeout, false if not.

Member Data Documentation

◆ accel

redux::frames::Frame<Acceleration> redux::sensors::canandgyro::Canandgyro::accel {Acceleration{0_SG, 0_SG, 0_SG}, 0_ms}
protected

internal Frame variable holding current acceleration state

◆ calibrating

redux::frames::Frame<bool> redux::sensors::canandgyro::Canandgyro::calibrating {false, 0_ms}
protected

internal Frame variable used to track if the device is calibrating

◆ multiYaw

redux::frames::Frame<units::turn_t> redux::sensors::canandgyro::Canandgyro::multiYaw {0.0_tr, 0_ms}
protected

internal Frame variable holding current yaw position state

◆ quat

redux::frames::Frame<frc::Quaternion> redux::sensors::canandgyro::Canandgyro::quat {frc::Quaternion(), 0_ms}
protected

internal Frame variable holding current angular position state

◆ singleYaw

redux::frames::Frame<units::turn_t> redux::sensors::canandgyro::Canandgyro::singleYaw {0.0_tr, 0_ms}
protected

internal Frame variable holding current yaw position state

◆ status

redux::frames::Frame<CanandgyroStatus> redux::sensors::canandgyro::Canandgyro::status {CanandgyroStatus{0, 0, false, 30_degC}, 0_ms}
protected

internal Frame variable holding current status value state

◆ stg

redux::canand::CanandSettingsManager<CanandgyroSettings> redux::sensors::canandgyro::Canandgyro::stg {*this}
protected

internal settings manager

◆ vel

redux::frames::Frame<AngularVelocity> redux::sensors::canandgyro::Canandgyro::vel {AngularVelocity{0_tps, 0_tps, 0_tps}, 0_ms}
protected

internal Frame variable holding current angular velocity state


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