ReduxLib C++ 2024.3.2
|
#include <CanandgyroSettings.h>
Public Member Functions | |
const std::vector< uint8_t > & | SettingAddresses () const override |
void | SetYawFramePeriod (units::second_t period) |
void | SetAngularPositionFramePeriod (units::second_t period) |
void | SetAngularVelocityFramePeriod (units::second_t period) |
void | SetAccelerationFramePeriod (units::second_t period) |
void | SetStatusFramePeriod (units::second_t period) |
std::optional< units::second_t > | GetYawFramePeriod () |
std::optional< units::second_t > | GetAngularPositionFramePeriod () |
std::optional< units::second_t > | GetAngularVelocityFramePeriod () |
std::optional< units::second_t > | GetAccelerationFramePeriod () |
std::optional< units::second_t > | GetStatusFramePeriod () |
Public Member Functions inherited from redux::canand::CanandSettings | |
CanandSettings ()=default | |
CanandSettings (CanandSettings &stg) | |
~CanandSettings ()=default | |
std::unordered_map< uint8_t, uint64_t > | FilteredMap () |
bool | AllSettingsReceived () const |
virtual const std::vector< uint8_t > & | SettingAddresses () const |
std::unordered_map< uint8_t, uint64_t > & | GetMap () |
bool | IsEmpty () const |
bool | IsEphemeral () const |
void | SetEphemeral (bool value) |
std::string | ToString () |
Additional Inherited Members | |
Protected Attributes inherited from redux::canand::CanandSettings | |
std::unordered_map< uint8_t, uint64_t > | values |
bool | ephemeral = false |
The settings class for the Canandgyro.
This class holds settings values that can be used to reconfigure Canandgyro via Canandgyro::SetSettings Additionally, objects of this class can be filled using Canandgyro.GetSettings which can be used to read the encoder's settings.
Objects returned by the blocking Canandgyro::GetSettings() method will generally have all setting values populated and the getters will not return std::nullopt assuming no timeout occured.
However, they may return std::nullopt if the object is either manually constructed and the corresponding getter hasn't been called yet (e.g. calling GetStatusFramePeriod before SetStatusFramePeriod on an object you made) or if the object comes from Canandgyro::GetSettingsAsync() and not all settings have been received (use AllSettingsReceived() to check if all are present)
cppreference on std::optional may be helpful here.
Example blocking fetch:
std::optional< units::second_t > redux::sensors::canandgyro::CanandgyroSettings::GetAccelerationFramePeriod | ( | ) |
Gets the acceleration frame period in seconds [0..65.535], or std::nullopt if the value has not been set on this object.
A value of 0 means acceleration frames are disabled.
std::optional< units::second_t > redux::sensors::canandgyro::CanandgyroSettings::GetAngularPositionFramePeriod | ( | ) |
Gets the angular position frame period in seconds [0..65.535], or std::nullopt if the value has not been set on this object.
A value of 0 means angular position frames are disabled.
std::optional< units::second_t > redux::sensors::canandgyro::CanandgyroSettings::GetAngularVelocityFramePeriod | ( | ) |
Gets the angular velocity frame period in seconds [0..65.535], or std::nullopt if the value has not been set on this object.
A value of 0 means angular velocity frames are disabled.
std::optional< units::second_t > redux::sensors::canandgyro::CanandgyroSettings::GetStatusFramePeriod | ( | ) |
Gets the status frame period in seconds [0.001..16.383], or std::nullopt if the value has not beeno set on this object.
std::optional< units::second_t > redux::sensors::canandgyro::CanandgyroSettings::GetYawFramePeriod | ( | ) |
Gets the dedicated yaw frame period in seconds [0..65.535], or std::nullopt if the value has not been set on this object.
A value of 0 means yaw frames are disabled.
void redux::sensors::canandgyro::CanandgyroSettings::SetAccelerationFramePeriod | ( | units::second_t | period | ) |
Sets the angular velocity frame period in seconds.
By factory default, acceleration frames are sent every 100 milliseconds (period = 0.100_s). If 0 is passed in, acceleration frames will be disabled and methods returning acceleration data will not return new values.
period | the new frame period in seconds [0_s, 65.535_s] inclusive |
void redux::sensors::canandgyro::CanandgyroSettings::SetAngularPositionFramePeriod | ( | units::second_t | period | ) |
Sets the angular position frame period in seconds.
By factory default, angular position frames are sent every 20 milliseconds (period = 0.020_s). If 0 is passed in, angular position frames will be disabled and methods returning angular position data will not return new values.
The one exception is Canandgyro.GetYaw which by default uses the yaw frame instead.
period | the new frame period in seconds [0_s, 65.535_s] inclusive |
void redux::sensors::canandgyro::CanandgyroSettings::SetAngularVelocityFramePeriod | ( | units::second_t | period | ) |
Sets the angular velocity frame period in seconds.
By factory default, angular velocity frames are sent every 100 milliseconds (period = 0.100_s). If 0 is passed in, angular velocity frames will be disabled and methods returning angular velocity data will not return new values.
period | the new frame period in seconds [0_s, 65.535_s] inclusive |
void redux::sensors::canandgyro::CanandgyroSettings::SetStatusFramePeriod | ( | units::second_t | period | ) |
Sets the status frame period in seconds.
By factory default, the device will broadcast 10 status messages every second (period=0.1_s).
period | the new period for status frames in seconds in range [0.001_s, 16.383_s]. |
|
overridevirtual |
Gets the array of settings addresses this settings class records.
Reimplemented from redux::canand::CanandSettings.
void redux::sensors::canandgyro::CanandgyroSettings::SetYawFramePeriod | ( | units::second_t | period | ) |
Sets the dedicated yaw frame period in seconds.
By factory default, yaw frames are sent every 10 milliseconds (period = 0.010_s). If 0 is passed in, yaw frames will be disabled and Canandgyro::getYaw} will not return new values (unless configured to derive yaw from the angular position frame)
period | the new frame period in seconds [0_s, 65.535_s] inclusive |