FRC Paradigm Shift #1259
Documentation for the 2021 Robot
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Gyro.cpp
Go to the documentation of this file.
1
#include "
common/Gyro.h
"
2
3
4
Gyro::Gyro
() : m_gyro(0) {}
5
6
double
Gyro::GetHeading
()
7
{
8
auto
heading = std::remainder(
m_gyro
.GetFusedHeading(), 360.0) * (
kGyroReversed
? -1. : 1.);
9
if
(heading > 180.0)
10
heading -= 360.0;
11
12
return
heading;
13
}
14
15
void
Gyro::ZeroHeading
()
16
{
17
m_gyro
.SetFusedHeading(0.0, 0);
18
}
19
20
double
Gyro::GetTurnRate
()
21
{
22
double
turnRates [3] = {0, 0, 0};
23
m_gyro
.GetRawGyro(turnRates);
24
return
turnRates[2] * (
kGyroReversed
? -1. : 1.);
25
}
Gyro.h
Gyro::m_gyro
PigeonIMU m_gyro
Definition:
Gyro.h:31
Gyro::GetTurnRate
double GetTurnRate()
Definition:
Gyro.cpp:20
Gyro::Gyro
Gyro()
Definition:
Gyro.cpp:4
DriveConstants::kGyroReversed
constexpr bool kGyroReversed
Definition:
Constants.h:75
Gyro::GetHeading
double GetHeading()
Definition:
Gyro.cpp:6
Gyro::ZeroHeading
void ZeroHeading()
Zeroes the heading of the robot.
Definition:
Gyro.cpp:15
src
main
cpp
common
Gyro.cpp
Generated on Fri Aug 20 2021 01:20:35 for FRC Paradigm Shift #1259 by
1.8.11