#include <IMU.hpp>
|
| | IMU (std::uint8_t iport, IMUAxes iaxis=IMUAxes::z) |
| | An inertial sensor on the given port.
|
| |
| double | get () const override |
| | Get the current rotation about the configured axis.
|
| |
| double | getRemapped (double iupperBound=1800, double ilowerBound=-1800) const |
| | Get the current sensor value remapped into the target range ([-1800, 1800] by default).
|
| |
| double | getAcceleration () const |
| | Get the current acceleration along the configured axis.
|
| |
| std::int32_t | reset () override |
| | Reset the rotation value to zero.
|
| |
| std::int32_t | reset (double inewAngle) |
| | Resets rotation value to desired value For example, reset(0) will reset the sensor to zero.
|
| |
| std::int32_t | calibrate () |
| | Calibrate the IMU.
|
| |
| double | controllerGet () override |
| | Get the sensor value for use in a control loop.
|
| |
| bool | isCalibrating () const |
| |
| virtual | ~RotarySensor () |
| |
|
| double | readAngle () const |
| | Get the current rotation about the configured axis.
|
| |
Definition at line 19 of file IMU.hpp.
◆ IMU()
An inertial sensor on the given port.
The IMU returns an angle about the selected axis in degrees.
- Parameters
-
| iport | The port number in the range [1, 21]. |
| iaxis | The axis of the inertial sensor to measure, default IMUAxes::z. |
◆ calibrate()
| std::int32_t okapi::IMU::calibrate |
( |
| ) |
|
Calibrate the IMU.
Resets the rotation value to zero. Calibration is expected to take two seconds, but is bounded to five seconds.
- Returns
1 or PROS_ERR.
◆ controllerGet()
| double okapi::IMU::controllerGet |
( |
| ) |
|
|
overridevirtual |
Get the sensor value for use in a control loop.
This method might be automatically called in another thread by the controller.
- Returns
- The current sensor value or
PROS_ERR.
Implements okapi::ControllerInput< double >.
◆ get()
| double okapi::IMU::get |
( |
| ) |
const |
|
overridevirtual |
Get the current rotation about the configured axis.
- Returns
- The current sensor value or
PROS_ERR.
Implements okapi::RotarySensor.
◆ getAcceleration()
| double okapi::IMU::getAcceleration |
( |
| ) |
const |
Get the current acceleration along the configured axis.
- Returns
- The current sensor value or
PROS_ERR.
◆ getRemapped()
| double okapi::IMU::getRemapped |
( |
double |
iupperBound = 1800, |
|
|
double |
ilowerBound = -1800 |
|
) |
| const |
Get the current sensor value remapped into the target range ([-1800, 1800] by default).
- Parameters
-
| iupperBound | The upper bound of the range. |
| ilowerBound | The lower bound of the range. |
- Returns
- The remapped sensor value.
◆ isCalibrating()
| bool okapi::IMU::isCalibrating |
( |
| ) |
const |
- Returns
- Whether the IMU is calibrating.
◆ readAngle()
| double okapi::IMU::readAngle |
( |
| ) |
const |
|
protected |
Get the current rotation about the configured axis.
The internal offset is not accounted for or modified. This just reads from the sensor.
- Returns
- The current sensor value or
PROS_ERR.
◆ reset() [1/2]
| std::int32_t okapi::IMU::reset |
( |
| ) |
|
|
overridevirtual |
◆ reset() [2/2]
| std::int32_t okapi::IMU::reset |
( |
double |
inewAngle | ) |
|
Resets rotation value to desired value For example, reset(0) will reset the sensor to zero.
But reset(90) will reset the sensor to 90 degrees.
- Parameters
-
| inewAngle | desired reset value |
- Returns
1 or PROS_ERR.
◆ axis
◆ offset
| double okapi::IMU::offset = 0 |
|
protected |
◆ port
| std::uint8_t okapi::IMU::port |
|
protected |
The documentation for this class was generated from the following file:
- include/okapi/impl/device/rotarysensor/IMU.hpp