![]() |
SparkFun Optical Tracking Odometry Sensor
v1.0.2-11-gb69b326
Library for the SparkFun Optical Tracking Odometry Sensor
|
Arduino class for the SparkFun Qwiic Optical Tracking Odometry Sensor (OTOS) More...
#include <SparkFun_Qwiic_OTOS_Arduino_Library.h>
Public Member Functions | |
bool | begin (TwoWire &wirePort=Wire) |
Begins the Qwiic OTOS and verifies it is connected. More... | |
sfTkError_t | begin (sfTkII2C *commBus=nullptr) |
Begins the Qwiic OTOS and verifies it is connected. More... | |
sfTkError_t | isConnected () |
Checks if the device is connected. More... | |
sfTkError_t | getVersionInfo (sfe_otos_version_t &hwVersion, sfe_otos_version_t &fwVersion) |
Gets the hardware and firmware version numbers from the OTOS. More... | |
sfTkError_t | selfTest () |
Performs a self test of the OTOS. More... | |
sfTkError_t | calibrateImu (uint8_t numSamples=255, bool waitUntilDone=true) |
Calibrates the IMU on the OTOS, which removes the accelerometer and gyroscope offsets. More... | |
sfTkError_t | getImuCalibrationProgress (uint8_t &numSamples) |
Gets the progress of the IMU calibration. Used for asynchronous calibration with calibrateImu() More... | |
sfe_otos_linear_unit_t | getLinearUnit () |
Gets the linear unit used by all methods using a pose. More... | |
void | setLinearUnit (sfe_otos_linear_unit_t unit) |
Sets the linear unit used by all methods using a pose. More... | |
sfe_otos_angular_unit_t | getAngularUnit () |
Gets the angular unit used by all methods using a pose. More... | |
void | setAngularUnit (sfe_otos_angular_unit_t unit) |
Sets the angular unit used by all methods using a pose. More... | |
sfTkError_t | getLinearScalar (float &scalar) |
Gets the linear scalar used by the OTOS. More... | |
sfTkError_t | setLinearScalar (float scalar) |
Sets the linear scalar used by the OTOS. Can be used to compensate for scaling issues with the sensor measurements. More... | |
sfTkError_t | getAngularScalar (float &scalar) |
Gets the angular scalar used by the OTOS. More... | |
sfTkError_t | setAngularScalar (float scalar) |
Sets the angular scalar used by the OTOS. Can be used to compensate for scaling issues with the sensor measurements. More... | |
sfTkError_t | resetTracking () |
Resets the tracking algorithm, which resets the position to the origin, but can also be used to recover from some rare tracking errors. More... | |
sfTkError_t | getSignalProcessConfig (sfe_otos_signal_process_config_t &config) |
Gets the signal processing configuration from the OTOS. More... | |
sfTkError_t | setSignalProcessConfig (sfe_otos_signal_process_config_t &config) |
Sets the signal processing configuration on the OTOS. This is primarily useful for creating and testing a new lookup table calibration. More... | |
sfTkError_t | getStatus (sfe_otos_status_t &status) |
Gets the status register from the OTOS, which includes warnings and errors reported by the sensor. More... | |
sfTkError_t | getOffset (sfe_otos_pose2d_t &pose) |
Gets the offset of the OTOS. More... | |
sfTkError_t | setOffset (sfe_otos_pose2d_t &pose) |
Sets the offset of the OTOS. This is useful if your sensor is mounted off-center from a robot. Rather than returning the position of the sensor, the OTOS will return the position of the robot. More... | |
sfTkError_t | getPosition (sfe_otos_pose2d_t &pose) |
Gets the position measured by the OTOS. More... | |
sfTkError_t | setPosition (sfe_otos_pose2d_t &pose) |
Sets the position measured by the OTOS. This is useful if your robot does not start at the origin, or you have another source of location information (eg. vision odometry); the OTOS will continue tracking from this position. More... | |
sfTkError_t | getVelocity (sfe_otos_pose2d_t &pose) |
Gets the velocity measured by the OTOS. More... | |
sfTkError_t | getAcceleration (sfe_otos_pose2d_t &pose) |
Gets the acceleration measured by the OTOS. More... | |
sfTkError_t | getPositionStdDev (sfe_otos_pose2d_t &pose) |
Gets the standard deviation of the measured position. More... | |
sfTkError_t | getVelocityStdDev (sfe_otos_pose2d_t &pose) |
Gets the standard deviation of the measured velocity. More... | |
sfTkError_t | getAccelerationStdDev (sfe_otos_pose2d_t &pose) |
Gets the standard deviation of the measured acceleration. More... | |
sfTkError_t | getPosVelAcc (sfe_otos_pose2d_t &pos, sfe_otos_pose2d_t &vel, sfe_otos_pose2d_t &acc) |
Gets the position, velocity, and acceleration measured by the OTOS in a single burst read. More... | |
sfTkError_t | getPosVelAccStdDev (sfe_otos_pose2d_t &pos, sfe_otos_pose2d_t &vel, sfe_otos_pose2d_t &acc) |
Gets the standard deviation of the measured position, velocity, and acceleration in a single burst read. More... | |
sfTkError_t | getPosVelAccAndStdDev (sfe_otos_pose2d_t &pos, sfe_otos_pose2d_t &vel, sfe_otos_pose2d_t &acc, sfe_otos_pose2d_t &posStdDev, sfe_otos_pose2d_t &velStdDev, sfe_otos_pose2d_t &accStdDev) |
Gets the position, velocity, acceleration, and standard deviation of each in a single burst read. More... | |
Static Public Attributes | |
static constexpr uint8_t | kDefaultAddress = 0x17 |
Default I2C addresses of the Qwiic OTOS. More... | |
static constexpr float | kMinScalar = 0.872f |
Minimum scalar value for the linear and angular scalars. More... | |
static constexpr float | kMaxScalar = 1.127f |
Maximum scalar value for the linear and angular scalars. More... | |
Protected Member Functions | |
void | delayMs (uint32_t ms) |
sfTkError_t | readPoseRegs (uint8_t reg, sfe_otos_pose2d_t &pose, float rawToXY, float rawToH) |
sfTkError_t | writePoseRegs (uint8_t reg, sfe_otos_pose2d_t &pose, float xyToRaw, float hToRaw) |
void | regsToPose (uint8_t *rawData, sfe_otos_pose2d_t &pose, float rawToXY, float rawToH) |
void | poseToRegs (uint8_t *rawData, sfe_otos_pose2d_t &pose, float xyToRaw, float hToRaw) |
Protected Attributes | |
sfTkII2C * | _commBus |
sfe_otos_linear_unit_t | _linearUnit |
sfe_otos_angular_unit_t | _angularUnit |
float | _meterToUnit |
float | _radToUnit |
Static Protected Attributes | |
static constexpr uint8_t | kRegProductId = 0x00 |
static constexpr uint8_t | kRegHwVersion = 0x01 |
static constexpr uint8_t | kRegFwVersion = 0x02 |
static constexpr uint8_t | kRegScalarLinear = 0x04 |
static constexpr uint8_t | kRegScalarAngular = 0x05 |
static constexpr uint8_t | kRegImuCalib = 0x06 |
static constexpr uint8_t | kRegReset = 0x07 |
static constexpr uint8_t | kRegSignalProcess = 0x0E |
static constexpr uint8_t | kRegSelfTest = 0x0F |
static constexpr uint8_t | kRegOffXL = 0x10 |
static constexpr uint8_t | kRegOffXH = 0x11 |
static constexpr uint8_t | kRegOffYL = 0x12 |
static constexpr uint8_t | kRegOffYH = 0x13 |
static constexpr uint8_t | kRegOffHL = 0x14 |
static constexpr uint8_t | kRegOffHH = 0x15 |
static constexpr uint8_t | kRegStatus = 0x1F |
static constexpr uint8_t | kRegPosXL = 0x20 |
static constexpr uint8_t | kRegPosXH = 0x21 |
static constexpr uint8_t | kRegPosYL = 0x22 |
static constexpr uint8_t | kRegPosYH = 0x23 |
static constexpr uint8_t | kRegPosHL = 0x24 |
static constexpr uint8_t | kRegPosHH = 0x25 |
static constexpr uint8_t | kRegVelXL = 0x26 |
static constexpr uint8_t | kRegVelXH = 0x27 |
static constexpr uint8_t | kRegVelYL = 0x28 |
static constexpr uint8_t | kRegVelYH = 0x29 |
static constexpr uint8_t | kRegVelHL = 0x2A |
static constexpr uint8_t | kRegVelHH = 0x2B |
static constexpr uint8_t | kRegAccXL = 0x2C |
static constexpr uint8_t | kRegAccXH = 0x2D |
static constexpr uint8_t | kRegAccYL = 0x2E |
static constexpr uint8_t | kRegAccYH = 0x2F |
static constexpr uint8_t | kRegAccHL = 0x30 |
static constexpr uint8_t | kRegAccHH = 0x31 |
static constexpr uint8_t | kRegPosStdXL = 0x32 |
static constexpr uint8_t | kRegPosStdXH = 0x33 |
static constexpr uint8_t | kRegPosStdYL = 0x34 |
static constexpr uint8_t | kRegPosStdYH = 0x35 |
static constexpr uint8_t | kRegPosStdHL = 0x36 |
static constexpr uint8_t | kRegPosStdHH = 0x37 |
static constexpr uint8_t | kRegVelStdXL = 0x38 |
static constexpr uint8_t | kRegVelStdXH = 0x39 |
static constexpr uint8_t | kRegVelStdYL = 0x3A |
static constexpr uint8_t | kRegVelStdYH = 0x3B |
static constexpr uint8_t | kRegVelStdHL = 0x3C |
static constexpr uint8_t | kRegVelStdHH = 0x3D |
static constexpr uint8_t | kRegAccStdXL = 0x3E |
static constexpr uint8_t | kRegAccStdXH = 0x3F |
static constexpr uint8_t | kRegAccStdYL = 0x40 |
static constexpr uint8_t | kRegAccStdYH = 0x41 |
static constexpr uint8_t | kRegAccStdHL = 0x42 |
static constexpr uint8_t | kRegAccStdHH = 0x43 |
static constexpr uint8_t | kProductId = 0x5F |
static constexpr float | kMeterToInch = 39.37f |
static constexpr float | kInchToMeter = 1.0f / kMeterToInch |
static constexpr float | kRadianToDegree = 180.0f / M_PI |
static constexpr float | kDegreeToRadian = M_PI / 180.0f |
static constexpr float | kMeterToInt16 = 32768.0f / 10.0f |
static constexpr float | kInt16ToMeter = 1.0f / kMeterToInt16 |
static constexpr float | kMpsToInt16 = 32768.0f / 5.0f |
static constexpr float | kInt16ToMps = 1.0f / kMpsToInt16 |
static constexpr float | kMpssToInt16 = 32768.0f / (16.0f * 9.80665f) |
static constexpr float | kInt16ToMpss = 1.0f / kMpssToInt16 |
static constexpr float | kRadToInt16 = 32768.0f / M_PI |
static constexpr float | kInt16ToRad = 1.0f / kRadToInt16 |
static constexpr float | kRpsToInt16 = 32768.0f / (2000.0f * kDegreeToRadian) |
static constexpr float | kInt16ToRps = 1.0f / kRpsToInt16 |
static constexpr float | kRpssToInt16 = 32768.0f / (M_PI * 1000.0f) |
static constexpr float | kInt16ToRpss = 1.0f / kRpssToInt16 |
Arduino class for the SparkFun Qwiic Optical Tracking Odometry Sensor (OTOS)
|
inherited |
Begins the Qwiic OTOS and verifies it is connected.
commBus | I2C bus to use for communication |
|
inline |
Begins the Qwiic OTOS and verifies it is connected.
wirePort | Wire port to use for I2C communication |
|
inherited |
Calibrates the IMU on the OTOS, which removes the accelerometer and gyroscope offsets.
numSamples | Number of samples to take for calibration. Each sample takes about 2.4ms, so fewer samples can be taken for faster calibration |
waitUntilDone | Whether to wait until the calibration is complete. Set false to calibrate asynchronously, see getImuCalibrationProgress() |
|
inlineprotectedvirtual |
Implements sfDevOTOS.
|
inherited |
Gets the acceleration measured by the OTOS.
pose | Acceleration measured by the OTOS |
|
inherited |
Gets the standard deviation of the measured acceleration.
pose | Standard deviation of the acceleration measured by the OTOS |
|
inherited |
Gets the angular scalar used by the OTOS.
scalar | Angular scalar |
|
inherited |
Gets the angular unit used by all methods using a pose.
|
inherited |
Gets the progress of the IMU calibration. Used for asynchronous calibration with calibrateImu()
numSamples | Number of samples remaining for calibration |
|
inherited |
Gets the linear scalar used by the OTOS.
scalar | Linear scalar |
|
inherited |
Gets the linear unit used by all methods using a pose.
|
inherited |
Gets the offset of the OTOS.
pose | Offset of the sensor relative to the center of the robot |
|
inherited |
Gets the position measured by the OTOS.
pose | Position measured by the OTOS |
|
inherited |
Gets the standard deviation of the measured position.
pose | Standard deviation of the position measured by the OTOS |
|
inherited |
Gets the position, velocity, and acceleration measured by the OTOS in a single burst read.
pos | Position measured by the OTOS |
vel | Velocity measured by the OTOS |
acc | Acceleration measured by the OTOS |
|
inherited |
Gets the position, velocity, acceleration, and standard deviation of each in a single burst read.
pos | Position measured by the OTOS |
vel | Velocity measured by the OTOS |
acc | Acceleration measured by the OTOS |
posStdDev | Standard deviation of the position measured by the OTOS |
velStdDev | Standard deviation of the velocity measured by the OTOS |
accStdDev | Standard deviation of the acceleration measured by the OTOS |
|
inherited |
Gets the standard deviation of the measured position, velocity, and acceleration in a single burst read.
pos | Standard deviation of the position measured by the OTOS |
vel | Standard deviation of the velocity measured by the OTOS |
acc | Standard deviation of the acceleration measured by the OTOS |
|
inherited |
Gets the signal processing configuration from the OTOS.
config | Signal processing configuration |
|
inherited |
Gets the status register from the OTOS, which includes warnings and errors reported by the sensor.
status | Status register value |
|
inherited |
Gets the velocity measured by the OTOS.
pose | Velocity measured by the OTOS |
|
inherited |
Gets the standard deviation of the measured velocity.
pose | Standard deviation of the velocity measured by the OTOS |
|
inherited |
Gets the hardware and firmware version numbers from the OTOS.
hwVersion | Hardware version number |
fwVersion | Firmware version number |
|
inherited |
Checks if the device is connected.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
Resets the tracking algorithm, which resets the position to the origin, but can also be used to recover from some rare tracking errors.
|
inherited |
Performs a self test of the OTOS.
|
inherited |
Sets the angular scalar used by the OTOS. Can be used to compensate for scaling issues with the sensor measurements.
scalar | Angular scalar, must be between 0.872 and 1.127 |
|
inherited |
Sets the angular unit used by all methods using a pose.
unit | Angular unit |
|
inherited |
Sets the linear scalar used by the OTOS. Can be used to compensate for scaling issues with the sensor measurements.
scalar | Linear scalar, must be between 0.872 and 1.127 |
|
inherited |
Sets the linear unit used by all methods using a pose.
unit | Linear unit |
|
inherited |
Sets the offset of the OTOS. This is useful if your sensor is mounted off-center from a robot. Rather than returning the position of the sensor, the OTOS will return the position of the robot.
pose | Offset of the sensor relative to the center of the robot |
|
inherited |
Sets the position measured by the OTOS. This is useful if your robot does not start at the origin, or you have another source of location information (eg. vision odometry); the OTOS will continue tracking from this position.
pose | New position for the OTOS to track from |
|
inherited |
Sets the signal processing configuration on the OTOS. This is primarily useful for creating and testing a new lookup table calibration.
config | Signal processing configuration |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
staticconstexprinherited |
Default I2C addresses of the Qwiic OTOS.
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprinherited |
Maximum scalar value for the linear and angular scalars.
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprinherited |
Minimum scalar value for the linear and angular scalars.
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |
|
staticconstexprprotectedinherited |