6#include <unordered_map>
8#include <condition_variable>
10#include <units/angle.h>
11#include <units/angular_velocity.h>
12#include <units/force.h>
13#include <units/time.h>
14#include <units/temperature.h>
15#include <frc/geometry/Quaternion.h>
16#include <frc/geometry/Rotation3d.h>
18#include "redux/canand/CanandDevice.h"
19#include "redux/canand/CanandEventLoop.h"
20#include "redux/canand/CanandSettingsManager.h"
21#include "redux/canand/CooldownWarning.h"
22#include "redux/frames/Frame.h"
23#include "redux/sensors/canandgyro/CanandgyroDetails.h"
24#include "redux/sensors/canandgyro/CanandgyroData.h"
25#include "redux/sensors/canandgyro/CanandgyroFaults.h"
26#include "redux/sensors/canandgyro/CanandgyroStatus.h"
27#include "redux/sensors/canandgyro/CanandgyroSettings.h"
137 bool dataRecvOnce{
false};
138 bool useYawAngleFrame{
true};
139 units::second_t lastMessageTime{0_s};
191 if (this->useYawAngleFrame) {
296 inline bool SetPoseRPY(units::turn_t newRoll, units::turn_t newPitch, units::turn_t newYaw, units::second_t timeout = 20_ms) {
308 inline bool SetPoseR3D(frc::Rotation3d newPose, units::second_t timeout = 20_ms) {
309 return SetPose(newPose.GetQuaternion(), timeout);
320 bool SetPose(frc::Quaternion newPose, units::second_t timeout = 20_ms);
329 bool SetYaw(units::turn_t yaw, units::second_t timeout = 20_ms);
429 inline CanandgyroSettings GetSettings(units::second_t timeout = 350_ms, units::second_t missingTimeout = 20_ms, uint32_t attempts = 3) {
430 return stg.GetSettings(timeout, missingTimeout, attempts);
437 inline void StartFetchSettings() {
return stg.StartFetchSettings(); }
490 inline CanandgyroSettings GetSettingsAsync() {
return stg.GetKnownSettings(); }
515 inline CanandgyroSettings SetSettings(CanandgyroSettings& settings, units::second_t timeout = 20_ms, uint32_t attempts = 3) {
516 return stg.SetSettings(settings, timeout, attempts);
528 inline CanandgyroSettings ResetFactoryDefaults(units::second_t timeout = 350_ms) {
Definition: CanandAddress.h:62
Definition: CanandDevice.h:35
virtual CanandAddress & GetAddress()=0
virtual CanandFirmwareVersion GetMinimumFirmwareVersion()
Definition: CanandDevice.h:109
virtual void HandleMessage(CanandMessage &msg)=0
virtual std::string GetDeviceClassName()
Definition: CanandDevice.h:74
Definition: CanandMessage.h:26
Definition: CanandSettingsManager.h:82
T GetValue()
Definition: Frame.h:127
Definition: CanandgyroData.h:74
Definition: CanandgyroData.h:17
Definition: CanandgyroFaults.h:13
Definition: CanandgyroSettings.h:54
Definition: Canandgyro.h:110
CanandgyroFaults GetStickyFaults()
Definition: Canandgyro.h:340
frc::Rotation3d GetRotation3d()
Definition: Canandgyro.h:164
redux::frames::Frame< CanandgyroStatus > status
Definition: Canandgyro.h:131
CanandgyroStatus GetStatus()
Definition: Canandgyro.h:360
units::turn_t GetRoll()
Definition: Canandgyro.h:222
void SetPartyMode(uint8_t level)
units::turns_per_second_t GetAngularVelocityPitch()
Definition: Canandgyro.h:235
units::standard_gravity_t GetAccelerationY()
Definition: Canandgyro.h:253
bool SetYaw(units::turn_t yaw, units::second_t timeout=20_ms)
CanandgyroFaults GetActiveFaults()
Definition: Canandgyro.h:348
units::turn_t GetYaw()
Definition: Canandgyro.h:190
bool WaitForCalibrationToFinish(units::second_t timeout)
redux::canand::CanandSettingsManager< CanandgyroSettings > stg
Definition: Canandgyro.h:134
units::turns_per_second_t GetAngularVelocityRoll()
Definition: Canandgyro.h:229
units::celsius_t GetTemperature()
Definition: Canandgyro.h:354
units::standard_gravity_t GetAccelerationX()
Definition: Canandgyro.h:247
redux::frames::Frame< bool > calibrating
Definition: Canandgyro.h:113
units::turn_t GetPitch()
Definition: Canandgyro.h:215
redux::frames::Frame< units::turn_t > singleYaw
Definition: Canandgyro.h:116
redux::frames::Frame< units::turn_t > multiYaw
Definition: Canandgyro.h:119
bool SetPose(frc::Quaternion newPose, units::second_t timeout=20_ms)
void UseDedicatedYawAngleFrame(bool use)
Definition: Canandgyro.h:181
redux::frames::Frame< frc::Quaternion > quat
Definition: Canandgyro.h:122
bool SetPoseR3D(frc::Rotation3d newPose, units::second_t timeout=20_ms)
Definition: Canandgyro.h:308
units::turns_per_second_t GetAngularVelocityYaw()
Definition: Canandgyro.h:241
redux::frames::Frame< Acceleration > accel
Definition: Canandgyro.h:128
bool IsCalibrating()
Definition: Canandgyro.h:273
redux::frames::Frame< AngularVelocity > vel
Definition: Canandgyro.h:125
frc::Quaternion GetQuaternion()
Definition: Canandgyro.h:156
bool SetPoseRPY(units::turn_t newRoll, units::turn_t newPitch, units::turn_t newYaw, units::second_t timeout=20_ms)
Definition: Canandgyro.h:296
units::turn_t GetMultiturnYaw()
Definition: Canandgyro.h:206
units::standard_gravity_t GetAccelerationZ()
Definition: Canandgyro.h:259
frc::Rotation2d GetRotation2d()
Definition: Canandgyro.h:171
@ kResetFactoryDefault
Definition: CanandgyroDetails.h:104
void RemoveCANListener(CanandDevice *device)
Definition: Canandgyro.h:32
Definition: CanandFirmwareVersion.h:17
Definition: CanandgyroStatus.h:13