Helper class to use with a L3G4200D gyro sensor.
More...
#include <Gyro.h>
|
| | Gyro () |
| | Constructs a helper for sensor L3G4200D. More...
|
| |
| | ~Gyro () |
| | Close the thread if it was running. More...
|
| |
| void | calibrate (short samples=100) |
| | Compute the offset from error of the last X samples The gyro must be on a plane surface. More...
|
| |
| void | readGyro (double &vx, double &vy, double &vz) |
| | Read all X, Y and Z values from the gyro registers. More...
|
| |
| void | startFreeRunningMode (std::function< void(double &, double &)> func) |
| | Start a thread to run infinitely that will check the gyro values. More...
|
| |
| void | stopFreeRunningMode () |
| | Stop the running thread. More...
|
| |
Helper class to use with a L3G4200D gyro sensor.
- Examples
- project_angle.cpp, and project_pendulum.cpp.
Definition at line 39 of file Gyro.h.
◆ Gyro()
Constructs a helper for sensor L3G4200D.
Definition at line 9 of file Gyro.cpp.
◆ ~Gyro()
Close the thread if it was running.
Definition at line 151 of file Gyro.cpp.
◆ calibrate()
| void Gyro::calibrate |
( |
short |
samples = 100 | ) |
|
Compute the offset from error of the last X samples The gyro must be on a plane surface.
- Parameters
-
| samples | the number of samples to average the offset from |
- Examples
- project_angle.cpp, and project_pendulum.cpp.
Definition at line 32 of file Gyro.cpp.
◆ readGyro()
| void Gyro::readGyro |
( |
double & |
vx, |
|
|
double & |
vy, |
|
|
double & |
vz |
|
) |
| |
Read all X, Y and Z values from the gyro registers.
- Parameters
-
| vx | x value |
| vy | y value |
| vz | z value |
Definition at line 70 of file Gyro.cpp.
◆ startFreeRunningMode()
| void Gyro::startFreeRunningMode |
( |
std::function< void(double &, double &)> |
func | ) |
|
Start a thread to run infinitely that will check the gyro values.
- Parameters
-
| func | callback function, that will receive the elapsed time and the x value |
- Examples
- project_angle.cpp, and project_pendulum.cpp.
Definition at line 95 of file Gyro.cpp.
◆ stopFreeRunningMode()
| void Gyro::stopFreeRunningMode |
( |
| ) |
|
Stop the running thread.
Definition at line 144 of file Gyro.cpp.
◆ gyro
◆ gyroStatusVal
| uint8_t myRIO::Gyro::gyroStatusVal |
|
private |
◆ regs
| uint8_t* myRIO::Gyro::regs |
|
private |
◆ run
◆ th
| std::thread* myRIO::Gyro::th |
|
private |
◆ xOff
◆ yOff
◆ zOff
The documentation for this class was generated from the following files:
- C:/Users/jackb/OneDrive - etu.univ-lyon1.fr/TERi/Eclipse/workspace/APIForRIO/src/Gyro.h
- C:/Users/jackb/OneDrive - etu.univ-lyon1.fr/TERi/Eclipse/workspace/APIForRIO/src/Gyro.cpp