# ThreeSpaceAPI Documentation

For more information on sensor commands please refer to our user manual: https://yostlabs.com/wp/wp-content/uploads/pdf/3-Space-Sensor-Users-Manual-3.pdf

Copyright 2022, Yost Labs Inc Released under Yost Labs 3-Space Open Source License https://yostlabs.com/support/open-source-license/ Authors: Eric McCaw, Patrick Redoutey

class ThreeSpaceAPI.Streamable

  All available commands to stream are listed here.

  READ_TARED_ORIENTATION_AS_QUAT
  READ_TARED_ORIENTATION_AS_EULER
  READ_TARED_ORIENTATION_AS_MAT
  READ_TARED_ORIENTATION_AS_AXIS_ANGLE
  READ_TARED_ORIENTATION_AS_VECTOR
  READ_DIFFERENCE_QUAT
  READ_UNTARED_ORIENTATION_AS_QUAT
  READ_UNTARED_ORIENTATION_AS_EULER
  READ_UNTARED_ORIENTATION_AS_MAT
  READ_UNTARED_ORIENTATION_AS_AXIS_ANGLE
  READ_UNTARED_ORIENTATION_AS_VECTOR
  READ_TARED_TWO_VECTOR_IN_SENSOR_FRAME
  READ_UNTARED_TWO_VECTOR_IN_SENSOR_FRAME
  READ_ALL_NORMALIZED_COMPONENT_SENSOR_DATA
  READ_NORMALIZED_GYROSCOPE_VECTOR
  READ_NORMALIZED_ACCELEROMETER_VECTOR
  READ_NORMALIZED_COMPASS_VECTOR
  READ_ALL_CORRECTED_COMPONENT_SENSOR_DATA
  READ_CORRECTED_GYROSCOPE_VECTOR
  READ_CORRECTED_ACCELEROMETER_VECTOR
  READ_CORRECTED_COMPASS_VECTOR
  READ_CORRECTED_LINEAR_ACCELERATION
  READ_TEMPERATURE_C
  READ_TEMPERATURE_F
  READ_CONFIDENCE_FACTOR
  READ_ALL_RAW_COMPONENT_SENSOR_DATA
  READ_RAW_GYROSCOPE_VECTOR
  READ_RAW_ACCELEROMETER_VECTOR
  READ_RAW_COMPASS_VECTOR
  READ_BATTERY_VOLTAGE
  READ_BATTERY_PERCENTAGE
  READ_BATTERY_STATUS
  READ_BUTTON_STATE
  NO_COMMAND

class ThreeSpaceAPI.ThreeSpaceSensor(comClass, streamingBufferLen=1000)

  Every instance of this class will dynamically generate functions based on the connected sensor type. When creating an instance of this class we will need a communication class with 4 methods(open, close, read, write).

  generateStaticClass(filename=None)

    This will generate a python file containing a sensor specific class that will not dynamically create functions. Use cases for this would be where speed is important, debugging any issues, seeing how we talk to write commands

  cleanup()
  getNewestStreamingPacket(logicalID=0)

    When a sensor is streaming the parsed data will be stored in a buffer. This method will safely get and return the most recent data packet from the sensor.

  getOldestStreamingPacket(logicalID=0)

    When a sensor is streaming the parsed data will be stored in a buffer. This method will safely get and return the oldest data packet from the sensor.

  clearStreamingBuffer(logicalID=0)

    When a sensor is streaming the parsed data will be stored in a buffer. This method will clear all data from the buffer.

  setResponseHeaderBitfield(headerConfig: int)

    This function combines SetWiredResponseHeaderBitfield and SetWirelessResponseHeaderBitfield to simplify the usage of the header functionality Configures the response header for data returned. The only parameter is a four-byte bitfield that determines which data is prepended to all data responses. The following bits are used: 0x1: (1 byte) Success/Failure, with non-zero values representing failure. 0x2: (4 bytes) Timestamp, in microseconds. 0x4: (1 byte) Command echo outputs the called command. Returns 0xFF for streamed data. 0x8: (1 byte) Additive checksum over returned data, but not including response header. 0x10: (1 byte) Logical ID, returns 0xFE for wired sensors. Meant to be used with 3-Space Dongle response header (For more info, see command 0xDB). 0x20: (4 bytes) Serial number 0x40: (1 byte) Data length, returns the length of the requested data, not including response header. This setting can be committed to non-volatile flash memory by calling the Commit Settings command. For more information on Response Headers, please refer to the users manual in section 4.4.

  setStreamingSlots(slot1=255, slot2=255, slot3=255, slot4=255, slot5=255, slot6=255, slot7=255, slot8=255, logicalID=0)

    Configures data output slots for streaming mode. Command accepts a list of eight bytes, where each byte corresponds to a different data command. Every streaming iteration, each command will be executed in order and the resulting data will be output in the specified slot. Valid commands are commands in the ranges 0x0 - 0x10, 0x20 - 0x30, 0x40 - 0x50, 0xC9 - 0xCA (for battery-powered sensors) and 0xFA. A slot value of 0xFF ‘clears’ the slot and prevents any data from being written in that position. This command can fail if there is an invalid command passed in as any of the parameters or if the total allotted size is exceeded. Upon failure, all slots will be reset to 0xFF. This setting can be saved to nonvolatile flash memory using the Commit Settings command.

  setStreamingTiming(interval: int, duration: int, delay: int, logicalID=0)

    Configures timing information for a streaming session. All parameters are specified in microseconds. The first parameter is the interval, which specifies how often data will be output. A value of 0 means that data will be output at the end of every filter loop. Aside from 0, values lower than 1000 will be clamped to 1000. The second parameter is the duration, which specifies the length of the streaming session. If this value is set to 0xFFFFFFFF, streaming will continue indefinitely until it is stopped via command 0x56. The third parameter is the delay, which specifies a n amount of time the sensor will wait before outputting the first packet of streaming data. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  startStreaming(logicalID=0)

    Start a streaming session using the current slot and timing configuration.

  stopStreaming(logicalID=0)

    Stop the current streaming session.

  getTaredOrientation(logicalID=0)

    Returns the filtered, tared orientation estimate in quaternion form

  getTaredOrientationAsEulerAngles(logicalID=0)

    Returns the filtered, tared orientation estimate in euler angle form

  getTaredOrientationAsRotationMatrix(logicalID=0)

    Returns the filtered, tared orientation estimate in rotation matrix form

  getTaredOrientationAsAxisAngles(logicalID=0)

    Returns the filtered, tared orientation estimate in axis-angle form

  getTaredOrientationAsTwoVector(logicalID=0)

    Returns the filtered, tared orientation estimate in two vector form, where the first vector refers to forward and the second refers to down.

  getDifferenceQuaternion(logicalID=0)

    Returns the difference between the measured orientation from last frame and this frame.

  getUntaredOrientation(logicalID=0)

    Returns the filtered, untared orientation estimate in quaternion form.

  getUntaredOrientationAsEulerAngles(logicalID=0)

    Returns the filtered, untared orientation estimate in euler angle form

  getUntaredOrientationAsRotationMatrix(logicalID=0)

    Returns the filtered, untared orientation estimate in rotation matrix form

  getUntaredOrientationAsAxisAngles(logicalID=0)

    Returns the filtered, untared orientation estimate in axis-angle form

  getUntaredOrientationAsTwoVector(logicalID=0)

    Returns the filtered, untared orientation estimate in two vector form, where the first vector refers to north and the second refers to gravity

  getTaredTwoVectorInSensorFrame(logicalID=0)

    Returns the filtered, tared orientation estimate in two vector form, where the first vector refers to forward and the second refers to down. These vectors are given in the sensor reference frame and not the global reference frame.

  getUntaredTwoVectorInSensorFrame(logicalID=0)

    Returns the filtered, untared orientation estimate in two vector form, where the first vector refers to north and the second refers to gravity. These vectors are given in the sensor reference frame and not the global reference frame

  getAllNormalizedComponentSensorData(logicalID=0)

    Returns the normalized gyro rate vector, accelerometer vector, and compass vector. Note that the gyro vector is in units of radians/sec, while the accelerometer and compass are unit-length vectors indicating the direction of gravity and north, respectively. These two vectors do not have any magnitude data associated with them.

  getNormalizedGyroRate(logicalID=0)

    Returns the normalized gyro rate vector, which is in units of radians/sec.

  getNormalizedAccelerometerVector(logicalID=0)

    Returns the normalized accelerometer vector. Note that this is a unit-vector indicating the direction of gravity. This vector does not have any magnitude data associated with it.

  getNormalizedCompassVector(logicalID=0)

    Returns the normalized compass vector. Note that this is a unit-vector indicating the direction of gravity. This vector does not have any magnitude data associated with it.

  getAllCorrectedComponentSensorData(logicalID=0)

    Returns the corrected gyro rate vector, accelerometer vector, and compass vector. Note that the gyro vector is in units of radians/sec, the accelerometer vector is in units of G, and the compass vector is in units of gauss

  getCorrectedGyroRate(logicalID=0)

    Returns the corrected gyro rate vector, which is in units of radians/sec. Note that this result is the same data returned by the normalized gyro rate command.

  getCorrectedAccelerometerVector(logicalID=0)

    Returns the acceleration vector in units of G. Note that this acceleration will include the static component of acceleration due to gravity.

  getCorrectedCompassVector(logicalID=0)

    Returns the compass vector in units of gauss.

  getCorrectedLinearAccelerationInGlobalSpace(logicalID=0)

    Returns the linear acceleration of the device, which is the overall acceleration which has been orientation compensated and had the component of acceleration due to gravity removed. Uses the untared orientation.

  correctRawGyroData(x: float, y: float, z: float, logicalID=0)

    Converts the supplied raw data gyroscope vector to its corrected data representation.

  correctRawAccelData(x: float, y: float, z: float, logicalID=0)

    Converts the supplied raw data accelerometer vector to its corrected data representation.

  correctRawCompassData(x: float, y: float, z: float, logicalID=0)

    Converts the supplied raw data compass vector to its corrected data representation

  getTemperatureC(logicalID=0)

    Returns the temperature of the sensor in Celsius.

  getTemperatureF(logicalID=0)

    Returns the temperature of the sensor in Fahrenheit

  getConfidenceFactor(logicalID=0)

    Returns a value indicating how much the sensor is being moved at the moment. This value will return 1 if the sensor is completely stationary, and will return 0 if it is in motion. This command can also return values in between indicating how much motion the sensor is experiencing

  getAllRawComponentSensorData(logicalID=0)

    Returns the raw gyro rate vector, accelerometer vector and compass vector as read directly from the component sensors without any additional postprocessing. The range of values is dependent on the currently selected range for each respective sensor.

  getRawGyroRate(logicalID=0)

    Returns the raw gyro rate vector as read directly from the gyroscope without any additional postprocessing.

  getRawAccelerometerVector(logicalID=0)

    Returns the raw acceleration vector as read directly from the accelerometer without any additional postprocessing.

  getRawCompassVector(logicalID=0)

    Returns the raw compass vector as read directly from the compass without any additional postprocessing.

  getStreamingSlots(logicalID=0)

    Returns the current streaming slots configuration.

  getStreamingTiming(logicalID=0)

    Returns the current streaming timing information.

  updateCurrentTimestamp(timestamp: int, logicalID=0)

    Set the current internal timestamp to the specified value.

  setEulerAngleDecompositionOrder(order: int, logicalID=0)

    Sets the current euler angle decomposition order, which determines how the angles returned from command 0x1 are decomposed from the full quaternion orientation. Possible values are 0x0 for XYZ, 0x1 for YZX, 0x2 for ZXY, 0x3 for ZYX, 0x4 for XZY or 0x5 for YXZ (default).

  offsetWithCurrentOrientation(logicalID=0)

    Sets the offset orientation to be the same as the current filtered orientation.

  resetBaseOffset(logicalID=0)

    Sets the base offset to an identity quaternion.

  offsetWithQuaternion(x: float, y: float, z: float, w: float, logicalID=0)

    Sets the offset orientation to be the same as the supplied orientation, which should be passed as a quaternion.

  setBaseOffsetWithCurrentOrientation(logicalID=0)

    Sets the base offset orientation to be the same as the current filtered orientation.

  tareWithCurrentOrientation(logicalID=0)

    Sets the tare orientation to be the same as the current filtered orientation.

  tareWithQuaternion(x: float, y: float, z: float, w: float, logicalID=0)

    Sets the tare orientation to be the same as the supplied orientation, which should be passed as a quaternion.

  tareWithRotationMatrix(matrix: list, logicalID=0)

    Sets the tare orientation to be the same as the supplied orientation, which should be passed as a rotation matrix.

  setStaticAccelerometerTrustValue(trustValue: float, logicalID=0)

    Determines how trusted the accelerometer contribution is to the overall orientation estimation. Trust is 0 to 1, with 1 being fully trusted and 0 being not trusted at all.

  setConfidenceAccelerometerTrustValues(minTrustValue: float, maxTrustValue: float, logicalID=0)

    Determines how trusted the accelerometer contribution is to the overall orientation estimation. Instead of using a single value, uses a minimum and maximum value. Trust values will be selected from this range depending on the confidence factor. This can have the effect of smoothing out the accelerometer when the sensor is in motion.

  setStaticCompassTrustValue(trustValue: float, logicalID=0)

    Determines how trusted the accelerometer contribution is to the overall orientation estimation. tribution is to the overall orientation estimation. Trust is 0 to 1, with 1 being fully trusted and 0 being not trusted at all.

  setConfidenceCompassTrustValues(minTrustValue: float, maxTrustValue: float, logicalID=0)

    Determines how trusted the compass contribution is to the overall orientation estimation. Instead of using a single value, uses a minimum and maximum value. Trust values will be selected from this range depending on the confidence factor. This can have the effect of smoothing out the compass when the sensor is in motion.

  setReferenceVectorMode(mode: int, logicalID=0)

    Set the current reference vector mode. Parameter can be 0 for single static mode, which uses a certain reference vector for the compass and another certain vector for the accelerometer at all times, 1 for single auto mode, which uses (0, -1, 0) as the reference vector for the accelerometer at all times and uses the average angle between the accelerometer and compass to calculate the compass reference vector once upon initiation of this mode, or 2 for single auto continuous mode, which works similarly to single auto mode, but calculates this continuously.

  setOversampleRate(gyroSamples: int, accelSamples: int, compassSamples: int, logicalID=0)

    Sets the number of times to sample each component sensor for each iteration of the filter. This can smooth out readings at the cost of responsiveness. If this value is set to 0 or 1, no oversampling occurs-otherwise, the number of samples per iteration depends on the specified parameter, up to a maximum of 65535. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setGyroscopeEnabled(enabled: bool, logicalID=0)

    Enable or disable gyroscope readings as inputs to the orientation estimation. Note that updated gyroscope readings are still accessible via commands. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setAccelerometerEnabled(enabled: bool, logicalID=0)

    Enable or disable accelerometer readings as inputs to the orientation estimation. Note that updated accelerometer readings are still accessible via commands. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setCompassEnabled(enabled: bool, logicalID=0)

    Enable or disable compass readings as inputs to the orientation estimation. Note that updated compass readings are still accessible via commands. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setMIModeEnabled(enabled: bool, logicalID=0)

    Enables MI mode, which is meant to protect against some magnetic disturbances. See the Quick Start guide for more information.

  setMIModeParameters(params: list, logicalID=0)

    Sets up parameters for MI mode. A description of these parameters will be added at a later date.

  beginMIModeFieldCalibration(logicalID=0)

    Begins the calibration process for MI mode. The sensor should be left in a magnetically unperturbed area for 3-4 seconds after this is called for calibration to succeed.

  setAxisDirections(direction: int, logicalID=0)

    Sets alternate directions for each of the natural axes of the sensor. The only parameter is a bitfield representing the possible combinations of axis swapping. The lower 3 bits specify where each of the natural axes appears: 000: X: Right, Y: Up, Z: Forward (left-handed system, standard operation) 001: X: Right, Y: Forward, Z: Up (right-handed system) 002: X: Up, Y: Right, Z: Forward (right-handed system) 003: X: Forward, Y: Right, Z: Up (left-handed system) 004: X: Up, Y: Forward, Z: Right (left-handed system) 005: X: Forward, Y: Up, Z: Right (right-handed system) (For example, using X: Right, Y: Forward, Z: Up means that any values that appear on the positive vertical(Up) axis of the sensor will be the third(Z) component of any vectors and will have a positive sign, and any that appear on the negative vertical axis will be the Z component and will have a negative sign.) The 3 bits above those are used to indicate which axes, if any, should be reversed. If it is cleared, the axis will be pointing in the positive direction. Otherwise, the axis will be pointed in the negative direction. (Note: These are applied to the axes after the previous conversion takes place). Bit 4: Positive/Negative Z (Third resulting component) Bit 5: Positive/Negative Y (Second resulting component) Bit 6: Positive/Negative X (First resulting component) Note that for each negation that is applied, the handedness of the system flips. So, if X and Z are negative and you are using a left-handed system, the system will still be left handed, but if only X is negated, the system will become right-handed.

  setRunningAveragePercent(gyroPercent: float, accelPercent: float, compassPercent: float, orientationPercent: float, logicalID=0)

    Sets what percentage of running average to use on a component sensor, or on the sensor’s orientation. This is computed as follows: total_value = total_value* percent total_value = total_value + current_value * (1 - percent) current_value = total_value If the percentage is 0, the running average will be shut off completely. Maximum value is 1. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setCompassReferenceVector(x: float, y: float, z: float, logicalID=0)

    Sets the static compass reference vector for Single Reference Mode.

  setAccelerometerReferenceVector(x: float, y: float, z: float, logicalID=0)

    Sets the static accelerometer reference vector for Single Reference Mode.

  resetFilter(logicalID=0)

    Resets the state of the currently selected filter.

  setAccelerometerRange(range: int, logicalID=0)

    Only parameter is the new accelerometer range, which can be 0 for 2g (Default range), which can be 1 for 4g, or 2 for 8g. Higher ranges can detect and report larger accelerations, but are not as accurate for smaller accelerations. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setFilterMode(mode: int, logicalID=0)

    Used to disable the orientation filter or set the orientation filter mode. Changing this parameter can be useful for tuning filter-performance versus orientation-update rates. Passing in a parameter of 0 places the sensor into IMU mode, a 1 places the sensor into Kalman Filtered Mode (Default mode), a 2 places the sensor into Q-COMP Filter Mode, a 3 places the sensor into Q-GRAD Filter Mode. More information can be found in the users manual in section 3.1.5. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setRunningAverageMode(mode: int, logicalID=0)

    Used to further smooth out the orientation at the cost of higher latency. Passing in a parameter of 0 places the sensor into a static running average mode, a 1 places the sensor into a confidencebased running average mode, which changes the running average factor based upon the confidence factor, which is a measure of how ‘in motion’ the sensor is. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setGyroscopeRange(range: int, logicalID=0)

    Only parameter is the new gyroscope range, which can be 0 for 250 DPS, 1 for 500 DPS, or 2 for 2000 DPS (Default range). Higher ranges can detect and report larger angular rates, but are not as accurate for smaller angular rates. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setCompassRange(range: int, logicalID=0)

    Only parameter is the new compass range, which can be 0 for 0.88G, 1 for 1.3G (Default range), 2 for 1.9G, 3 for 2.5G, 4 for 4.0G, 5 for 4.7G, 6 for 5.6G, or 7 for 8.1G. Higher ranges can detect and report larger magnetic field strengths but are not as accurate for smaller magnetic field strengths. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  getTareOrientationAsQuaternion(logicalID=0)

    Returns the current tare orientation as a quaternion.

  getTareOrientationAsRotationMatrix(logicalID=0)

    Returns the current tare orientation as a rotation matrix.

  getAccelerometerTrustValues(logicalID=0)

    Returns the current accelerometer min and max trust values. If static trust values were set, both of these will be the same.

  getCompassTrustValues(logicalID=0)

    Returns the current compass min and max trust values. If static trust values were set, both of these will be the same.

  getCurrentUpdateRate(logicalID=0)

    Reads the amount of time taken by the last filter update step.

  getCompassReferenceVector(logicalID=0)

    Reads the current compass reference vector. Note that this is not valid if the sensor is in Multi Reference Vector mode.

  getAccelerometerReferenceVector(logicalID=0)

    Reads the current compass reference vector. Note that this is not valid if the sensor is in Multi Reference Vector mode.

  getReferenceVectorMode(logicalID=0)

    Reads the current reference vector mode. Return value can be 0 for single static, 1 for single auto, or 2 for single auto continuous.

  getMIModeEnabled(logicalID=0)

    Returns a value indicating whether MI mode is currently on or not: 0 for off, 1 for on.

  getMIModeParameters(logicalID=0)

    Returns the MI mode parameter list. A description of these will be added at a later date.

  getGyroscopeEnabledState(logicalID=0)

    Returns a value indicating whether the gyroscope contribution is currently part of the orientation estimate: 0 for off, 1 for on.

  getAccelerometerEnabledState(logicalID=0)

    Returns a value indicating whether the accelerometer contribution is currently part of the orientation estimate: 0 for off, 1 for on.

  getCompassEnabledState(logicalID=0)

    Returns a value indicating whether the compass contribution is currently part of the orientation estimate: 0 for off, 1 for on.

  getAxisDirection(logicalID=0)

    Returns a value indicating the current axis direction setup. For more information on the meaning of this value, please refer to the Set Axis Direction command (116).

  getOverSampleRate(logicalID=0)

    Returns values indicating how many times each component sensor is sampled before being stored as raw data. A value of 1 indicates that no oversampling is taking place, while a value that is higher indicates the number of samples per component sensor per filter update step.

  getRunningAveragePercent(logicalID=0)

    Returns the running average percent value for each component sensor and for the orientation. The value indicates what portion of the previous reading is kept and incorporated into the new reading.

  getAccelerometerRange(logicalID=0)

    Return the current accelerometer measurement range, which can be a 0 for 2g, 1 for 4g or a 2 for 8g.

  getFilterMode(logicalID=0)

    Returns the current filter mode, which can be 0 for IMU mode, 1 for Kalman, 2 for Q-COMP, or 3 for QGRAD. For more information, please refer to the Set Filter Mode command (123).

  getRunningAverageMode(logicalID=0)

    Reads the selected mode for the running average, which can be 0 for normal or 1 for confidence.

  getGyroscopeRange(logicalID=0)

    Reads the current gyroscope measurement range, which can be 0 for 250 DPS, 1 for 500 DPS or 2 for 2000 DPS.

  getCompassRange(logicalID=0)

    Reads the current compass measurement range, which can be 0 for 0.88G, 1 for 1.3G, 2 for 1.9G, 3 for 2.5G, 4 for 4.0G, 5 for 4.7G, 6 for 5.6G or 7 for 8.1G.

  getEulerAngleDecompositionOrder(logicalID=0)

    Reads the current euler angle decomposition order.

  getOffsetOrientationAsQuaternion(logicalID=0)

    Returns the current offset orientation as a quaternion.

  setCompassCalibrationCoefficients(matrix: list, biasX: float, biasY: float, biasZ: float, logicalID=0)

    Sets the current compass calibration parameters to the specified values. These consist of a bias which is added to the raw data vector and a matrix by which the value is multiplied. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setAccelerometerCalibrationCoefficients(matrix: list, biasX: float, biasY: float, biasZ: float, logicalID=0)

    Sets the current accelerometer calibration parameters to the specified values. These consist of a bias which is added to the raw data vector and a matrix by which the value is multiplied. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  getCompassCalibrationCoefficients(logicalID=0)

    Return the current compass calibration parameters.

  getAccelerometerCalibrationCoefficients(logicalID=0)

    Return the current accelerometer calibration parameters.

  getGyroscopeCalibrationCoefficients(logicalID=0)

    Return the current gyroscope calibration parameters.

  beginGyroscopeAutoCalibration(logicalID=0)

    Performs auto-gyroscope calibration. Sensor should remain still while samples are taken. The gyroscope bias will be automatically placed into the bias part of the gyroscope calibration coefficient list.

  setGyroscopeCalibrationCoefficients(matrix: list, biasX: float, biasY: float, biasZ: float, logicalID=0)

    Sets the current gyroscope calibration parameters to the specified values. These consist of a bias which is added to the raw data vector and a matrix by which the value is multiplied. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  setCalibrationMode(mode: int, logicalID=0)

    Sets the current calibration mode, which can be 0 for Bias or 1 for Scale-Bias. For more information, refer to the users manual in section 3.1.3 Additional Calibration. This setting can be saved to non-volatile flash memory using the Commit Settings command.

  getCalibrationMode(logicalID=0)

    Reads the current calibration mode, which can be 0 for Bias or 1 for Scale-Bias. For more information, refer to the users manual in section 3.1.3 Additional Calibration.

  setLEDMode(mode: bool, logicalID=0)

    Allows finer-grained control over the sensor LED. Accepts a single parameter that can be 0 for standard, which displays all standard LED status indicators or 1 for static, which displays only the LED color as specified by command 238.

  getLEDMode(logicalID=0)

    Returns the current sensor LED mode, which can be 0 for standard or 1 for static.

  getWiredResponseHeaderBitfield(logicalID=0)

    Return the current wired response header bitfield. For more information, please refer to the users manual in section 4.4.

  getFirmwareVersionString(logicalID=0)

    Returns a string indicating the current firmware version.

  restoreFactorySettings(logicalID=0)

    Return all non-volatile flash settings to their original, default settings.

  commitSettings(logicalID=0)

    Commits all current sensor settings to non-volatile flash memory, which will persist after the sensor is powered off. For more information on which parameters can be stored in this manner, refer to the users manual in section 3.4 Sensor Settings.

  softwareReset(logicalID=0)

    Resets the sensor.

  setSleepMode(mode: bool, logicalID=0)

    Sets the current sleep mode of the sensor. Supported sleep modes are 0 for NONE and 1 for IDLE. IDLE mode merely skips all filtering steps. NONE is the default state.

  getSleepMode(logicalID=0)

    Reads the current sleep mode of the sensor, which can be 0 for NONE or 1 for IDLE.

  getHardwareVersionString(logicalID=0)

    Returns a string indicating the current hardware version.

  setUARTBaudRate(baudRate: int, logicalID=0)

    Sets the baud rate of the physical UART. This setting does not need to be committed, but will not take effect until the sensor is reset. Valid baud rates are 1200, 2400, 4800, 9600, 19200, 28800, 38400, 57600, 115200 (default), 230400, 460800 and 921600. Note that this is only applicable for sensor types that have UART interfaces.

  getUARTBaudRate(logicalID=0)

    Returns the baud rate of the physical UART. Note that this is only applicable for sensor types that have UART interfaces.

  setUSBMode(mode: bool, logicalID=0)

    Sets the communication mode for USB. Accepts one value that can be 0 for CDC (default) or 1 for FTDI.

  getUSBMode(logicalID=0)

    Returns the current USB communication mode.

  getSerialNumber(logicalID=0)

    Returns the serial number, which will match the value etched onto the physical sensor.

  setHaptics(duration: int, onTime: int, offTime: int, logicalID=0)

    Sets the duty cycle and duration for haptics module. When the duration is set to 65535 the module will run continuously, when set to 0 it will turn off. All values are in centiseconds

  setLEDColor(red: float, green: float, blue: float, logicalID=0)

    Sets the color of the LED on the sensor to the specified RGB color. This setting can be committed to non-volatile flash memory by calling the Commit Wireless Settings command.

  getLEDColor(logicalID=0)

    Returns the color of the LED on the sensor.

  setJoystickEnabled(enable: bool, logicalID=0)

    Enable or disable streaming of joystick HID data for this sensor.

  setMouseEnabled(enable: bool, logicalID=0)

    Enable or disable streaming of mouse HID data for this sensor.

  getJoystickEnabled(logicalID=0)

    Read whether the sensor is currently streaming joystick HID data.

  getMouseEnabled(logicalID=0)

    Read whether the sensor is currently streaming mouse HID data.

  setControlMode(controlClass: int, controlIndex: int, handlerIndex: int, logicalID=0)

    Sets the operation mode for one of the controls. The first parameter is the control class,which can be 0 for Joystick Axis, 1 for Joystick Button, 2 for Mouse Axis or 3 for Mouse Button. There are two axes and eight buttons on the joystick and mouse. The second parameter, the control index, selects which one of these axes or buttons you would like to modify. The third parameter, the handler index, specifies which handler you want to take care of this control. These can be the following: Turn off this control: 255 Axes: Global Axis: 0 Screen Point: 1 Buttons: Hardware Button: 0 Orientation Button: 1 Shake Button: 2

  setControlData(controlClass: int, controlIndex: int, handlerIndex: int, dataPoint: float, logicalID=0)

    Sets parameters for the specified control’s operation mode. The control classes and indices are the same as described in command 244. Each mode can have up to 10 data points associated with it. How many should be set and what they should be set to is entirely based on which mode is being used.

  getControlMode(controlClass: int, controlIndex: int, logicalID=0)

    Reads the handler index of this control’s mode. The control classes and indices are the same as described in command 244.

  getControlData(controlClass: int, controlIndex: int, dataPointIndex: int, logicalID=0)

    Reads the value of a certain parameter of the specified control’s operation mode. The control classes and indices are the same as described in command 244.

  getButtonState(logicalID=0)

    Reads the current state of the sensor’s physical buttons. This value returns a byte, where each bit represents the state of the sensor’s physical buttons.

  setMouseMode(mode: bool, logicalID=0)

    Puts the mode in absolute or relative mode. This change will not take effect immediately and the sensor must be reset before the mouse will enter this mode. The only parameter can be 0 for absolute (default) or 1 for relative

  getMouseMode(logicalID=0)

    Return the current mouse absolute/relative mode. Note that if the sensor has not been reset since it has been put in this mode, the mouse will not reflect this change yet, even though the command will.

  setJoystickAndMouse(joystick: bool, mouse: bool, logicalID=0)

    Sets whether the joystick and mouse are present or removed. The first parameter is for the joystick, and can be 0 for removed or 1 for present. The second parameter is for the mouse. If removed, they will not show up as devices on the target system at all. For these changes to take effect, the sensor driver may need to be reinstalled.

  getJoystickAndMouse(logicalID=0)

    Returns whether the joystick and mouse are present or removed.

  pauseStreaming()

    Prevents the dongle from outputting wirelessly streamed data. This can be useful in the case that certain data responses are desired but an influx of streaming data prevents these from being read in a timely manner.

  resumeStreaming()

    Resumes the dongle’s outputting of wirelessly streamed data. This command has no effect if the sensor was not paused.

  broadcastSynchronizationPulse()

    Sends out a timestamp synchronization broadcast message to all wireless sensors that are listening on the same channel and PanID as the dongle. The message will essentially set each receiving sensor’s timestamp to the same timestamp as stored in the dongle.

  getReceptionBitfield()

    Returns a bitfield where bits corresponding to logical IDs will be set to 1 if the corresponding sensor has sent a wireless packet to the dongle since the last time this command was called. Calling this command will clear all bits to 0.

  getSerialNumberAtLogicalID(logicalID: int)

    Return the mapped serial number for the given logical ID.

  setSerialNumberAtLogicalID(logicalID: int, serialNumber: int)

    Set the mapped serial number given by the logical ID. This setting can be committed to non-volatile flash memory by calling the Commit Wireless Settings command.

  getWirelessChannelNoiseLevels()

    Return the noise levels for each of the 16 wireless channels. A higher value corresponds to a noisier channel, which can significantly impact wireless reception and throughput.

  setWirelessRetries(retries: int)

    Set the number of times a dongle will attempt to retransmit a data request after timing out. Default value is 3. This setting can be committed to non-volatile flash memory by calling the Commit Wireless Settings command.

  getWirelessRetries()

    Read the number of times a dongle will attempt to re-transmit a data request after timing out. Default value is 3.

  getSignalStrength()

    Returns a value indicating the reception strength of the most recently received packet. Higher values indicate a stronger link.

  getWirelessResponseHeaderBitfield()

    Return the current wireless response header bitfield.

  getWirelessPanID_Dongle()

    Return the current panID for this wireless sensor or dongle. For more information, refer to the users manual in section 2.9 Wireless Terminology.

  setWirelessPanID_Dongle(panID: int)

    Set the current panID for this wireless sensor or dongle. Note that the panID for a wireless sensor can only be set via the USB connection. For more information, refer to the users manual in section 2.9 Wireless Terminology. This setting can be committed to nonvolatile flash memory by calling the Commit Wireless Settings command.

  getWirelessChannel_Dongle()

    Read the current channel for this wireless sensor or dongle. For more information, refer to the users manual in section 2.9 Wireless Terminology.

  setWirelessChannel_Dongle(channel: int)

    Set the current channel for this wireless sensor or dongle. For more information, refer to the users manual in section 2.9 Wireless Terminology. This setting can be committed to non-volatile flash memory by calling the Commit Wireless Settings command.

  commitWirelessSettings_Dongle()

    Commits all current wireless settings to non-volatile flash memory, which will persist after the sensor is powered off. For more information on which parameters can be stored in this manner, refer to the users manual in section 3.4 Sensor Settings.

  getWirelessAddress_Dongle()

    Read the wireless hardware address for this sensor or dongle.

  getWirelessPanID_Sensor(logicalID=0)

    Return the current panID for this wireless sensor or dongle. For more information, refer to the users manual in section 2.9 Wireless Terminology.

  setWirelessPanID_Sensor(panID: int, logicalID=0)

    Set the current panID for this wireless sensor or dongle. Note that the panID for a wireless sensor can only be set via the USB connection. For more information, refer to the users manual in section 2.9 Wireless Terminology. This setting can be committed to nonvolatile flash memory by calling the Commit Wireless Settings command.

  getWirelessChannel_Sensor(logicalID=0)

    Read the current channel for this wireless sensor or dongle. For more information, refer to the users manual in section 2.9 Wireless Terminology.

  setWirelessChannel_Sensor(channel: int, logicalID=0)

    Set the current channel for this wireless sensor or dongle. For more information, refer to the users manual in section 2.9 Wireless Terminology. This setting can be committed to non-volatile flash memory by calling the Commit Wireless Settings command.

  commitWirelessSettings_Sensor(logicalID=0)

    Commits all current wireless settings to non-volatile flash memory, which will persist after the sensor is powered off. For more information on which parameters can be stored in this manner, refer to the users manual in section 3.4 Sensor Settings.

  getWirelessAddress_Sensor(logicalID=0)

    Read the wireless hardware address for this sensor or dongle.

  setWirelessHIDUpdateRate(updateRate: int, logicalID=0)

    Specify the interval at which HID information is requested by the dongle. The default and minimum value is 15ms in synchronous HID mode. In asynchronous HID mode, the minimum is 5ms. This setting can be committed to non-volatile flash memory by calling the Commit Wireless Settings command.

  getWirelessHIDUpdateRate(logicalID=0)

    Return the interval at which HID information is requested by the dongle.

  setWirelessHIDAsynchronousMode(mode: int, logicalID=0)

    Sets the current wireless HID communication mode. Supplying a 0 makes wireless HID communication synchronous, while a 1 makes wireless HID asynchronous. For more information, refer to the users manual in section 3.3.4 Wireless Joystick/Mouse. This setting can be committed to non-volatile flash memory by calling the Commit Wireless Settings command.

  getWirelessHIDAsynchronousMode(logicalID=0)

    Returns the current wireless HID communication mode, which can be a 0 for synchronous wireless HID or a 1 for asynchronous wireless HID.

  setJoystickLogicalID(joystickID: int, logicalID=0)

    Causes the sensor at the specified logical ID to return joystick HID data. Passing a -1 will disable wireless joystick data. For more information, refer to the users manual in section 3.3.4 Wireless Joystick/Mouse.

  setMouseLogicalID(mouseID: int, logicalID=0)

    Causes the sensor at the specified logical ID to return mouse HID data. Passing a -1 will disable wireless mouse data. For more information, refer to the users manual in section 3.3.4 Wireless Joystick/Mouse.

  getJoystickLogicalID(logicalID=0)

    Returns the current logical ID of the joystick-enabled sensor or -1 if none exists.

  getMouseLogicalID(logicalID=0)

    Returns the current logical ID of the mouse-enabled sensor or -1 if none exists.

  getBatteryVoltage(logicalID=0)

    Read the current battery level in volts. Note that this value will read as slightly higher than it actually is if it is read via a USB connection.

  getBatteryPercentageRemaining(logicalID=0)

    Read the current battery lifetime as a percentage of the total. Note that this value will read as slightly higher than it actually is if it is read via a USB connection.

  getBatteryStatus(logicalID=0)

    Returns a value indicating the current status of the battery, which can be a 3 to indicate that the battery is currently not charging, a 2 to indicate that the battery is charging and thus plugged in, or a 1 to indicate that the sensor is fully charged.

  setPinMode(mode: int, pin: int, logicalID=0)

    Sets the pin mode of the sensor. First parameter is mode, which will be 0 for off, 1 for pulse mode, 2 for level, 3 for SPI pulse and 4 for button. Second parameter is pin, which will be 0 for TXD(for button, also RXD) or 1 for MISO(for button, also MOSI).

  getPinMode(logicalID=0)

    Read the interrupt mode of the sensor. First parameter is mode, which will be 0 for off, 1 for pulse mode, 2 for level, 3 for SPI pulse and 4 for button. Second parameter is pin, which will be 0 for TXD(for button, also RXD) or 1 for MISO(for button, also MOSI).

  getInterruptStatus(logicalID=0)

    Read the current interrupt status. This value will be 1 if the filter has updated since the last time the value was read or 0 otherwise.

  setInterruptType(mode: int, pin: int, polarity: int, logicalID=0)

    Sets up interrupt generation.

    If mode is 0, no generation will occur. If mode is 1, the interrupt generator will set the specified pin low for 5 microseconds when new data is available. If mode is 2, the interrupt generator will set the pin low until the interrupt status is read with command 18.

    The pin byte specifies which pin ois being used for interrupt generation. A value of 0 is for SDA, and 1 is for MISO. Note that the pin cannot be changed to SDA over I2C, and cannot be changed to MISO over SPI.

    If polarity is 0, then interrupts are generated by the interrupt pin being pulled low. If 1, the the pin will be pulled high.

  getInterruptType(logicalID=0)

    Read the current interrupt mode, pin, and polarity. If mode is 0, no generation will occurring. If mode is 1, the interrupt generator will set the specified pin low for 5 microseconds when new data is available. If mode is 2, the interrupt generator will set the pin low until the interrupt status is read with command 18.

    The pin byte specifies which pin ois being used for interrupt generation. A value of 0 is for SDA, and 1 is for MISO.

    If polarity is 0, then interrupts are generated by the interrupt pin being pulled low. If 1, the the pin will be pulled high.

  setFilterParameters(kp: float, maxSmoothFactor: float, minSmoothFactor: float, logicalID=0)

    Sets the filter parameters: kp, max smooth factor, and min smooth factor.

  getFilterParameters(logicalID=0)

    Read out adjustable filter parameters: kp (float), max smooth factor (float), and min smooth factor (float).

  setProtocolTimeout(timeout: int, logicalID=0)

    Sets sets the timeout value for the command processing protocol in microseconds to the given float.

  getProtocolTimeout(logicalID=0)

    Returns the timeout value for the command processing protocol in microseconds (float).

  setPedestrianTrackingEnabled(enabled: float, logicalID=0)

    Enables/disables pedestrian tracking. Pass in 1.0 for on or 0.0 for off.

  setSelectedStepIndex(index: float, logicalID=0)

    Sets selected step index to the specified value (float).

  setRMin(rMin: float, logicalID=0)

    Sets RMin to the specified value (float).

  setRMax(rMax: float, logicalID=0)

    Sets RMax to the specified value (float).

  setDMin(dMin: float, logicalID=0)

    Sets DMin to the specified value (float).

  setDMax(dMax: float, logicalID=0)

    Sets DMax to the specified value (float).

  setAMin(aMin: float, logicalID=0)

    Sets AMin to the specified value (float).

  setAMax(aMax: float, logicalID=0)

    Sets AMax to the specified value (float).

  setStepDurationMin(stepDurMin: float, logicalID=0)

    Sets minimum step duration to the specified value (float).

  setStepDurationMax(stepDurMax: float, logicalID=0)

    Sets maximum step duration to the specified value (float).

  setStepStrideSlope(stepSlope: float, logicalID=0)

    Sets step stride slope to the specified value (float).

  setStepStrideOffset(stepOffset: float, logicalID=0)

    Sets step stride offset to the specified value (float).

  setUnits(units: float, logicalID=0)

    Sets units for distance. Pass in 0.0 for meters or 1.0 for feet.

  resetSteps(dummy: float, logicalID=0)

    Resets step count and clears step data. Must pass in a dummy float.

  getPedestrianTrackingEnabled(logicalID=0)

    Returns whether or not pedestrian tracking is enabled. Will return 1.0 for on or 0.0 for off.

  getSelectedStepIndex(logicalID=0)

    Returns the currently selected step index (float).

  getRMin(logicalID=0)

    Returns the current RMin (float).

  getRMax(logicalID=0)

    Returns the current RMax (float).

  getDMin(logicalID=0)

    Returns the current DMin (float).

  getDMax(logicalID=0)

    Returns the current DMax (float).

  getAMin(logicalID=0)

    Returns the current AMin (float).

  getAMax(logicalID=0)

    Returns the current AMax (float).

  getStepDurationMin(logicalID=0)

    Returns the current minimum step duration (float).

  getStepDurationMax(logicalID=0)

    Returns the current maximum step duration (float).

  getStepStrideSlope(logicalID=0)

    Returns the current step stride slope (float).

  getStepStrideOffset(logicalID=0)

    Returns the current step stride offset (float).

  getUnits(logicalID=0)

    Returns the current units for distance. Pass in 0.0 for meters or 1.0 for feet.

  getHeadingInDegrees(logicalID=0)

    Returns the current heading (float) in degrees.

  getStepBufferLength(logicalID=0)

    Returns the number of steps recorded (float).

  getTotalDistanceTraveled(logicalID=0)

    Returns the total distance traveled (float) in the units specified by setUnits.

  getConfidenceValue(logicalID=0)

    Returns the current confidence value.

  getLatestStep(logicalID=0)

    Returns the most recent step data. Its format is as follows: Index (float), Heading (float), X Step Distance (float), Y Step Distance (float), Step Distance (float), Step Time (float), Step Amplitude (float), Step Duty Cycle (float), Step Ratio (float), Altitude (float), Confidence (float), Altitude Offset (float). This function will return -1 if there is no step data.

  getStepFromCurrentIndex(logicalID=0)

    Returns the step data with the index specified in setSelectedStepIndex. Its format is as follows: Index (float), Heading (float), X Step Distance (float), Y Step Distance (float), Step Distance (float), Step Time (float), Step Amplitude (float), Step Duty Cycle (float), Step Ratio (float), Altitude (float), Confidence (float), Altitude Offset (float). This function will return -1 if there is no step data.

  formatAndInitializeSDCard(logicalID=0)

    Erases the contents of the SD card.

  beginDataLoggingSession(logicalID=0)

    Initiates a data logging section with the specified attributes as indicated in the provided data logging configuration file.

  endDataLoggingSession(logicalID=0)

    Terminates the ongoing data logging session

  setClockValues(month: int, day: int, year: int, hour: int, minute: int, second: int, logicalID=0)

    Sets the current time on the onboard real-time clock.

  getClockValues(logicalID=0)

    Returns the current time as read by the onboard real-time clock.

# Indices and tables

- Index

- Search Page