CTRE Phoenix 6 C++ 25.0.0-beta-4
Loading...
Searching...
No Matches
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 Device to which this simulation state is attached
43 */
45 /* disallow copy, allow move */
50
51 /**
52 * \brief Sets the simulated supply voltage of the Pigeon2.
53 *
54 * \details The minimum allowed supply voltage is 4 V - values below this
55 * will be promoted to 4 V.
56 *
57 * \param volts The supply voltage in Volts
58 * \returns Status code
59 */
60 ctre::phoenix::StatusCode SetSupplyVoltage(units::voltage::volt_t volts);
61 /**
62 * \brief Sets the simulated raw yaw of the Pigeon2.
63 *
64 * Inputs to this function over time should be continuous, as user calls of hardware#Pigeon2#SetYaw will be accounted for in the callee.
65 *
66 * \details The Pigeon2 integrates this to calculate the true reported yaw.
67 *
68 * When using the WPI Sim GUI, you will notice a readonly `yaw` and settable `rawYawInput`.
69 * The readonly signal is the emulated yaw which will match self-test in Tuner and the hardware API.
70 * Changes to `rawYawInput` will be integrated into the emulated yaw.
71 * This way a simulator can modify the yaw without overriding hardware API calls for home-ing the sensor.
72 *
73 * \param deg The yaw in degrees
74 * \returns Status code
75 */
76 ctre::phoenix::StatusCode SetRawYaw(units::angle::degree_t deg);
77 /**
78 * \brief Adds to the simulated yaw of the Pigeon2.
79 *
80 * \param dDeg
81 * The change in yaw in degrees
82 * \returns Status code
83 */
84 ctre::phoenix::StatusCode AddYaw(units::angle::degree_t dDeg);
85 /**
86 * \brief Sets the simulated pitch of the Pigeon2.
87 *
88 * \param deg The pitch in degrees
89 * \returns Status code
90 */
91 ctre::phoenix::StatusCode SetPitch(units::angle::degree_t deg);
92 /**
93 * \brief Sets the simulated roll of the Pigeon2.
94 *
95 * \param deg
96 * The roll in degrees
97 * \returns Status code
98 */
99 ctre::phoenix::StatusCode SetRoll(units::angle::degree_t deg);
100 /**
101 * \brief Sets the simulated angular velocity X component of the Pigeon2.
102 *
103 * \param dps The X component of the angular velocity in degrees per second
104 * \returns Status code
105 */
106 ctre::phoenix::StatusCode SetAngularVelocityX(units::angular_velocity::degrees_per_second_t dps);
107 /**
108 * \brief Sets the simulated angular velocity Y component of the Pigeon2.
109 *
110 * \param dps The Y component of the angular velocity in degrees per second
111 * \returns Status code
112 */
113 ctre::phoenix::StatusCode SetAngularVelocityY(units::angular_velocity::degrees_per_second_t dps);
114 /**
115 * \brief Sets the simulated angular velocity Z component of the Pigeon2.
116 *
117 * \param dps The Z component of the angular velocity in degrees per second
118 * \returns Status code
119 */
120 ctre::phoenix::StatusCode SetAngularVelocityZ(units::angular_velocity::degrees_per_second_t dps);
121 };
122
123}
124
125}
126}
Class description for the Pigeon 2 IMU sensor that measures orientation.
Definition CorePigeon2.hpp:1116
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
Definition StatusCodes.h:18