Qwiic_OTOS_Py  2.0.0
Python for SFE Qwiic OTOS
Loading...
Searching...
No Matches
qwiic_otos.QwiicOTOS Class Reference

Class for the SparkFun Qwiic Optical Tracking Odometry Sensor (OTOS). More...

Inheritance diagram for qwiic_otos.QwiicOTOS:

Public Member Functions

def __init__ (self, address=None, i2c_driver=None)
 Constructor. More...
 
def is_connected (self)
 Determines if this device is connected. More...
 
def begin (self)
 Initializes this device with default parameters. More...
 
def getVersionInfo (self)
 Gets the hardware and firmware version numbers from the OTOS. More...
 
def selfTest (self)
 Performs a self-test on the OTOS. More...
 
def calibrateImu (self, numSamples=255, waitUntilDone=True)
 Calibrates the IMU on the OTOS, which removes the accelerometer and gyroscope offsets. More...
 
def getImuCalibrationProgress (self)
 Gets the progress of the IMU calibration. More...
 
def getLinearUnit (self)
 Gets the linear unit used by all methods using a pose. More...
 
def setLinearUnit (self, unit)
 Sets the linear unit used by all methods using a pose. More...
 
def getAngularUnit (self)
 Gets the angular unit used by all methods using a pose. More...
 
def setAngularUnit (self, unit)
 Sets the angular unit used by all methods using a pose. More...
 
def getLinearScalar (self)
 Gets the linear scalar used by the OTOS. More...
 
def setLinearScalar (self, scalar)
 Sets the linear scalar used by the OTOS. More...
 
def getAngularScalar (self)
 Gets the angular scalar used by the OTOS. More...
 
def setAngularScalar (self, scalar)
 Sets the angular scalar used by the OTOS. More...
 
def resetTracking (self)
 Resets the tracking algorithm, which resets the position to the origin, but can also be used to recover from some rare tracking errors. More...
 
def getSignalProcessConfig (self)
 Gets the signal processing configuration from the OTOS. More...
 
def setSignalProcessConfig (self, config)
 Sets the signal processing configuration for the OTOS. More...
 
def getStatus (self)
 Gets the status register from the OTOS, which includes warnings and errors reported by the sensor. More...
 
def getOffset (self)
 Gets the offset of the OTOS. More...
 
def setOffset (self, pose)
 Gets the offset of the OTOS. More...
 
def getPosition (self)
 Gets the position measured by the OTOS. More...
 
def setPosition (self, pose)
 Sets the position measured by the OTOS. More...
 
def getVelocity (self)
 Gets the velocity measured by the OTOS. More...
 
def getAcceleration (self)
 Gets the acceleration measured by the OTOS. More...
 
def getPositionStdDev (self)
 Gets the standard deviation of the measured position. More...
 
def getVelocityStdDev (self)
 Gets the standard deviation of the measured velocity. More...
 
def getAccelerationStdDev (self)
 Gets the standard deviation of the measured acceleration. More...
 
def getPosVelAcc (self)
 Gets the position, velocity, and acceleration measured by the OTOS in a single burst read. More...
 
def getPosVelAccStdDev (self)
 Gets the standard deviation of the measured position, velocity, and acceleration in a single burst read. More...
 
def getPosVelAccAndStdDev (self)
 Gets the position, velocity, acceleration, and standard deviation of each in a single burst read. More...
 

Public Attributes

 address
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESS
 
int kRegProductId = 0x00
 
int kRegHwVersion = 0x01
 
int kRegFwVersion = 0x02
 
int kRegScalarLinear = 0x04
 
int kRegScalarAngular = 0x05
 
int kRegImuCalib = 0x06
 
int kRegReset = 0x07
 
int kRegSignalProcess = 0x0E
 
int kRegSelfTest = 0x0F
 
int kRegOffXL = 0x10
 
int kRegOffXH = 0x11
 
int kRegOffYL = 0x12
 
int kRegOffYH = 0x13
 
int kRegOffHL = 0x14
 
int kRegOffHH = 0x15
 
int kRegStatus = 0x1F
 
int kRegPosXL = 0x20
 
int kRegPosXH = 0x21
 
int kRegPosYL = 0x22
 
int kRegPosYH = 0x23
 
int kRegPosHL = 0x24
 
int kRegPosHH = 0x25
 
int kRegVelXL = 0x26
 
int kRegVelXH = 0x27
 
int kRegVelYL = 0x28
 
int kRegVelYH = 0x29
 
int kRegVelHL = 0x2A
 
int kRegVelHH = 0x2B
 
int kRegAccXL = 0x2C
 
int kRegAccXH = 0x2D
 
int kRegAccYL = 0x2E
 
int kRegAccYH = 0x2F
 
int kRegAccHL = 0x30
 
int kRegAccHH = 0x31
 
int kRegPosStdXL = 0x32
 
int kRegPosStdXH = 0x33
 
int kRegPosStdYL = 0x34
 
int kRegPosStdYH = 0x35
 
int kRegPosStdHL = 0x36
 
int kRegPosStdHH = 0x37
 
int kRegVelStdXL = 0x38
 
int kRegVelStdXH = 0x39
 
int kRegVelStdYL = 0x3A
 
int kRegVelStdYH = 0x3B
 
int kRegVelStdHL = 0x3C
 
int kRegVelStdHH = 0x3D
 
int kRegAccStdXL = 0x3E
 
int kRegAccStdXH = 0x3F
 
int kRegAccStdYL = 0x40
 
int kRegAccStdYH = 0x41
 
int kRegAccStdHL = 0x42
 
int kRegAccStdHH = 0x43
 
int kProductId = 0x5F
 
float kMeterToInch = 39.37
 
float kInchToMeter = 1.0 / kMeterToInch
 
float kRadianToDegree = 180.0 / 3.14159
 
float kDegreeToRadian = 3.14159 / 180.0
 
float kMeterToInt16 = 32768.0 / 10.0
 
float kInt16ToMeter = 1.0 / kMeterToInt16
 
float kMpsToInt16 = 32768.0 / 5.0
 
float kInt16ToMps = 1.0 / kMpsToInt16
 
float kMpssToInt16 = 32768.0 / (16.0 * 9.80665)
 
float kInt16ToMpss = 1.0 / kMpssToInt16
 
float kRadToInt16 = 32768.0 / 3.14159
 
float kInt16ToRad = 1.0 / kRadToInt16
 
float kRpsToInt16 = 32768.0 / (2000.0 * kDegreeToRadian)
 
float kInt16ToRps = 1.0 / kRpsToInt16
 
float kRpssToInt16 = 32768.0 / (3.14159 * 1000.0)
 
float kInt16ToRpss = 1.0 / kRpssToInt16
 
float kMinScalar = 0.872
 
float kMaxScalar = 1.127
 
int kLinearUnitMeters = 0
 
int kLinearUnitInches = 1
 
int kAngularUnitRadians = 0
 
int kAngularUnitDegrees = 1
 

Properties

 connected = property(is_connected)
 

Detailed Description

Class for the SparkFun Qwiic Optical Tracking Odometry Sensor (OTOS).

Includes methods to communicate with the sensor, such as getting the tracked location, configuring the sensor, etc. This class is a base class that must be derived to implement the delay function and I2C communication bus.

Constructor & Destructor Documentation

◆ __init__()

def qwiic_otos.QwiicOTOS.__init__ (   self,
  address = None,
  i2c_driver = None 
)

Constructor.

Parameters
int,optionaladdress: The I2C address to use for the device If not provided, the default address is used
I2CDriver,optionali2c_driver: An existing i2c driver object If not provided, a driver object is created

Member Function Documentation

◆ begin()

def qwiic_otos.QwiicOTOS.begin (   self)

Initializes this device with default parameters.

Returns
bool Returns True if successful, otherwise False

◆ calibrateImu()

def qwiic_otos.QwiicOTOS.calibrateImu (   self,
  numSamples = 255,
  waitUntilDone = True 
)

Calibrates the IMU on the OTOS, which removes the accelerometer and gyroscope offsets.

Parameters
int,optionalnumSamples: Number of samples to take for calibration. Each sample takes about 2.4ms, so fewer samples can be taken for faster calibration, defaults to 255
bool,optionalwaitUntilDone: hether to wait until the calibration is complete. Set false to calibrate asynchronously, see getImuCalibrationProgress(), defaults to True
Returns
bool True if successful, otherwise False

◆ getAcceleration()

def qwiic_otos.QwiicOTOS.getAcceleration (   self)

Gets the acceleration measured by the OTOS.

Returns
Pose2D Acceleration measured by the OTOS

◆ getAccelerationStdDev()

def qwiic_otos.QwiicOTOS.getAccelerationStdDev (   self)

Gets the standard deviation of the measured acceleration.

These values are just the square root of the diagonal elements of the covariance matrices of the Kalman filters used in the firmware, so they are just statistical quantities and do not represent actual error!

Returns
Pose2D Standard deviation of the acceleration measured by the OTOS

◆ getAngularScalar()

def qwiic_otos.QwiicOTOS.getAngularScalar (   self)

Gets the angular scalar used by the OTOS.

Returns
float Angular scalar

◆ getAngularUnit()

def qwiic_otos.QwiicOTOS.getAngularUnit (   self)

Gets the angular unit used by all methods using a pose.

Returns
int Angular unit

◆ getImuCalibrationProgress()

def qwiic_otos.QwiicOTOS.getImuCalibrationProgress (   self)

Gets the progress of the IMU calibration.

Used for asynchronous calibration with calibrateImu()

Returns
int Number of samples remaining for calibration

◆ getLinearScalar()

def qwiic_otos.QwiicOTOS.getLinearScalar (   self)

Gets the linear scalar used by the OTOS.

Returns
float Linear scalar

◆ getLinearUnit()

def qwiic_otos.QwiicOTOS.getLinearUnit (   self)

Gets the linear unit used by all methods using a pose.

Returns
int Linear unit

◆ getOffset()

def qwiic_otos.QwiicOTOS.getOffset (   self)

Gets the offset of the OTOS.

Returns
Pose2D Offset of the sensor relative to the center of the robot

◆ getPosition()

def qwiic_otos.QwiicOTOS.getPosition (   self)

Gets the position measured by the OTOS.

Returns
Pose2D Position measured by the OTOS

◆ getPositionStdDev()

def qwiic_otos.QwiicOTOS.getPositionStdDev (   self)

Gets the standard deviation of the measured position.

These values are just the square root of the diagonal elements of the covariance matrices of the Kalman filters used in the firmware, so they are just statistical quantities and do not represent actual error!

Returns
Pose2D Standard deviation of the position measured by the OTOS

◆ getPosVelAcc()

def qwiic_otos.QwiicOTOS.getPosVelAcc (   self)

Gets the position, velocity, and acceleration measured by the OTOS in a single burst read.

Returns
tuple of Pose2D Position, velocity, and acceleration measured by the OTOS

◆ getPosVelAccAndStdDev()

def qwiic_otos.QwiicOTOS.getPosVelAccAndStdDev (   self)

Gets the position, velocity, acceleration, and standard deviation of each in a single burst read.

Returns
tuple of Pose2D Position, velocity, acceleration, and standard deviation of each measured by the OTOS

◆ getPosVelAccStdDev()

def qwiic_otos.QwiicOTOS.getPosVelAccStdDev (   self)

Gets the standard deviation of the measured position, velocity, and acceleration in a single burst read.

Returns
tuple of Pose2D Standard deviation of the position, velocity, and acceleration measured by the OTOS

◆ getSignalProcessConfig()

def qwiic_otos.QwiicOTOS.getSignalProcessConfig (   self)

Gets the signal processing configuration from the OTOS.

Returns
int Signal processing configuration

◆ getStatus()

def qwiic_otos.QwiicOTOS.getStatus (   self)

Gets the status register from the OTOS, which includes warnings and errors reported by the sensor.

Returns
int Status register value

◆ getVelocity()

def qwiic_otos.QwiicOTOS.getVelocity (   self)

Gets the velocity measured by the OTOS.

Returns
Pose2D Velocity measured by the OTOS

◆ getVelocityStdDev()

def qwiic_otos.QwiicOTOS.getVelocityStdDev (   self)

Gets the standard deviation of the measured velocity.

These values are just the square root of the diagonal elements of the covariance matrices of the Kalman filters used in the firmware, so they are just statistical quantities and do not represent actual error!

Returns
Pose2D Standard deviation of the velocity measured by the OTOS

◆ getVersionInfo()

def qwiic_otos.QwiicOTOS.getVersionInfo (   self)

Gets the hardware and firmware version numbers from the OTOS.

Returns
list Hardware and firmware version numbers

◆ is_connected()

def qwiic_otos.QwiicOTOS.is_connected (   self)

Determines if this device is connected.

Returns
bool True if connected, otherwise False

◆ resetTracking()

def qwiic_otos.QwiicOTOS.resetTracking (   self)

Resets the tracking algorithm, which resets the position to the origin, but can also be used to recover from some rare tracking errors.

◆ selfTest()

def qwiic_otos.QwiicOTOS.selfTest (   self)

Performs a self-test on the OTOS.

Returns
bool True if successful, otherwise False

◆ setAngularScalar()

def qwiic_otos.QwiicOTOS.setAngularScalar (   self,
  scalar 
)

Sets the angular scalar used by the OTOS.

Can be used to compensate for scaling issues with the sensor measurements

Parameters
floatscalar: Angular scalar, must be between 0.872 and 1.127
Returns
bool True if successful, otherwise False

◆ setAngularUnit()

def qwiic_otos.QwiicOTOS.setAngularUnit (   self,
  unit 
)

Sets the angular unit used by all methods using a pose.

Parameters
intunit: Angular unit

◆ setLinearScalar()

def qwiic_otos.QwiicOTOS.setLinearScalar (   self,
  scalar 
)

Sets the linear scalar used by the OTOS.

Can be used to compensate for scaling issues with the sensor measurements

Parameters
floatscalar: Linear scalar, must be between 0.872 and 1.127
Returns
bool True if successful, otherwise False

◆ setLinearUnit()

def qwiic_otos.QwiicOTOS.setLinearUnit (   self,
  unit 
)

Sets the linear unit used by all methods using a pose.

Parameters
intunit: Linear unit

◆ setOffset()

def qwiic_otos.QwiicOTOS.setOffset (   self,
  pose 
)

Gets 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

Parameters
Pose2Dpose: Offset of the sensor relative to the center of the robot

◆ setPosition()

def qwiic_otos.QwiicOTOS.setPosition (   self,
  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

Parameters
Pose2Dpose: New position for the OTOS to track from

◆ setSignalProcessConfig()

def qwiic_otos.QwiicOTOS.setSignalProcessConfig (   self,
  config 
)

Sets the signal processing configuration for the OTOS.

Parameters
intconfig: Signal processing configuration

Member Data Documentation

◆ address

qwiic_otos.QwiicOTOS.address

◆ available_addresses

qwiic_otos.QwiicOTOS.available_addresses = _AVAILABLE_I2C_ADDRESS
static

◆ device_name

qwiic_otos.QwiicOTOS.device_name = _DEFAULT_NAME
static

◆ kAngularUnitDegrees

int qwiic_otos.QwiicOTOS.kAngularUnitDegrees = 1
static

◆ kAngularUnitRadians

int qwiic_otos.QwiicOTOS.kAngularUnitRadians = 0
static

◆ kDegreeToRadian

float qwiic_otos.QwiicOTOS.kDegreeToRadian = 3.14159 / 180.0
static

◆ kInchToMeter

float qwiic_otos.QwiicOTOS.kInchToMeter = 1.0 / kMeterToInch
static

◆ kInt16ToMeter

float qwiic_otos.QwiicOTOS.kInt16ToMeter = 1.0 / kMeterToInt16
static

◆ kInt16ToMps

float qwiic_otos.QwiicOTOS.kInt16ToMps = 1.0 / kMpsToInt16
static

◆ kInt16ToMpss

float qwiic_otos.QwiicOTOS.kInt16ToMpss = 1.0 / kMpssToInt16
static

◆ kInt16ToRad

float qwiic_otos.QwiicOTOS.kInt16ToRad = 1.0 / kRadToInt16
static

◆ kInt16ToRps

float qwiic_otos.QwiicOTOS.kInt16ToRps = 1.0 / kRpsToInt16
static

◆ kInt16ToRpss

float qwiic_otos.QwiicOTOS.kInt16ToRpss = 1.0 / kRpssToInt16
static

◆ kLinearUnitInches

int qwiic_otos.QwiicOTOS.kLinearUnitInches = 1
static

◆ kLinearUnitMeters

int qwiic_otos.QwiicOTOS.kLinearUnitMeters = 0
static

◆ kMaxScalar

float qwiic_otos.QwiicOTOS.kMaxScalar = 1.127
static

◆ kMeterToInch

float qwiic_otos.QwiicOTOS.kMeterToInch = 39.37
static

◆ kMeterToInt16

float qwiic_otos.QwiicOTOS.kMeterToInt16 = 32768.0 / 10.0
static

◆ kMinScalar

float qwiic_otos.QwiicOTOS.kMinScalar = 0.872
static

◆ kMpssToInt16

float qwiic_otos.QwiicOTOS.kMpssToInt16 = 32768.0 / (16.0 * 9.80665)
static

◆ kMpsToInt16

float qwiic_otos.QwiicOTOS.kMpsToInt16 = 32768.0 / 5.0
static

◆ kProductId

int qwiic_otos.QwiicOTOS.kProductId = 0x5F
static

◆ kRadianToDegree

float qwiic_otos.QwiicOTOS.kRadianToDegree = 180.0 / 3.14159
static

◆ kRadToInt16

float qwiic_otos.QwiicOTOS.kRadToInt16 = 32768.0 / 3.14159
static

◆ kRegAccHH

int qwiic_otos.QwiicOTOS.kRegAccHH = 0x31
static

◆ kRegAccHL

int qwiic_otos.QwiicOTOS.kRegAccHL = 0x30
static

◆ kRegAccStdHH

int qwiic_otos.QwiicOTOS.kRegAccStdHH = 0x43
static

◆ kRegAccStdHL

int qwiic_otos.QwiicOTOS.kRegAccStdHL = 0x42
static

◆ kRegAccStdXH

int qwiic_otos.QwiicOTOS.kRegAccStdXH = 0x3F
static

◆ kRegAccStdXL

int qwiic_otos.QwiicOTOS.kRegAccStdXL = 0x3E
static

◆ kRegAccStdYH

int qwiic_otos.QwiicOTOS.kRegAccStdYH = 0x41
static

◆ kRegAccStdYL

int qwiic_otos.QwiicOTOS.kRegAccStdYL = 0x40
static

◆ kRegAccXH

int qwiic_otos.QwiicOTOS.kRegAccXH = 0x2D
static

◆ kRegAccXL

int qwiic_otos.QwiicOTOS.kRegAccXL = 0x2C
static

◆ kRegAccYH

int qwiic_otos.QwiicOTOS.kRegAccYH = 0x2F
static

◆ kRegAccYL

int qwiic_otos.QwiicOTOS.kRegAccYL = 0x2E
static

◆ kRegFwVersion

int qwiic_otos.QwiicOTOS.kRegFwVersion = 0x02
static

◆ kRegHwVersion

int qwiic_otos.QwiicOTOS.kRegHwVersion = 0x01
static

◆ kRegImuCalib

int qwiic_otos.QwiicOTOS.kRegImuCalib = 0x06
static

◆ kRegOffHH

int qwiic_otos.QwiicOTOS.kRegOffHH = 0x15
static

◆ kRegOffHL

int qwiic_otos.QwiicOTOS.kRegOffHL = 0x14
static

◆ kRegOffXH

int qwiic_otos.QwiicOTOS.kRegOffXH = 0x11
static

◆ kRegOffXL

int qwiic_otos.QwiicOTOS.kRegOffXL = 0x10
static

◆ kRegOffYH

int qwiic_otos.QwiicOTOS.kRegOffYH = 0x13
static

◆ kRegOffYL

int qwiic_otos.QwiicOTOS.kRegOffYL = 0x12
static

◆ kRegPosHH

int qwiic_otos.QwiicOTOS.kRegPosHH = 0x25
static

◆ kRegPosHL

int qwiic_otos.QwiicOTOS.kRegPosHL = 0x24
static

◆ kRegPosStdHH

int qwiic_otos.QwiicOTOS.kRegPosStdHH = 0x37
static

◆ kRegPosStdHL

int qwiic_otos.QwiicOTOS.kRegPosStdHL = 0x36
static

◆ kRegPosStdXH

int qwiic_otos.QwiicOTOS.kRegPosStdXH = 0x33
static

◆ kRegPosStdXL

int qwiic_otos.QwiicOTOS.kRegPosStdXL = 0x32
static

◆ kRegPosStdYH

int qwiic_otos.QwiicOTOS.kRegPosStdYH = 0x35
static

◆ kRegPosStdYL

int qwiic_otos.QwiicOTOS.kRegPosStdYL = 0x34
static

◆ kRegPosXH

int qwiic_otos.QwiicOTOS.kRegPosXH = 0x21
static

◆ kRegPosXL

int qwiic_otos.QwiicOTOS.kRegPosXL = 0x20
static

◆ kRegPosYH

int qwiic_otos.QwiicOTOS.kRegPosYH = 0x23
static

◆ kRegPosYL

int qwiic_otos.QwiicOTOS.kRegPosYL = 0x22
static

◆ kRegProductId

int qwiic_otos.QwiicOTOS.kRegProductId = 0x00
static

◆ kRegReset

int qwiic_otos.QwiicOTOS.kRegReset = 0x07
static

◆ kRegScalarAngular

int qwiic_otos.QwiicOTOS.kRegScalarAngular = 0x05
static

◆ kRegScalarLinear

int qwiic_otos.QwiicOTOS.kRegScalarLinear = 0x04
static

◆ kRegSelfTest

int qwiic_otos.QwiicOTOS.kRegSelfTest = 0x0F
static

◆ kRegSignalProcess

int qwiic_otos.QwiicOTOS.kRegSignalProcess = 0x0E
static

◆ kRegStatus

int qwiic_otos.QwiicOTOS.kRegStatus = 0x1F
static

◆ kRegVelHH

int qwiic_otos.QwiicOTOS.kRegVelHH = 0x2B
static

◆ kRegVelHL

int qwiic_otos.QwiicOTOS.kRegVelHL = 0x2A
static

◆ kRegVelStdHH

int qwiic_otos.QwiicOTOS.kRegVelStdHH = 0x3D
static

◆ kRegVelStdHL

int qwiic_otos.QwiicOTOS.kRegVelStdHL = 0x3C
static

◆ kRegVelStdXH

int qwiic_otos.QwiicOTOS.kRegVelStdXH = 0x39
static

◆ kRegVelStdXL

int qwiic_otos.QwiicOTOS.kRegVelStdXL = 0x38
static

◆ kRegVelStdYH

int qwiic_otos.QwiicOTOS.kRegVelStdYH = 0x3B
static

◆ kRegVelStdYL

int qwiic_otos.QwiicOTOS.kRegVelStdYL = 0x3A
static

◆ kRegVelXH

int qwiic_otos.QwiicOTOS.kRegVelXH = 0x27
static

◆ kRegVelXL

int qwiic_otos.QwiicOTOS.kRegVelXL = 0x26
static

◆ kRegVelYH

int qwiic_otos.QwiicOTOS.kRegVelYH = 0x29
static

◆ kRegVelYL

int qwiic_otos.QwiicOTOS.kRegVelYL = 0x28
static

◆ kRpssToInt16

float qwiic_otos.QwiicOTOS.kRpssToInt16 = 32768.0 / (3.14159 * 1000.0)
static

◆ kRpsToInt16

float qwiic_otos.QwiicOTOS.kRpsToInt16 = 32768.0 / (2000.0 * kDegreeToRadian)
static

Property Documentation

◆ connected

qwiic_otos.QwiicOTOS.connected = property(is_connected)
static

The documentation for this class was generated from the following file: