Class GyroSensor. API for working with gyro sensor. More...
#include <ev3cxx_gyro_sensor.h>
Public Member Functions | |
GyroSensor (SensorPort port) | |
Constructor of class GyroSensor. More... | |
int | angle () |
Get angle in degrees from gyro. More... | |
int | rate () |
Get angular speed from gyro. Speed = degrees per seconde. More... | |
void | reset () |
Reset gyro. More... | |
void | resetHard () |
Hard reset gyro. Solve the problem with drifting value after standard reset(). More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Sensor | |
Sensor (SensorPort port, sensor_type_t type) | |
Constructor of class Sensor. More... | |
virtual | ~Sensor () |
Destructor of class Sensor. | |
sensor_port_t | getPort () |
Get sensor port set in constructor. More... | |
sensor_type_t | getType () |
Get actual sensor type. More... | |
Protected Attributes inherited from Sensor | |
sensor_port_t | m_port |
sensor_type_t | m_type |
Class GyroSensor. API for working with gyro sensor.
Definition at line 20 of file ev3cxx_gyro_sensor.h.
|
inline |
Constructor of class GyroSensor.
port | Port index (1-4). |
Definition at line 28 of file ev3cxx_gyro_sensor.h.
References GyroSensor::resetHard().
|
inline |
Get angle in degrees from gyro.
Not recommended use angle() and rate() in same time => call rate() reset initial position in angle().
Definition at line 39 of file ev3cxx_gyro_sensor.h.
Referenced by GyroSensor::resetHard().
|
inline |
Get angular speed from gyro. Speed = degrees per seconde.
Not recommended use angle() and rate() in same time => call rate() reset initial position in angle().
Definition at line 49 of file ev3cxx_gyro_sensor.h.
Referenced by GyroSensor::resetHard().
|
inline |
Reset gyro.
Set the zero value on gyro when the robot not move => affect the angle() and rate() values Doesn't work everytime: https://bricks.stackexchange.com/questions/7115/how-can-ev3-gyro-sensor-drift-be-handled Then you need resetHard().
Definition at line 60 of file ev3cxx_gyro_sensor.h.
Referenced by GyroSensor::resetHard().
|
inline |
Hard reset gyro. Solve the problem with drifting value after standard reset().
Set firstly gyro to one mode (angle) => then reset() => second mode (rate) => reset() => first mode (angle)
Definition at line 69 of file ev3cxx_gyro_sensor.h.
References GyroSensor::angle(), GyroSensor::rate(), and GyroSensor::reset().
Referenced by GyroSensor::GyroSensor().