CTRE Phoenix 6 C++ 24.50.0-alpha-2
Pigeon2SimState.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) Cross The Road Electronics.  All rights reserved.
3 * License information can be found in CTRE_LICENSE.txt
4 * For support and suggestions contact support@ctr-electronics.com or file
5 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
6 */
7#pragma once
8
11#include <units/angle.h>
12#include <units/angular_velocity.h>
13#include <units/voltage.h>
14
15namespace ctre {
16namespace phoenix6 {
17
18namespace hardware {
19namespace core {
20 /* forward proto */
21 class CorePigeon2;
22}
23}
24
25namespace sim {
26
27 /**
28 * \brief Class to control the state of a simulated hardware#Pigeon2.
29 */
31 {
32 private:
33 int _id;
34
35 public:
36 /**
37 * \brief Creates an object to control the state of the given hardware#Pigeon2.
38 *
39 * \details Note the recommended method of accessing simulation features is to
40 * use hardware#Pigeon2#GetSimState.
41 *
42 * \param device
43 * Device to which this simulation state is attached
44 */
46 /* disallow copy, allow move */
51
52 /**
53 * \brief Sets the simulated supply voltage of the Pigeon2.
54 *
55 * \details The minimum allowed supply voltage is 4 V - values below this
56 * will be promoted to 4 V.
57 *
58 * \param volts
59 * The supply voltage in Volts
60 * \returns Status code
61 */
62 ctre::phoenix::StatusCode SetSupplyVoltage(units::voltage::volt_t volts);
63 /**
64 * \brief Sets the simulated raw yaw of the Pigeon2.
65 *
66 * Inputs to this function over time should be continuous, as user calls of hardware#Pigeon2#SetYaw will be accounted for in the callee.
67 *
68 * \details The Pigeon2 integrates this to calculate the true reported yaw.
69 *
70 * When using the WPI Sim GUI, you will notice a readonly `yaw` and settable `rawYawInput`.
71 * The readonly signal is the emulated yaw which will match self-test in Tuner and the hardware API.
72 * Changes to `rawYawInput` will be integrated into the emulated yaw.
73 * This way a simulator can modify the yaw without overriding hardware API calls for home-ing the sensor.
74 *
75 * \param deg
76 * The yaw in degrees
77 * \returns Status code
78 */
79 ctre::phoenix::StatusCode SetRawYaw(units::angle::degree_t deg);
80 /**
81 * \brief Adds to the simulated yaw of the Pigeon2.
82 *
83 * \param dDeg
84 * The change in yaw in degrees
85 * \returns Status code
86 */
87 ctre::phoenix::StatusCode AddYaw(units::angle::degree_t dDeg);
88 /**
89 * \brief Sets the simulated pitch of the Pigeon2.
90 *
91 * \param deg
92 * The pitch in degrees
93 * \returns Status code
94 */
95 ctre::phoenix::StatusCode SetPitch(units::angle::degree_t deg);
96 /**
97 * \brief Sets the simulated roll of the Pigeon2.
98 *
99 * \param deg
100 * The roll in degrees
101 * \returns Status code
102 */
103 ctre::phoenix::StatusCode SetRoll(units::angle::degree_t deg);
104 /**
105 * \brief Sets the simulated angular velocity X component of the Pigeon2.
106 *
107 * \param dps
108 * The X component of the angular velocity in degrees per second
109 * \returns Status code
110 */
111 ctre::phoenix::StatusCode SetAngularVelocityX(units::angular_velocity::degrees_per_second_t dps);
112 /**
113 * \brief Sets the simulated angular velocity Y component of the Pigeon2.
114 *
115 * \param dps
116 * The Y component of the angular velocity in degrees per second
117 * \returns Status code
118 */
119 ctre::phoenix::StatusCode SetAngularVelocityY(units::angular_velocity::degrees_per_second_t dps);
120 /**
121 * \brief Sets the simulated angular velocity Z component of the Pigeon2.
122 *
123 * \param dps
124 * The Z component of the angular velocity in degrees per second
125 * \returns Status code
126 */
127 ctre::phoenix::StatusCode SetAngularVelocityZ(units::angular_velocity::degrees_per_second_t dps);
128 };
129
130}
131
132}
133}
Class description for the Pigeon 2 IMU sensor that measures orientation.
Definition: CorePigeon2.hpp:1076
Class to control the state of a simulated hardware::Pigeon2.
Definition: Pigeon2SimState.hpp:31
ctre::phoenix::StatusCode SetRoll(units::angle::degree_t deg)
Sets the simulated roll of the Pigeon2.
ctre::phoenix::StatusCode SetAngularVelocityZ(units::angular_velocity::degrees_per_second_t dps)
Sets the simulated angular velocity Z component of the Pigeon2.
Pigeon2SimState(Pigeon2SimState &&)=default
Pigeon2SimState & operator=(Pigeon2SimState const &)=delete
ctre::phoenix::StatusCode SetSupplyVoltage(units::voltage::volt_t volts)
Sets the simulated supply voltage of the Pigeon2.
ctre::phoenix::StatusCode SetAngularVelocityY(units::angular_velocity::degrees_per_second_t dps)
Sets the simulated angular velocity Y component of the Pigeon2.
ctre::phoenix::StatusCode AddYaw(units::angle::degree_t dDeg)
Adds to the simulated yaw of the Pigeon2.
Pigeon2SimState(hardware::core::CorePigeon2 const &device)
Creates an object to control the state of the given hardware::Pigeon2.
Pigeon2SimState & operator=(Pigeon2SimState &&)=default
ctre::phoenix::StatusCode SetPitch(units::angle::degree_t deg)
Sets the simulated pitch of the Pigeon2.
Pigeon2SimState(Pigeon2SimState const &)=delete
ctre::phoenix::StatusCode SetAngularVelocityX(units::angular_velocity::degrees_per_second_t dps)
Sets the simulated angular velocity X component of the Pigeon2.
ctre::phoenix::StatusCode SetRawYaw(units::angle::degree_t deg)
Sets the simulated raw yaw of the Pigeon2.
Status codes reported by APIs, including OK, warnings, and errors.
Definition: StatusCodes.h:27
Represents the state of one swerve module.
Definition: StatusCodes.h:18