class
RotationSensor
Contents
Base classes
- class ContinuousRotarySensor
Constructors, destructors, conversion operators
- RotationSensor(std::uint8_t iport, bool ireversed = false)
- A rotation sensor in a V5 port.
Public functions
- auto get() const -> double override
- Get the current rotation in degrees.
- auto reset() -> std::int32_t override
- Reset the sensor to zero.
- auto controllerGet() -> double override
- Get the sensor value for use in a control loop.
- auto getVelocity() const -> double
- Get the current rotational velocity estimate in degrees per second.
Protected variables
Function documentation
okapi:: RotationSensor:: RotationSensor(std::uint8_t iport,
bool ireversed = false)
A rotation sensor in a V5 port.
Parameters | |
---|---|
iport | The V5 port the device uses. |
ireversed | Whether the sensor is reversed. This will set the reversed state in the kernel. |
auto r = RotationSensor(1); auto reversedR = RotationSensor(1, true);
double okapi:: RotationSensor:: get() const override
Get the current rotation in degrees.
Returns | The current rotation in degrees or PROS_ERR_F if the operation failed, setting errno . |
---|
std::int32_t okapi:: RotationSensor:: reset() override
Reset the sensor to zero.
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno . |
---|
double okapi:: RotationSensor:: controllerGet() override
Get the sensor value for use in a control loop.
Returns | The same as get. |
---|
This method might be automatically called in another thread by the controller.
double okapi:: RotationSensor:: getVelocity() const
Get the current rotational velocity estimate in degrees per second.
Returns | The current rotational velocity estimate in degrees per second or PROS_ERR_F if the operation failed, setting errno . |
---|