ReduxLib C++ 2024.3.2
Loading...
Searching...
No Matches
Canandgyro.h
1// Copyright (c) Redux Robotics and other contributors.
2// This is open source and can be modified and shared under the 3-clause BSD license.
3
4#pragma once
5#include <cinttypes>
6#include <unordered_map>
7#include <mutex>
8#include <condition_variable>
9#include <optional>
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>
17
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"
28
29/**
30 * Namespace for all classes relating to the Canandgyro
31*/
33
34/**
35 * Class for the CAN interface of the <a href="https://docs.reduxrobotics.com/canandgyro/index.html">canandgyro.</a>
36 *
37 * <p>
38 * The C++ vendordep uses the <a href="https://docs.wpilib.org/en/stable/docs/software/basic-programming/cpp-units.html">units library</a>
39 * for all dimensioned values, including settings.
40 * </p>
41 *
42 * <p>
43 * Operations that receive data from the device (position, velocity, faults, temperature) generally do not block.
44 * The object receives data asynchronously from the CAN packet receive thread and reads thus return the last data received.
45 * </p>
46 * <p>
47 * Operations that set settings or change offsets will generally wait for up to 20ms by default as they will usually
48 * wait for a confirmation packet to be received in response -- unless the blocking timeout is set to zero, in which case
49 * the operation swill not block.
50 * </p>
51 *
52 * Example code:
53 * ```cpp
54 * Canandgyro canandgyro{0}; // instantiates with device id 0
55 *
56 * // Reading angular position
57 * canandgyro.GetYaw(); // gets the yaw (Z-axis) value in units::turn_t [-180 deg inclusive..180 deg exclusive)
58 * // This is probably what you want to use for robot heading.
59 * canandgyro.GetMultiturnYaw(); // also gets yaw, except without a wraparound
60 * canandgyro.GetPitch(); // pitch (Y-axis) value
61 * canandgyro.GetRoll(); // roll (X-axis) value
62 * canandgyro.GetRotation2d(); // Z-axis Rotation2d object
63 * canandgyro.GetRotation3d(); // Full 3d rotation object
64 * canandgyro.GetQuaternion(); // Raw rotation quaternion object
65 *
66 * // Reading angular velocity (all in rotations per second)
67 * canandgyro.GetAngularVelocityYaw();
68 * canandgyro.GetAngularVelocityPitch();
69 * canandgyro.GetAngularVelocityRoll();
70 *
71 * // Linear acceleration (gravitational units)
72 * canandgyro.GetAccelerationX();
73 * canandgyro.GetAccelerationY();
74 * canandgyro.GetAccelerationZ();
75 *
76 * // Updating pose:
77 * canandgyro.SetYaw(0.25_tr); // set yaw to 0.25 rotations positive
78 *
79 * // set roll, pitch, yaw as 0.0, 0.1, and 0.25 rotations with 20 ms timeout
80 * canandgyro.SetPoseRPY(0.0_tr, 0.1_tr, 0.25_tr, 20_ms);
81 * // SetPose
82 *
83 * // Manually calibrating:
84 * // The Canandgyro automatically calibrates on boot, but you may want to force a calibration.
85 * // Calibration takes several seconds!!!
86 *
87 * canandgyro.StartCalibration(); // begin calibration
88 * canandgyro.IsCalibrating(); // check if the gyro is still calibrating
89 * canandgyro.WaitForCalibrationToFinish(5_s); // wait up to 5 seconds for calibration to finish.
90 *
91 * // Faults
92 * canandgyro.ClearStickyFaults(); // clears all sticky faults (including the power cycle flag).
93 * // This call does not block.
94 *
95 *
96 * // this flag will always be true on boot until the sticky faults have been cleared,
97 * // so if this prints true the encoder has rebooted sometime between ClearStickyFaults and now.
98 * CanandgyroFaults faults = canandgyro.GetStickyFaults(); // fetches faults
99 * fmt::print("Device rebooted: {}\n", faults.powerCycle);
100 *
101 * // Timestamped data
102 * // gets current angular position + timestamp together
103 * auto& quatFrameData = canandgyro.GetAngularPositionFrame();
104 * quatFrameData.GetValue(); // fetched quaternion object
105 * quatFrameData.GetValue().W(); // fetched quaternion W component
106 * quatFrameData.GetTimestamp(); // timestamp of the quaternion data
107 * ```
108 *
109 */
111 protected:
112 /** internal Frame variable used to track if the device is calibrating */
114
115 /** internal Frame variable holding current yaw position state */
117
118 /** internal Frame variable holding current yaw position state */
120
121 /** internal Frame variable holding current angular position state */
123
124 /** internal Frame variable holding current angular velocity state */
126
127 /** internal Frame variable holding current acceleration state */
129
130 /** internal Frame variable holding current status value state */
132
133 /** internal settings manager */
135 private:
136
137 bool dataRecvOnce{false};
138 bool useYawAngleFrame{true};
139 units::second_t lastMessageTime{0_s};
140 //redux::canand::CooldownWarning setAbsPositionWarning{1_s, 5};
142
143 public:
144 /**
145 * Constructor with the device's id. This object will be constant with respect to whatever CAN id assigned to it,
146 * so if a device changes id it may change which device this object reads from.
147 * @param canID the device id to use
148 */
149 Canandgyro(int canID);
151
152 /**
153 * Gets a quaternion object of the gyro's 3d rotation from the zero point
154 * @return a Quaternion of the current Canandgyro pose
155 */
156 inline frc::Quaternion GetQuaternion() { return quat.GetValue(); }
157
158 /**
159 * Gets an frc::Rotation3d object of the gyro's 3d rotation from the zero point
160 * If you just want Z-axis rotation use GetYaw().
161 *
162 * @return a Rotation3d of the current Canandgyro pose
163 */
164 inline frc::Rotation3d GetRotation3d() { return frc::Rotation3d{quat.GetValue()}; }
165
166 /**
167 * Gets an frc::Rotation2d object representing the rotation around the yaw axis from the zero point
168 * If you just want Z-axis rotation use GetYaw().
169 * @return a Rotation2d of the current Canandgyro yaw
170 */
171 inline frc::Rotation2d GetRotation2d() { return frc::Rotation2d(this->GetYaw()); }
172
173 /**
174 * Sets whether this object should use the dedicated yaw message for yaw angle instead of
175 * deriving it from the pose quaternion frame.
176 *
177 * By default this is true, as the yaw angle frame is more precise and by default more frequent.
178 *
179 * @param use use the yaw angle
180 */
181 inline void UseDedicatedYawAngleFrame(bool use) { this->useYawAngleFrame = use; }
182
183 /**
184 * Gets the yaw (Z-axis) rotation from [-0.5 rotations inclusive..0.5 exclusive).
185 *
186 * This is probably the function you want to use for applications like field-centric control.
187 *
188 * @return yaw in rotational units.
189 */
190 inline units::turn_t GetYaw() {
191 if (this->useYawAngleFrame) {
192 return this->singleYaw.GetValue();
193 } else {
194 return this->GetRotation3d().Z();
195 }
196 }
197
198 /**
199 * Gets a multi-turn yaw (Z-axis) rotation that tracks to multiple continuous rotations.
200 *
201 * Note that this relies on the dedicated multi-turn yaw packet so if it is disabled via
202 * setYawFramePeriod it will not return fresh data.
203 *
204 * @return multi-turn yaw in rotational units.
205 */
206 inline units::turn_t GetMultiturnYaw() {
207 return this->multiYaw.GetValue();
208 }
209
210 /**
211 * Gets the pitch (Y-axis) rotation from [-0.5 rotations inclusive..0.5 exclusive).
212 *
213 * @return pitch in rotational units.
214 */
215 inline units::turn_t GetPitch() { return this->GetRotation3d().Y(); }
216
217 /**
218 * Gets the roll (X-axis) rotation from [-0.5 rotations inclusive..0.5 exclusive).
219 *
220 * @return roll in rotational units.
221 */
222 inline units::turn_t GetRoll() { return this->GetRotation3d().X(); }
223
224
225 /**
226 * Gets the angular velocity along the roll (X) axis.
227 * @return angular velocity
228 */
229 inline units::turns_per_second_t GetAngularVelocityRoll() { return vel.GetValue().Roll(); }
230
231 /**
232 * Gets the angular velocity along the pitch (Y) axis.
233 * @return angular velocity
234 */
235 inline units::turns_per_second_t GetAngularVelocityPitch() { return vel.GetValue().Pitch(); }
236
237 /**
238 * Gets the angular velocity along the yaw (Z) axis.
239 * @return angular velocity
240 */
241 inline units::turns_per_second_t GetAngularVelocityYaw() { return vel.GetValue().Yaw(); }
242
243 /**
244 * Gets the linear acceleration along the X axis.
245 * @return linear acceleration
246 */
247 inline units::standard_gravity_t GetAccelerationX() { return accel.GetValue().X(); }
248
249 /**
250 * Gets the linear acceleration along the Y axis.
251 * @return linear acceleration in Gs
252 */
253 inline units::standard_gravity_t GetAccelerationY() { return accel.GetValue().Y(); }
254
255 /**
256 * Gets the linear acceleration along the Z axis.
257 * @return linear acceleration
258 */
259 inline units::standard_gravity_t GetAccelerationZ() { return accel.GetValue().Z(); }
260
261 /**
262 * Begins calibration on the Canandgyro.
263 *
264 * This takes several seconds. To check the state of calibration, use IsCalibrating or
265 * WaitForCalibrationToFinish.
266 */
268
269 /**
270 * Returns if the Canandgyro is known to be currently calibrating.
271 * @return if the Canandgyro is calibrating
272 */
273 inline bool IsCalibrating() {
274 return calibrating.GetValue();
275 }
276
277 /**
278 * Blocks the current thread until the Canandgyro has finished calibrating or until a timeout is reached.
279 *
280 * @param timeout the timeout in seconds to wait for a calibration confirmation.
281 * @return true if the calibration has finished within the timeout, false if not.
282 */
283 bool WaitForCalibrationToFinish(units::second_t timeout);
284
285 /**
286 * Sets a new angular position pose without recalibrating with a given roll/pitch/yaw.
287 * If you just want to set yaw, use SetYaw.
288 *
289 * @param newRoll new roll (x) pose
290 * @param newPitch new pitch (y) pose
291 * @param newYaw new yaw (z) pose
292 * @param timeout the timeout in seconds to wait for a pose set confirmation.
293 * Set to 0 to not check (always return true.)
294 * @return true if a pose set confirmation was received (or if timeout is zero)
295 */
296 inline bool SetPoseRPY(units::turn_t newRoll, units::turn_t newPitch, units::turn_t newYaw, units::second_t timeout = 20_ms) {
297 return SetPose(frc::Rotation3d(newRoll, newPitch, newYaw).GetQuaternion(), timeout);
298 }
299
300 /**
301 * Sets a new angular position without recalibrating with an frc::Rotation3d.
302 *
303 * @param newPose new rotation3d pose
304 * @param timeout the timeout in seconds to wait for a pose set confirmation.
305 * Set to 0 to not check (always return true.)
306 * @return true if a pose set confirmation was received (or if timeout is zero)
307 */
308 inline bool SetPoseR3D(frc::Rotation3d newPose, units::second_t timeout = 20_ms) {
309 return SetPose(newPose.GetQuaternion(), timeout);
310 }
311
312 /**
313 * Sets a new pose without recalibrating with an frc::Quaternion.
314 *
315 * @param newPose new quaternion pose
316 * @param timeout the timeout in seconds to wait for a pose set confirmation.
317 * Set to 0 to not check (always return true.)
318 * @return true if a pose set confirmation was received (or if timeout is zero)
319 */
320 bool SetPose(frc::Quaternion newPose, units::second_t timeout = 20_ms);
321
322 /**
323 * Sets a new yaw without recalibrating the Canandgyro.
324 * Blocks for up to 50 milliseconds by default to confirm the transaction.
325 * @param yaw new yaw angle in rotations
326 * @param timeout the timeout in seconds to block to confirm the transaction (set 0 to not block)
327 * @return true if a confirmation was received or the timeout is zero
328 */
329 bool SetYaw(units::turn_t yaw, units::second_t timeout = 20_ms);
330
331
332 // functions related to diagonstic data
333
334 /**
335 * Fetches sticky faults.
336 * Sticky faults are the active faults, except once set they do not become unset until ClearStickyFaults() is called.
337 *
338 * @return canandgyroFaults of the sticky faults
339 */
340 inline CanandgyroFaults GetStickyFaults() { return status.GetValue().stickyFaults; }
341
342 /**
343 * Fetches active faults.
344 * Active faults are only active for as long as the error state exists.
345 *
346 * @return canandgyroFaults of the active faults
347 */
348 CanandgyroFaults GetActiveFaults() { return status.GetValue().activeFaults; }
349
350 /**
351 * Get onboard encoder temperature readings in degrees Celsius.
352 * @return temperature in degrees Celsius
353 */
354 units::celsius_t GetTemperature() { return status.GetValue().temperature; }
355
356 /**
357 * Get the contents of the previous status packet, which includes active faults, sticky faults, and temperature.
358 * @return device status as a status struct
359 */
360 inline CanandgyroStatus GetStatus() { return status.GetValue(); }
361
362 /**
363 * Clears sticky faults.
364 *
365 * <p>It is recommended to clear this during initialization, so one can check if the encoder loses power during operation later. </p>
366 * <p>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.</p>
367 */
369
370 /**
371 * Controls "party mode" -- an encoder identification tool that blinks the onboard LED
372 * various colors if level != 0.
373 *
374 * This function does not block.
375 *
376 * @param level the party level value to set.
377 */
378 void SetPartyMode(uint8_t level);
379
380 // functions relating to settings
381
382 /**
383 * Fetches the device's current configuration in a blocking manner.
384 * <p>This method works by requesting the device first send back all settings, and then waiting
385 * for up to a specified timeout for all settings to be received by the robot controller.
386 * If the timeout is zero, this step is skipped.
387 *
388 * <p>If there are settings that were not received by the timeout, then this function will
389 * attempt to individually fetched each setting for up to a specified number of attempts.
390 * If the fresh argument is true and the timeout argument is 0, then only this latter step runs,
391 * which can be used to only fetch settings that are missing from the known settings cache
392 * returned by GetSettingsAsync.
393 *
394 * <p>The resulting set of known (received) settings is then returned, complete or not.
395 *
396 * <p>This function blocks, so it is best to put this in init routines rather than a main loop.
397 *
398 * ```cpp
399 * // device declaration
400 * Canandgyro canandgyro{0};
401 *
402 * // in your init/other sequence
403 * CanandgyroSettings stg = canandgyro.GetSettings();
404 * if (stg.AllSettingsReceived()) {
405 * // do your thing here
406 * } else {
407 * // handle missing settings
408 * }
409 * ```
410 *
411 * <p>Advanced users can use this function to retry settings missed from StartFetchSettings: </p>
412 * ```cpp
413 * // device declaration
414 * Canandgyro canandgyro{0};
415 * enc.StartFetchSettings(); // send a "fetch settings command"
416 *
417 * // wait some amount of time
418 * CanandgyroSettings stg = enc.GetSettingsAsync();
419 * stg.AllSettingsReceived(); // may or may not be true
420 *
421 * stg = enc.GetSettings(0_ms, 20_ms, 3); // Retry getitng the missing settings.
422 * stg.AllSettingsReceived(); // far more likely to be true
423 *
424 * @param timeout maximum number of seconds to wait for a settings operation before timing out (default 350_ms)
425 * @param missingTimeout maximum number of seconds to wait for each settings retry before giving up
426 * @param attempts number of attempts to try and fetch values missing from the first pass
427 * @return Received set of CanandgyroSettings of device configuration.
428 */
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);
431 };
432
433 /**
434 * Tells the Canandgyro to begin transmitting its settings; once they are all transmitted (after ~200-300ms),
435 * the values can be retrieved through the Canandgyro::GetSettingsAsync() function call
436 */
437 inline void StartFetchSettings() { return stg.StartFetchSettings(); }
438
439 /**
440 * Non-blockingly returns a CanandgyroSettings object of the most recent known settings values received from the encoder.
441 *
442 * <p> <b>Most users will probably want to use canandgyro::GetSettings() instead. </b> </p>
443 *
444 * One can call this after a Canandgyro::StartFetchSettings() call, and use CanandgyroSettings::AllSettingsReceived()
445 * to check if/when all values have been seen. As an example:
446 *
447 * ```cpp
448 *
449 * // device declaration
450 * canandgyro enc{0};
451 *
452 * // somewhere in an init function
453 * enc.StartFetchSettings();
454 *
455 * // ...
456 * // somewhere in a loop function
457 *
458 * CanandgyroSettings stg = enc.GetSettingsAsync();
459 * if (stg.AllSettingsReceived()) {
460 * // do something with the returned settings
461 * fmt::print("Device status frame period: {}\n", *stg.GetStatusFramePeriod());
462 * }
463 * ```
464 *
465 *
466 * If this is called after Canandgyro::SetSettings(), this method will return a settings object where only
467 * the fields where the device has echoed the new values back will be populated. To illustrate this, consider the following:
468 * ```cpp
469 * // device declaration
470 * Canandgyro enc{0};
471 *
472 * // somewhere in a loop
473 * CanandgyroSettings stg_set;
474 * stg_set.SetStatusFramePeriod(100_ms);
475 * enc.SetSettings(stg_set);
476 * CanandgyroSettings stg_get = enc.GetSettingsAsync();
477 *
478 * // will likely return std::nullopt, as the device likely hasn't already responded to the settings set request
479 * stg_get.GetStatusFramePeriod();
480 *
481 * // after up to 100 ms...
482 * stg_get = enc.GetSettingsAsync();
483 *
484 * // 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
485 * stg_get.GetStatusFramePeriod();
486 * ```
487 *
488 * @return CanandgyroSettings of currently known settings
489 */
490 inline CanandgyroSettings GetSettingsAsync() { return stg.GetKnownSettings(); }
491
492 /**
493 * Applies the settings from a CanandgyroSettings object to the Canandgyro.
494 * For more information, see the CanandgyroSettings class documentation.
495 *
496 * Example:
497 * ```cpp
498 * CanandgyroSettings stg;
499 * Canandgyro enc{0};
500 * // After configuring the settings object...
501 *
502 * CanandgyroSettings failed = enc.SetSettings(stg);
503 * if (failed.IsEmpty()) {
504 * // success
505 * } else {
506 * // handle failed settings
507 * }
508 * ```
509 *
510 * @param settings the CanandgyroSettings to update the encoder with
511 * @param timeout maximum time in seconds to wait for each setting to be confirmed. (default 0.020s, set to 0 to not check and not block).
512 * @param attempts the maxinum number of attempts to write each individual settings
513 * @return CanandgyroSettings object of unsuccessfully set settings.
514 */
515 inline CanandgyroSettings SetSettings(CanandgyroSettings& settings, units::second_t timeout = 20_ms, uint32_t attempts = 3) {
516 return stg.SetSettings(settings, timeout, attempts);
517 }
518
519 /**
520 * Resets the encoder to factory defaults, and then wait for all settings to be broadcasted
521 * back.
522 * @param clearZero whether to clear the zero offset from the encoder's memory as well
523 * @param timeout how long to wait for the new settings to be confirmed by the encoder in
524 * seconds (suggested at least 0.35 seconds)
525 * @return CanandgyroSettings object of received settings.
526 * Use CanandgyroSettings.AllSettingsReceived() to verify success.
527 */
528 inline CanandgyroSettings ResetFactoryDefaults(units::second_t timeout = 350_ms) {
529 return stg.SendReceiveSettingCommand(details::types::SettingCommand::kResetFactoryDefault, timeout, true);
530 }
531
532 /**
533 * Returns the CanandSettingsManager associated with this device.
534 *
535 * The CanandSettingsManager is an internal helper object.
536 * Teams are typically not expected to use it except for advanced cases (e.g. custom settings
537 * wrappers)
538 * @return internal settings manager handle
539 */
540 inline redux::canand::CanandSettingsManager<CanandgyroSettings>& GetInternalSettingsManager() {
541 return stg;
542 }
543
544 /**
545 * Returns the current single-turn yaw frame, which includes CAN timestamp data.
546 * redux::canand::FrameData objects are immutable.
547 * @return the current yaw frame
548 */
549 inline redux::frames::Frame<units::turn_t>& GetYawFrame() { return singleYaw; }
550
551 /**
552 * Returns the current multi-turn yaw frame, which includes CAN timestamp data.
553 * redux::canand::FrameData objects are immutable.
554 * @return the current yaw frame
555 */
556 inline redux::frames::Frame<units::turn_t>& GetMultiturnYawFrame() { return multiYaw; }
557
558 /**
559 * Returns the current angular position frame, which includes CAN timestamp data.
560 * @return the current angular position frame
561 */
562 inline redux::frames::Frame<frc::Quaternion>& GetAngularPositionFrame() { return quat; }
563
564 /**
565 * Returns the current angular velocity frame, which includes CAN timestamp data.
566 * @return the current angular velocity frame
567 */
568 inline redux::frames::Frame<AngularVelocity>& GetVelocityFrame() { return vel; }
569
570 /**
571 * Returns the current acceleration frame, which includes CAN timestamp data.
572 * @return the current acceleration frame
573 */
574 inline redux::frames::Frame<Acceleration>& GetAccelerationFrame() { return accel; }
575
576 /**
577 * Returns a handle to the current status frame, which includes CAN timestamp data.
578 * @return the current status frame, as a CanandgyroStatus record.
579 */
580 inline redux::frames::Frame<CanandgyroStatus>& GetStatusFrame() { return status; }
581
582
583 // functions that directly modify settings
586 inline std::string GetDeviceClassName() override { return "Canandgyro"; };
588 return redux::canand::CanandFirmwareVersion{2024, 0, 0};
589 }
590
591};
592
593
594}
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
Definition: Frame.h:89
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
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