11#include <wpi/hal/SimDevice.hpp>
12#include <wpi/math/geometry/Rotation2d.hpp>
13#include <wpi/math/geometry/Rotation3d.hpp>
14#include <wpi/telemetry/TelemetryLoggable.hpp>
20#if defined(_WIN32) || defined(_WIN64)
22#pragma warning(disable : 4250)
44 wpi::hal::SimDevice m_simPigeon;
45 wpi::hal::SimDouble m_simSupplyVoltage;
46 wpi::hal::SimDouble m_simYaw;
47 wpi::hal::SimDouble m_simRawYaw;
48 wpi::hal::SimDouble m_simPitch;
49 wpi::hal::SimDouble m_simRoll;
50 wpi::hal::SimDouble m_simAngularVelocityX;
51 wpi::hal::SimDouble m_simAngularVelocityY;
52 wpi::hal::SimDouble m_simAngularVelocityZ;
54 int32_t m_simPeriodicUid{-1};
55 std::vector<int32_t> m_simValueChangedUids;
57 static void OnValueChanged(
58 const char* name,
void* param, HAL_SimValueHandle handle,
59 HAL_Bool readonly,
const struct HAL_Value* value
61 static void OnPeriodic(
void* param);
107 return wpi::math::Rotation2d{m_yaw.Refresh().GetValue()};
127 return wpi::math::Quaternion{m_quatW.GetValue(), m_quatX.GetValue(), m_quatY.GetValue(), m_quatZ.GetValue()};
135 void LogTo(wpi::telemetry::TelemetryTable &table)
const override;
145#if defined(_WIN32) || defined(_WIN64)
static ctre::phoenix::StatusCode RefreshAll(Signals &... signals)
Performs a non-blocking refresh on all provided signals.
Definition StatusSignal.hpp:391
Class for getting information about an available CAN bus.
Definition CANBus.hpp:142
Represents a status signal with data of type T, and operations available to retrieve information abou...
Definition StatusSignal.hpp:523
wpi::math::Rotation2d GetRotation2d() const
Returns the heading of the Pigeon 2 as a wpi::math::Rotation2d.
Definition Pigeon2.hpp:104
Pigeon2(int deviceId, CANBus canbus)
Constructs a new Pigeon 2 sensor object.
void Reset()
Resets the Pigeon 2 to a heading of zero.
Definition Pigeon2.hpp:92
std::string_view GetTelemetryType() const override
Gets the telemetry table type.
Definition Pigeon2.hpp:142
wpi::math::Rotation3d GetRotation3d() const
Returns the orientation of the Pigeon 2 as a wpi::math::Rotation3d created from the quaternion signal...
Definition Pigeon2.hpp:115
void LogTo(wpi::telemetry::TelemetryTable &table) const override
Logs the object to a wpi::telemetry::TelemetryTable.
static Pigeon2 None()
Constructs a stubbed-out Pigeon2, where all status signals, controls, configs, etc.
Definition Pigeon2.hpp:81
wpi::math::Quaternion GetQuaternion() const
Returns the orientation of the Pigeon 2 as a wpi::math::Quaternion.
Definition Pigeon2.hpp:124
Class for the Pigeon 2 IMU sensor that measures orientation.
Definition CorePigeon2.hpp:1058
StatusSignal< wpi::units::scalar_t > & GetQuatX(bool refresh=true)
The X component of the reported Quaternion.
StatusSignal< wpi::units::degree_t > & GetRoll(bool refresh=true)
Current reported roll of the Pigeon2.
ctre::phoenix::StatusCode SetYaw(wpi::units::degree_t newValue, wpi::units::second_t timeoutSeconds)
The yaw to set the Pigeon2 to right now.
Definition CorePigeon2.hpp:2449
StatusSignal< wpi::units::scalar_t > & GetQuatW(bool refresh=true)
The W component of the reported Quaternion.
StatusSignal< wpi::units::scalar_t > & GetQuatY(bool refresh=true)
The Y component of the reported Quaternion.
StatusSignal< wpi::units::degree_t > & GetYaw(bool refresh=true)
Current reported yaw of the Pigeon2.
StatusSignal< wpi::units::scalar_t > & GetQuatZ(bool refresh=true)
The Z component of the reported Quaternion.
StatusSignal< wpi::units::degree_t > & GetPitch(bool refresh=true)
Current reported pitch of the Pigeon2.
Definition ExternalFeedbackConfigs.hpp:17
Definition ExternalFeedbackConfigs.hpp:16
Definition motor_constants.h:14