CTRE_Phoenix 5.20.2
WPI_PigeonIMU.h
1
11#pragma once
12
13#include "ctre/phoenix/sensors/PigeonIMU.h"
14#include "ctre/phoenix/motorcontrol/can/TalonSRX.h"
15#include "ctre/phoenix/WPI_CallbackHelper.h"
16
17#include <mutex>
18
19//Need to disable certain warnings for WPI headers.
20#if __GNUC__
21#pragma GCC diagnostic push
22#pragma GCC diagnostic ignored "-Wconversion"
23#elif _MSC_VER
24#pragma warning(push)
25#pragma warning(disable : 4522 4458 4522)
26#endif
27
28#include "frc/interfaces/Gyro.h"
29#include "frc/geometry/Rotation2d.h"
30#include "wpi/sendable/Sendable.h"
31#include "wpi/sendable/SendableHelper.h"
32#include "wpi/raw_ostream.h"
33#include <hal/SimDevice.h>
34
35//Put the warning settings back to normal
36#if __GNUC__
37#pragma GCC diagnostic pop
38#elif _MSC_VER
39#pragma warning(pop)
40#endif
41
42namespace ctre
43{
44namespace phoenix
45{
46namespace sensors
47{
48
49class WPI_PigeonIMU : public PigeonIMU,
50 public frc::Gyro,
51 public wpi::Sendable,
52 public wpi::SendableHelper<WPI_PigeonIMU>
53{
54 public:
60 WPI_PigeonIMU(int deviceNumber);
67
69
70 WPI_PigeonIMU() = delete;
71 WPI_PigeonIMU(WPI_PigeonIMU const &) = delete;
72 WPI_PigeonIMU &operator=(WPI_PigeonIMU const &) = delete;
73
74 void InitSendable(wpi::SendableBuilder& builder) override;
75
76 void Calibrate() final {} //Pigeon doesn't need manual cal
77 void Reset() final;
78 double GetAngle() const override;
79 double GetRate() const override;
80
81 frc::Rotation2d GetRotation2d() const override;
82
83 private:
84 void Init();
85
86 DeviceType m_simType;
87
88 hal::SimDevice m_simPigeon;
89 hal::SimDouble m_simFusedHeading;
90 hal::SimDouble m_simRawHeading;
91
92 static void OnValueChanged(const char* name, void* param, HAL_SimValueHandle handle,
93 HAL_Bool readonly, const struct HAL_Value* value);
94 static void OnPeriodic(void* param);
95};
96
97} //namespace sensors
98} //namespace phoenix
99} //namespace ctre
Definition: PigeonIMU.h:84
Definition: WPI_PigeonIMU.h:53
WPI_PigeonIMU(ctre::phoenix::motorcontrol::can::TalonSRX &talon)
Definition: ErrorCode.h:5