WPILibC++ 2024.3.2
ADIS16470_IMUSim.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <hal/SimDevice.h>
9#include <units/angle.h>
11
12namespace frc {
13
14class ADIS16470_IMU;
15
16namespace sim {
17
18/**
19 * Class to control a simulated ADIS16470 IMU.
20 */
22 public:
23 /**
24 * Constructs from a ADIS16470_IMU object.
25 *
26 * @param imu ADIS16470_IMU to simulate
27 */
28 explicit ADIS16470_IMUSim(const ADIS16470_IMU& imu);
29
30 /**
31 * Sets the X axis angle (CCW positive).
32 *
33 * @param angle The angle.
34 */
35 void SetGyroAngleX(units::degree_t angle);
36
37 /**
38 * Sets the Y axis angle (CCW positive).
39 *
40 * @param angle The angle.
41 */
42 void SetGyroAngleY(units::degree_t angle);
43
44 /**
45 * Sets the Z axis angle (CCW positive).
46 *
47 * @param angle The angle.
48 */
49 void SetGyroAngleZ(units::degree_t angle);
50
51 /**
52 * Sets the X axis angular rate (CCW positive).
53 *
54 * @param angularRate The angular rate.
55 */
56 void SetGyroRateX(units::degrees_per_second_t angularRate);
57
58 /**
59 * Sets the Y axis angular rate (CCW positive).
60 *
61 * @param angularRate The angular rate.
62 */
63 void SetGyroRateY(units::degrees_per_second_t angularRate);
64
65 /**
66 * Sets the Z axis angular rate (CCW positive).
67 *
68 * @param angularRate The angular rate.
69 */
70 void SetGyroRateZ(units::degrees_per_second_t angularRate);
71
72 /**
73 * Sets the X axis acceleration.
74 *
75 * @param accel The acceleration.
76 */
77 void SetAccelX(units::meters_per_second_squared_t accel);
78
79 /**
80 * Sets the Y axis acceleration.
81 *
82 * @param accel The acceleration.
83 */
84 void SetAccelY(units::meters_per_second_squared_t accel);
85
86 /**
87 * Sets the Z axis acceleration.
88 *
89 * @param accel The acceleration.
90 */
91 void SetAccelZ(units::meters_per_second_squared_t accel);
92
93 private:
94 hal::SimDouble m_simGyroAngleX;
95 hal::SimDouble m_simGyroAngleY;
96 hal::SimDouble m_simGyroAngleZ;
97 hal::SimDouble m_simGyroRateX;
98 hal::SimDouble m_simGyroRateY;
99 hal::SimDouble m_simGyroRateZ;
100 hal::SimDouble m_simAccelX;
101 hal::SimDouble m_simAccelY;
102 hal::SimDouble m_simAccelZ;
103};
104
105} // namespace sim
106} // namespace frc
Use DMA SPI to read rate and acceleration data from the ADIS16470 IMU and return the robot's heading ...
Definition: ADIS16470_IMU.h:52
Class to control a simulated ADIS16470 IMU.
Definition: ADIS16470_IMUSim.h:21
void SetGyroAngleY(units::degree_t angle)
Sets the Y axis angle (CCW positive).
void SetGyroRateX(units::degrees_per_second_t angularRate)
Sets the X axis angular rate (CCW positive).
void SetGyroRateZ(units::degrees_per_second_t angularRate)
Sets the Z axis angular rate (CCW positive).
void SetGyroAngleZ(units::degree_t angle)
Sets the Z axis angle (CCW positive).
void SetGyroAngleX(units::degree_t angle)
Sets the X axis angle (CCW positive).
void SetAccelX(units::meters_per_second_squared_t accel)
Sets the X axis acceleration.
ADIS16470_IMUSim(const ADIS16470_IMU &imu)
Constructs from a ADIS16470_IMU object.
void SetAccelY(units::meters_per_second_squared_t accel)
Sets the Y axis acceleration.
void SetGyroRateY(units::degrees_per_second_t angularRate)
Sets the Y axis angular rate (CCW positive).
void SetAccelZ(units::meters_per_second_squared_t accel)
Sets the Z axis acceleration.
C++ wrapper around a HAL simulator double value handle.
Definition: SimDevice.h:533
Definition: AprilTagPoseEstimator.h:15