CTRE Phoenix 6 C++ 25.2.1
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 /**
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 The yaw in degrees
75 * \returns Status code
76 */
77 ctre::phoenix::StatusCode SetRawYaw(units::angle::degree_t deg);
78 /**
79 * \brief Adds to the simulated yaw of the Pigeon2.
80 *
81 * \param dDeg
82 * The change in yaw in degrees
83 * \returns Status code
84 */
85 ctre::phoenix::StatusCode AddYaw(units::angle::degree_t dDeg);
86 /**
87 * \brief Sets the simulated pitch of the Pigeon2.
88 *
89 * \param deg The pitch in degrees
90 * \returns Status code
91 */
92 ctre::phoenix::StatusCode SetPitch(units::angle::degree_t deg);
93 /**
94 * \brief Sets the simulated roll of the Pigeon2.
95 *
96 * \param deg
97 * The roll in degrees
98 * \returns Status code
99 */
100 ctre::phoenix::StatusCode SetRoll(units::angle::degree_t deg);
101
102 /**
103 * \brief Sets the simulated angular velocity X component of the Pigeon2.
104 *
105 * \param dps The X component of the angular velocity in degrees per second
106 * \returns Status code
107 */
108 ctre::phoenix::StatusCode SetAngularVelocityX(units::angular_velocity::degrees_per_second_t dps);
109 /**
110 * \brief Sets the simulated angular velocity Y component of the Pigeon2.
111 *
112 * \param dps The Y component of the angular velocity in degrees per second
113 * \returns Status code
114 */
115 ctre::phoenix::StatusCode SetAngularVelocityY(units::angular_velocity::degrees_per_second_t dps);
116 /**
117 * \brief Sets the simulated angular velocity Z component of the Pigeon2.
118 *
119 * \param dps The Z component of the angular velocity in degrees per second
120 * \returns Status code
121 */
122 ctre::phoenix::StatusCode SetAngularVelocityZ(units::angular_velocity::degrees_per_second_t dps);
123 };
124
125}
126
127}
128}
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 MotionMagicExpoTorqueCurrentFOC.hpp:18