CTRE Phoenix 6 C++ 24.3.0
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/voltage.h>
13
14namespace ctre {
15namespace phoenix6 {
16
17namespace hardware {
18namespace core {
19 /* forward proto */
20 class CorePigeon2;
21}
22}
23
24namespace sim {
25
26 /**
27 * \brief Class to control the state of a simulated hardware#Pigeon2.
28 */
30 {
31 private:
32 int _id;
33
34 public:
35 /**
36 * \brief Creates an object to control the state of the given hardware#Pigeon2.
37 *
38 * \details Note the recommended method of accessing simulation features is to
39 * use hardware#Pigeon2#GetSimState.
40 *
41 * \param device
42 * 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
58 * The supply voltage in Volts
59 * \returns Status code
60 */
61 ctre::phoenix::StatusCode SetSupplyVoltage(units::voltage::volt_t volts);
62 /**
63 * \brief Sets the simulated raw yaw of the Pigeon2.
64 *
65 * Inputs to this function over time should be continuous, as user calls of hardware#Pigeon2#SetYaw will be accounted for in the callee.
66 *
67 * \details The Pigeon2 integrates this to calculate the true reported yaw.
68 *
69 * When using the WPI Sim GUI, you will notice a readonly `yaw` and settable `rawYawInput`.
70 * The readonly signal is the emulated yaw which will match self-test in Tuner and the hardware API.
71 * Changes to `rawYawInput` will be integrated into the emulated yaw.
72 * This way a simulator can modify the yaw without overriding hardware API calls for home-ing the sensor.
73 *
74 * \param deg
75 * The yaw in degrees
76 * \returns Status code
77 */
78 ctre::phoenix::StatusCode SetRawYaw(units::angle::degree_t deg);
79 /**
80 * \brief Adds to the simulated yaw of the Pigeon2.
81 *
82 * \param dDeg
83 * The change in yaw in degrees
84 * \returns Status code
85 */
86 ctre::phoenix::StatusCode AddYaw(units::angle::degree_t dDeg);
87 /**
88 * \brief Sets the simulated pitch of the Pigeon2.
89 *
90 * \param deg
91 * The pitch in degrees
92 * \returns Status code
93 */
94 ctre::phoenix::StatusCode SetPitch(units::angle::degree_t deg);
95 /**
96 * \brief Sets the simulated roll of the Pigeon2.
97 *
98 * \param deg
99 * The roll in degrees
100 * \returns Status code
101 */
102 ctre::phoenix::StatusCode SetRoll(units::angle::degree_t deg);
103 };
104
105}
106
107}
108}
Class description for the Pigeon 2 IMU sensor that measures orientation.
Definition: CorePigeon2.hpp:988
Class to control the state of a simulated hardware::Pigeon2.
Definition: Pigeon2SimState.hpp:30
ctre::phoenix::StatusCode SetRoll(units::angle::degree_t deg)
Sets the simulated roll 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 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 SetRawYaw(units::angle::degree_t deg)
Sets the simulated raw yaw of the Pigeon2.
Definition: string_util.hpp:15