okapi::OdomState struct

Contents

Public functions

auto str(QLength idistanceUnit, QAngle iangleUnit) const -> std::string
Get a string for the current odometry state (optionally with the specified units).
auto str(QLength idistanceUnit = meter, std::string distUnitName = "_m", QAngle iangleUnit = degree, std::string angleUnitName = "_deg") const -> std::string
Get a string for the current odometry state (optionally with the specified units).
auto operator==(const OdomState& rhs) const -> bool
auto operator!=(const OdomState& rhs) const -> bool

Public variables

QLength x
QLength y
QAngle theta

Function documentation

std::string okapi::OdomState::str(QLength idistanceUnit, QAngle iangleUnit) const

Get a string for the current odometry state (optionally with the specified units).

Parameters
idistanceUnit The units you want your distance to be in. This must be an exact, predefined QLength (such as foot, meter, inch, tile etc.).
iangleUnit The units you want your angle to be in. This must be an exact, predefined QAngle (degree or radian).
Returns A string representing the state.

Examples:

  • OdomState::str(1_m, 1_deg): The default (no arguments specified).
  • OdomState::str(1_tile, 1_radian): distance tiles and angle radians.

Throws std::domain_error if the units passed are undefined.

std::string okapi::OdomState::str(QLength idistanceUnit = meter, std::string distUnitName = "_m", QAngle iangleUnit = degree, std::string angleUnitName = "_deg") const

Get a string for the current odometry state (optionally with the specified units).

Parameters
idistanceUnit The units you want your distance to be in. The x or y position will be output in multiples of this length.
distUnitName The suffix you as your distance unit.
iangleUnit The units you want your angle to be in. The angle will be output in multiples of this unit.
angleUnitName The suffix you want as your angle unit.
Returns A string representing the state.

Examples:

  • OdomState::str(1_m, "_m", 1_deg, "_deg"): The default (no arguments specified), prints in meters and degrees.
  • OdomState::str(1_in, "_in", 1_deg, "_deg") or OdomState::str(1_in, "\"", 1_deg, "°")</tt>: to print values in inches and degrees with different suffixes. - <tt>OdomState::str(6_tile / 100, "%", 360_deg / 100, "%") to get the distance values in % of the vex field, and angle values in % of a full rotation.