Package Definitions (c2g.pkg)

Introduction

This page documents the capture2go.pkg submodule, which contains protocol and data structure definitions.

Note

The defined enums and classes correspond directly to what is described in the protocol documentation.

The main thing to know is that the package objects have a parse function that turns the object into a dict of numbers and numpy arrays, with some useful processing like converting from fixed point numbers to floats in physical units.

All Members

capture2go.pkg.packages = dict[SensorHeader, type[AbstractPackage]]

Global package registry that maps protocol header values to package classes.

This dictionary is populated by the register_package() decorator. It enables lookup of the appropriate package class for a given header value when parsing protocol messages.

Key:

SensorHeader: The header value identifying the package type.

Value:

Type[AbstractPackage]: The class implementing the package structure for that header.

class capture2go.pkg.SensorHeader(*values)[source]
CMD_GET_DEVICE_INFO = 112

Requests device information.

DATA_DEVICE_INFO = 113

Device information.

CMD_SLEEP = 272

Puts device into sleep mode.

ACK_SLEEP = 273

Acknowledges sleep command.

CMD_DEEP_SLEEP = 274

Puts device into deep sleep mode (transport mode).

ACK_DEEP_SLEEP = 275

Acknowledges deep sleep command.

CMD_SET_MEASUREMENT_MODE = 288

Sets measurement mode.

CMD_GET_MEASUREMENT_MODE = 289

Requests measurement mode.

DATA_MEASUREMENT_MODE = 290

Measurement mode.

CMD_SET_MEASUREMENT_BURST_MODE = 291

Sets measurement burst mode.

CMD_GET_MEASUREMENT_BURST_MODE = 292

Requests measurement burst mode.

DATA_MEASUREMENT_BURST_MODE = 293

Measurement burst mode.

CMD_SET_RECORDING_CONFIG = 320

Sets recording configuration.

CMD_GET_RECORDING_CONFIG = 321

Requests recording configuration.

DATA_RECORDING_CONFIG = 322

Recording configuration.

CMD_START_STREAMING = 336

Starts data streaming.

ACK_START_STREAMING = 337

Acknowledges start streaming command.

CMD_STOP_STREAMING = 338

Stops data streaming.

ACK_STOP_STREAMING = 339

Acknowledges stop streaming command.

CMD_START_RECORDING = 340

Starts recording data to internal storage.

ACK_START_RECORDING = 341

Acknowledges start recording command.

CMD_STOP_RECORDING = 342

Stops data recording.

ACK_STOP_RECORDING = 343

Acknowledges stop recording command.

CMD_STOP_STREAMING_AND_CLEAR_BUFFER = 344

Clearing the buffer can cause partial packages to be sent, which must be handled when unpacking.

Type:

Stops streaming and clears the send buffer. Used after connecting to a sensor in streaming mode. Note

ACK_STOP_STREAMING_AND_CLEAR_BUFFER = 345

Acknowledges stop streaming and clear buffer command.

CMD_START_REAL_TIME_STREAMING = 352

Starts real-time data streaming via dedicated channel.

CMD_GET_REAL_TIME_STREAMING_MODE = 353

Requests current real-time streaming mode.

DATA_REAL_TIME_STREAMING_MODE = 354

Real-time streaming mode.

CMD_STOP_REAL_TIME_STREAMING = 355

Stops real-time data streaming.

ACK_STOP_REAL_TIME_STREAMING = 356

Acknowledges stop real-time streaming command.

CMD_SET_ABSOLUTE_TIME = 368

Sets the absolute time on the device. Sent from host to sync sender.

DATA_ABSOLUTE_TIME = 369

Absolute time.

DATA_CLOCK_ROUNDTRIP = 370

Clock roundtrip package for clock drift estimation.

CMD_SET_LED_CONFIG = 384

Sets LED configuration parameters.

CMD_GET_LED_CONFIG = 385

Requests LED configuration parameters.

DATA_LED_CONFIG = 386

LED configuration parameters.

CMD_SET_LED_MODE = 387

Sets LED mode.

CMD_GET_LED_MODE = 388

Requests LED mode.

DATA_LED_MODE = 389

LED mode.

CMD_SET_SYNC_OUTPUT_MODE = 390

Configures a sync output pulse.

DATA_SYNC_OUTPUT_MODE = 391

Sync output pulse configuration.

CMD_GET_STATUS = 512

Requests current device status information.

DATA_STATUS = 513

Device status.

DATA_FULL_PACKED_200HZ = 545

Full IMU data at 200 Hz, 8 samples, packaged at 25 Hz (200/8 Hz).

DATA_FULL_PACKED_100HZ = 546

Full IMU data at 100 Hz, 8 samples, packaged at 12.5 Hz (100/8 Hz).

DATA_FULL_PACKED_50HZ = 547

Full IMU data at 50 Hz, 8 samples, packaged at 6.25 Hz (50/8 Hz).

DATA_FULL_PACKED_25HZ = 548

Full IMU data at 25 Hz, 8 samples, packaged at 3.125 Hz (25/8 Hz).

DATA_FULL_PACKED_10HZ = 549

Full IMU data at 10 Hz, 8 samples, packaged at 1.25 Hz (10/8 Hz).

DATA_FULL_PACKED_1HZ = 550

Full IMU data at 1 Hz, 8 samples, packaged at 0.125 Hz (1/8 Hz).

DATA_FULL_6D_PACKED_200HZ = 561

IMU data without magnetometer at 200 Hz, 8 samples, packaged at 25 Hz (200/8 Hz).

DATA_FULL_6D_PACKED_100HZ = 562

IMU data without magnetometer at 100 Hz, 8 samples, packaged at 12.5 Hz (100/8 Hz).

DATA_FULL_6D_PACKED_50HZ = 563

IMU data without magnetometer at 50 Hz, 8 samples, packaged at 6.25 Hz (50/8 Hz).

DATA_FULL_6D_PACKED_25HZ = 564

IMU data without magnetometer at 25 Hz, 8 samples, packaged at 3.125 Hz (25/8 Hz).

DATA_FULL_6D_PACKED_10HZ = 565

IMU data without magnetometer at 10 Hz, 8 samples, packaged at 1.25 Hz (10/8 Hz).

DATA_FULL_6D_PACKED_1HZ = 566

IMU data without magnetometer at 1 Hz, 8 samples, packaged at 0.125 Hz (1/8 Hz).

DATA_FULL_FIXED_200HZ = 577

Full IMU data sample at 200 Hz, fixed-point format.

DATA_FULL_FIXED_100HZ = 578

Full IMU data sample at 100 Hz, fixed-point format.

DATA_FULL_FIXED_50HZ = 579

Full IMU data sample at 50 Hz, fixed-point format.

DATA_FULL_FIXED_25HZ = 580

Full IMU data sample at 25 Hz, fixed-point format.

DATA_FULL_FIXED_10HZ = 581

Full IMU data sample at 10 Hz, fixed-point format.

DATA_FULL_FIXED_1HZ = 582

Full IMU data sample at 1 Hz, fixed-point format.

DATA_FULL_FIXED_RT = 583

Full IMU data sample for real-time transmission, fixed-point format.

DATA_FULL_6D_FIXED_200HZ = 593

IMU data sample without magnetometer at 200 Hz, fixed-point format.

DATA_FULL_6D_FIXED_100HZ = 594

IMU data sample without magnetometer at 100 Hz, fixed-point format.

DATA_FULL_6D_FIXED_50HZ = 595

IMU data sample without magnetometer at 50 Hz, fixed-point format.

DATA_FULL_6D_FIXED_25HZ = 596

IMU data sample without magnetometer at 25 Hz, fixed-point format.

DATA_FULL_6D_FIXED_10HZ = 597

IMU data sample without magnetometer at 10 Hz, fixed-point format.

DATA_FULL_6D_FIXED_1HZ = 598

IMU data sample without magnetometer at 1 Hz, fixed-point format.

DATA_FULL_FLOAT_200HZ = 609

Full IMU data sample at 200 Hz, floating-point format.

DATA_QUAT_PACKED_200HZ = 625

Orientation data at 200 Hz, 20 samples, packaged at 10 Hz (200/20 Hz).

DATA_QUAT_PACKED_100HZ = 626

Orientation data at 100 Hz, 20 samples, packaged at 5 Hz (100/20 Hz).

DATA_QUAT_PACKED_50HZ = 627

Orientation data at 50 Hz, 20 samples, packaged at 2.5 Hz (50/20 Hz).

DATA_QUAT_PACKED_25HZ = 628

Orientation data at 25 Hz, 20 samples, packaged at 1.25 Hz (25/20 Hz).

DATA_QUAT_PACKED_10HZ = 629

Orientation data at 10 Hz, 20 samples, packaged at 0.5 Hz (10/20 Hz).

DATA_QUAT_PACKED_1HZ = 630

Orientation data at 1 Hz, 20 samples, packaged at 0.05 Hz (1/20 Hz).

DATA_QUAT_FIXED_200HZ = 641

Orientation data sample at 200 Hz, fixed-point format.

DATA_QUAT_FIXED_100HZ = 642

Orientation data sample at 100 Hz, fixed-point format.

DATA_QUAT_FIXED_50HZ = 643

Orientation data sample at 50 Hz, fixed-point format.

DATA_QUAT_FIXED_25HZ = 644

Orientation data sample at 25 Hz, fixed-point format.

DATA_QUAT_FIXED_10HZ = 645

Orientation data sample at 10 Hz, fixed-point format.

DATA_QUAT_FIXED_1HZ = 646

Orientation data sample at 1 Hz, fixed-point format.

DATA_QUAT_FIXED_RT = 647

Orientation data sample for real-time transmission, fixed-point format.

DATA_QUAT_FLOAT_200HZ = 657

Orientation data sample at 200 Hz, floating-point format.

DATA_QUAT_FLOAT_100HZ = 658

Orientation data sample at 100 Hz, floating-point format.

DATA_QUAT_FLOAT_50HZ = 659

Orientation data sample at 50 Hz, floating-point format.

DATA_QUAT_FLOAT_25HZ = 660

Orientation data sample at 25 Hz, floating-point format.

DATA_QUAT_FLOAT_10HZ = 661

Orientation data sample at 10 Hz, floating-point format.

DATA_QUAT_FLOAT_1HZ = 662

Orientation data sample at 1 Hz, floating-point format.

DATA_RAW_BURST = 768

Raw sensor burst data at ~1666 Hz.

DATA_ACCZ_BURST = 769

Accelerometer z-axis burst data at ~1666 Hz.

DATA_SYNC_TRIGGER = 1024

Received hardware synchronization trigger event.

CMD_FS_LIST_FILES = 1280

Requests a list of all files on the sensor.

DATA_FS_FILE_COUNT = 1281

Number of files on the sensor.

DATA_FS_FILE = 1282

Information about one file on the sensors.

CMD_FS_GET_BYTES = 1283

Requests contents of a file on the sensor.

DATA_FS_BYTES = 1284

Contents a file on the sensor.

CMD_FS_STOP_GET_BYTES = 1285

Stops getting contents from a file.

ACK_FS_STOP_GET_BYTES = 1286

Acknowledges stop getting bytes command.

CMD_FS_GET_SIZE = 1287

Requests the size of a file on the sensor.

DATA_FS_SIZE = 1288

Size of a file on the sensor.

CMD_FS_DELETE_FILE = 1289

Deletes a file on the sensor.

ACK_FS_DELETE_FILE = 1290

Acknowledges file deletion command.

CMD_FS_FORMAT_FILESYSTEM = 1293

Formats the filesystem.

ACK_FS_FORMAT_FILESYSTEM = 1294

Acknowledges filesystem format command.

ERROR = 65535

General error message from device.

class capture2go.pkg.ErrorCode(*values)[source]
NO_ERROR = 0

No error occurred.

FILE_NOT_FOUND = 240

File was not found.

FILE_DELETION_FAILED = 241

File deletion failed.

FILE_SYSTEM_ERROR = 242

File system error occurred.

FILE_ALREADY_EXISTS = 243

File already exists.

FILE_TOO_SHORT = 244

File is too short.

FILE_NAME_INVALID = 245

File name is invalid.

FILE_SYSTEM_FULL = 246

File system is full.

FILE_SYSTEM_BUSY = 247

File system is busy.

RECORDING_CONFIG_NOT_SET = 249

Recording configuration is not set.

CALIB_PARAM_FLASH_ERROR = 250

Error when flashing calibration parameters.

WRONG_STATE = 251

Device is in the wrong state.

PKG_ERROR = 252

Could not parse received package.

UNKNOWN_COMMAND = 253

Unknown command received.

SEND_BUFFER_FULL = 254

Send buffer is full.

UNKNOWN_ERROR = 255

An unknown error occurred.

class capture2go.pkg.SensorState(*values)[source]
OFF = 0

Sensor is powered off.

IDLE = 1

Sensor is idle.

STREAMING = 2

Sensor is streaming data.

RECORDING = 3

Sensor is recording data.

class capture2go.pkg.ConnectionState(*values)[source]
OFFLINE = 0

Device is offline.

ADVERTISING = 1

Device is advertising via BLE.

BLE_CONNECTED = 2

Device is connected via BLE.

USB_CONNECTED = 3

Device is connected via USB.

class capture2go.pkg.SamplingMode(*values)[source]
MODE_DISABLED = 0

Disabled.

MODE_200HZ = 1

Sampling at 200 Hz.

MODE_100HZ = 2

Sampling at 100 Hz.

MODE_50HZ = 3

Sampling at 50 Hz.

MODE_25HZ = 4

Sampling at 25 Hz.

MODE_10HZ = 5

Sampling at 10 Hz.

MODE_1HZ = 6

Sampling at 1 Hz.

class capture2go.pkg.SyncMode(*values)[source]
NO_SYNC = 0

Synchronization is disabled.

SYNC_SENDER = 1

Device is a sync sender.

SYNC_RECEIVER = 2

Device is a sync receiver.

class capture2go.pkg.ProcessExtensionMode(*values)[source]
NO_EXTENSION = 0

No processing extension.

class capture2go.pkg.CalibrationDataMode(*values)[source]
CALIB_DATA_DISABLED = 0

Calibration data is disabled.

CALIB_DATA_FULL = 1

Full calibration data is generated.

CALIB_DATA_MAG = 2

Magnetometer calibration data is generated.

class capture2go.pkg.RealTimeDataMode(*values)[source]
REAL_TIME_DATA_DISABLED = 0

Real-time data is disabled.

REAL_TIME_DATA_QUAT = 1

Send DataQuatFixedRt packages via the real-time channel.

REAL_TIME_DATA_FULL = 2

Send DataFullFixedRt packages via the real-time channel.

capture2go.pkg.register_package(cls)[source]

Decorator to register a package class.

This function is used as a class decorator for subclasses of AbstractPackage. It ensures that each package class is registered in the global packages dictionary, mapping its header value to the class type. This enables automatic lookup and instantiation of package classes based on header values in the protocol.

Parameters:

cls (Type[T_AbstractPackage]) – The package class to register. Must have a unique header attribute.

Returns:

The same class, unmodified.

Return type:

Type[T_AbstractPackage]

Raises:

AssertionError – If the class has no header, or if the header or class is already registered.

class capture2go.pkg.AbstractPackage[source]

Bases: Structure

Base class for all protocol package structures.

This class provides the common interface and serialization logic for all protocol packages. Subclasses should define the appropriate fields and set the header attribute to a unique value.

header: SensorHeader | None = None

The protocol header value associated with this package type.

This should be set to a unique value for each subclass, or None for abstract base classes.

classmethod frombytes(val)[source]

Create a package instance from a bytes object.

Parameters:

val (bytes) – The raw bytes to parse into a package instance.

Returns:

An instance of the package class with fields populated from the bytes.

Return type:

AbstractPackage

pack(header=None)[source]

Serialize the package to bytes, including header and CRC.

Parameters:

header (SensorHeader | None, optional) – The header value to use. If None, uses self.header.

Returns:

The serialized package as a byte string, ready for transmission.

Return type:

bytes

parse()[source]

Convert the package fields to a dictionary.

Subclasses may override this method to return data as numpy arrays with approprate shapes and apply useful processing like converting from fixed point numbers to floats in physical units.

Returns:

A dictionary mapping field names to their values.

Return type:

dict

class capture2go.pkg.DataDeviceInfo[source]

Bases: AbstractPackage

Device information such as protocol version, serial, hardware and firmware details.

Fields:

  • protocolVersion: uint16 – Protocol version, currently 1. Values >= 32768 (0x8000) are reserved for custom applications.

  • serial: char[6] – Device serial.

  • hardwareRevision: char[8] – Hardware revision string.

  • firmwareRevision: char[8] – Firmware revision string.

  • firmwareVersion: char[12] – Firmware version string.

  • firmwareDate: char[11] – Firmware build date.

2 + 6 + 8 + 8 + 12 + 11 = 47 bytes

header: SensorHeader | None = 113

SensorHeader.DATA_DEVICE_INFO (0x0071)

class capture2go.pkg.DataMeasurementMode[source]

Bases: AbstractPackage

Configures the IMU measurement mode.

The measurement mode determines which sensor data packages are generated, how synchronization is configured, and if bias estimation and magnetic disturbance rejection are enabled.

The syncId should be set to a random 64 bit number that is re-generated whenever the set of employed sensors change. One device should be configured as sender and the other devices as receivers with the same syncId.

Note: The processExtensionMode is reserved for future use. Set to NO_EXTENSION (0) for now.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds) when the mode is first applied. Set to 0 in CmdSetMeasurementMode to apply immediately or use a later timestamp to delay applying the new mode.

  • fullFloat200HzEnabled: bool – Enables full float packages at 200 Hz.

  • fullFixedMode: SamplingMode, uint8 – Sampling mode for full fixed packages.

  • fullPackedMode: SamplingMode, uint8 – Sampling mode for full packed packaged.

  • quatFloatMode: SamplingMode, uint8 – Sampling mode for orientation float packages.

  • quatFixedMode: SamplingMode, uint8 – Sampling mode for orientation fixed packages.

  • quatPackedMode: SamplingMode, uint8 – Sampling mode for orientation packed packages.

  • statusMode: uint8 – Interval of status packages in seconds, 0 to disable. Recommended: 1 s.

  • calibDataMode: CalibrationDataMode, uint8 – Calibration data mode. For internal use only; set to 0.

  • processExtensionMode: ProcessExtensionMode, uint16 – Process extension mode.

  • syncMode: SyncMode, uint8 – Synchronization mode.

  • syncId: uint64 – Synchronization ID.

  • disableBiasEstimation: bool – If true, rest detection and online bias estimation are not performed.

  • disableMagDistRejection: bool – If true, magnetic disturbance rejection is not performed.

  • disableMagData: bool – If true, the full packed/fixed modes will generate the 6D variants without magnetometer data.

8 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 2 + 1 + 8 + 1 + 1 + 1 = 30 bytes

header: SensorHeader | None = 290

SensorHeader.DATA_MEASUREMENT_MODE (0x0122)

class capture2go.pkg.DataMeasurementBurstMode[source]

Bases: AbstractPackage

Configures the burst mode for short-term high-frequency measurements.

The burst mode is meant for recording high-frequency IMU data at ~1666 Hz for a short period of time (around a second). The burst time window can be configured in advance. The sensor will store the last received DataMeasurementBurstMode and start the burst measurement as soon as the configured startTimestamp is reached.

Note: Longer burst measurements might be possible, depending on the device connection and configured measurement mode, but this cannot be guaranteed.

Fields:

  • enabled: bool – Indicates if burst mode is enabled.

  • startTimestamp: int64 – Start timestamp (in nanoseconds) for burst mode.

  • endTimestamp: int64 – End timestamp (in nanoseconds) for burst mode. Set to 0 to disable, set to 0x8000000000000000 (max int64) for continuous measurement.

  • endTimestampIsRelative: bool – Indicates if end timestamp is relative to start.

  • accZOnly: bool – If true, only the z-axis accelerometer data is saved.

1 + 8 + 8 + 1 + 1 = 19 bytes

header: SensorHeader | None = 293

SensorHeader.DATA_MEASUREMENT_BURST_MODE (0x0125)

class capture2go.pkg.DataRecordingConfig[source]

Bases: AbstractPackage

Configures file name and automatic end for data recording to internal storage.

Fields:

  • endTimestamp: int64 – End timestamp (in nanoseconds) for recording. 0 for open-end recording.

  • endTimestampIsRelative: bool – If true, end timestamp is relative.

  • filename: char[65] – File name for recording. Maximum file name length is 64 characters, the rest needs to be filled with zero bytes.

8 + 1 + 65 = 74 bytes

header: SensorHeader | None = 322

SensorHeader.DATA_RECORDING_CONFIG (0x0142)

class capture2go.pkg.DataRealTimeStreamingMode[source]

Bases: AbstractPackage

Configures real-time data streaming.

Fields:

  • mode: RealTimeDataMode, uint8 – Real-time data mode.

  • rateLimit: uint8 – Maximum sending frequency in Hz, set to 0 to use the default value (currently 50 Hz).

1 + 1 = 2 bytes

header: SensorHeader | None = 354

SensorHeader.DATA_REAL_TIME_STREAMING_MODE (0x0162)

class capture2go.pkg.DataAbsoluteTime[source]

Bases: AbstractPackage

Absolute time to be applied to the sensor clock.

Note: The acknowlegement to CmdSetAbsoluteTime is a DataAbsoluteTime package with the same timestamp. Otherwise, DataAbsoluteTime is not used. To get the current time on the sensor, look at the timestamps in the DataStatus or DataClockRoundtrip packages.

Fields:

  • newTimestamp: int64 – New absolute timestamp (in nanoseconds).

8 bytes

header: SensorHeader | None = 369

SensorHeader.DATA_ABSOLUTE_TIME (0x0171)

class capture2go.pkg.DataClockRoundtrip[source]

Bases: AbstractPackage

Clock roundtrip package for estimation of clock drift between host and sensors.

To estimate clock drift between the host and the sensors, send this package regularly to the sensor (e.g., every second). When sending, set hostSendTimestamp to the current host time and the other 3 timestamps to zero.

The sensor will set sensorReceiveTimestamp directly after receiving the package and sensorSendTimestamp directly when sending the package.

The host should then set hostReceiveTimestamp directly after receiving the package. (The Python SDK does this automatically.)

Calculate (hostReceiveTimestamp + sensorReceiveTimestamp - hostSendTimestamp - sensorSendTimestamp)/2 to estimate the transmission delay and (hostSendTimestamp + hostReceiveTimestamp - sensorReceiveTimestamp - sensorSendTimestamp)/2 to estimate the host clock offset. Note that single samples will jitter significantly and outliers can occurr due to transmission issues.

Fields:

  • hostSendTimestamp: int64 – Timestamp (in nanoseconds) when host sent the message.

  • sensorReceiveTimestamp: int64 – Timestamp (in nanoseconds) when sensor received the message.

  • sensorSendTimestamp: int64 – Timestamp (in nanoseconds) when sensor sent the response.

  • hostReceiveTimestamp: int64 – Timestamp (in nanoseconds) when host received the response.

8 + 8 + 8 + 8 = 32 bytes

header: SensorHeader | None = 370

SensorHeader.DATA_CLOCK_ROUNDTRIP (0x0172)

class capture2go.pkg.DataLedConfig[source]

Bases: AbstractPackage

Configures the device LED.

Fields:

  • brightnessPercentage: uint8 – LED brightness percentage (default: 40).

  • alternativeColors: bool – If true, alternative LED colors are used (blue instead of green).

  • notifyColor: uint32 – Notification color RGB value (default: white, 0xFFFFFF).

1 + 1 + 4 = 6 bytes

header: SensorHeader | None = 386

SensorHeader.DATA_LED_CONFIG (0x0182)

class capture2go.pkg.DataLedMode[source]

Bases: AbstractPackage

Configures the LED notification light (typically white unless changed in DataLedConfig).

This is used by the app to flash the LED for one second at the start and end of the measurement.

Note: The DataLedMode sent as a response to CmdSetLedMode will always contain the actual and absolute timestamps. Those timestamps can be used for example for synchronization of IMU data and a video that recorded the flashing LED.

Fields:

  • notifyStartTimestamp: int64 – Start timestamp (in nanoseconds) for LED notification. Set to 0 for immediate start (if end timestamp is not 0), set both to 0 to disable.

  • notifyEndTimestamp: int64 – End timestamp (in nanoseconds) for LED notification. Set to 0 for unlimited duration (if end timestamp is not 0), set both to 0 to disable.

  • endTimestampIsRelative: bool – If true, end timestamp is relative to the start.

8 + 8 + 1 = 17 bytes

header: SensorHeader | None = 389

SensorHeader.DATA_LED_MODE (0x0185)

class capture2go.pkg.DataSyncOutputMode[source]

Bases: AbstractPackage

Synchronization output mode configuration.

Setting this pulls the USB-C sideband use pin (SBU) down for the configured duration. The resulting electrical signal can be used for precise time synchronization between the sensors and other systems or to automatically start or stop other measurement systems.

The response to CmdSetSyncOutputMode is sent after the pulse is finished and includes precise and absolute timestamps.

Fields:

  • startTimestamp: int64 – Start timestamp (in nanoseconds) for sync output. Set to 0 for immediate start (if end timestamp is not 0), set both to 0 to disable.

  • endTimestamp: int64 – End timestamp (in nanoseconds) for sync output. Set to 0 for unlimited duration (if end timestamp is not 0), set both to 0 to disable (max pulse duration 1 sec).

  • endTimestampIsRelative: bool – If true, end timestamp is relative to the start.

8 + 8 + 1 = 17 bytes

header: SensorHeader | None = 391

SensorHeader.DATA_SYNC_OUTPUT_MODE (0x0187)

class capture2go.pkg.DataStatus[source]

Bases: AbstractPackage

Device status information.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds).

  • sensorState: SensorState, uint8 – Current sensor state.

  • connectionState: ConnectionState, uint8 – Current connection state.

  • gyrBias: int16[3] – Gyroscope bias estimate, fixed-point, 2°/s full range. The gyroscope measurements already have this bias removed.

  • synchronized: bool – If true, device is either a sync sender or it is a sync receiver and received sufficient sync information recently.

  • battery: uint8 – Battery level in percent. When charging, 128 is added to the percentage.

  • freeStoragePercentage: uint8 – Free storage percentage.

8 + 1 + 1 + 3*2 + 1 + 1 + 1 = 19 bytes

header: SensorHeader | None = 513

SensorHeader.DATA_STATUS (0x0201)

class capture2go.pkg.DataFullPacked[source]

Bases: AbstractPackage

Full IMU data (raw data and orientations), encoded as fixed-point numbers and with 8 samples per package.

This is the main package type for recording and transmitting raw data.

Note: The orientation is only provided for the first sample because the remaining values can be extrapolated from the first orientation sample and the gyroscope measurements. See the Python SDK code of the parse method for an implementation.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds) of the first sample.

  • gyr: int16[24] – 8 gyroscope measurements, 2000°/s full range.

  • acc: int16[24] – 8 accelerometer measurements, 16*9.81 m/s² full range.

  • mag: int16[24] – 8 magnetometer measurements, in µT/16.

  • quat: uint64 – 6D orientation for first sample, including rest+magDist flags.

  • delta: int16 – Heading offset for first sample. The 9D orientation can be calculated from quat and delta.

  • errorFlags: uint8 – Error flags.

8 + 24*2 + 24*2 + 24*2 + 8 + 2 + 1 = 163 bytes

200 Hz: 32600 bytes/s

100 Hz: 16300 bytes/s

50 Hz: 8150 bytes/s

25 Hz: 4075 bytes/s

10 Hz: 1630 bytes/s

1 Hz: 163 bytes/s

class capture2go.pkg.DataFull6DPacked[source]

Bases: AbstractPackage

Variant of DataFullPacked that does not include magnetometer data. See DataFullPacked for more details.

Set disableMagData to true in the measurement mode to generate this package instead of DataFullPacked.

Note: Even with magnetometer data output disabled, this package still contains the full 6D and 9D orientations.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds) of the first sample.

  • gyr: int16[24] – 8 gyroscope measurements, 2000°/s full range.

  • acc: int16[24] – 8 accelerometer measurements, 16*9.81 m/s² full range.

  • quat: uint64 – 6D orientation for first sample, including rest+magDist flags.

  • delta: int16 – Heading offset for first sample. The 9D orientation can be calculated from quat and delta.

  • errorFlags: uint8 – Error flags.

8 + 24*2 + 24*2 + 8 + 2 + 1 = 115 bytes

200 Hz: 23000 bytes/s

100 Hz: 11500 bytes/s

50 Hz: 5750 bytes/s

25 Hz: 2875 bytes/s

10 Hz: 1150 bytes/s

1 Hz: 115 bytes/s

class capture2go.pkg.DataFullFixed[source]

Bases: AbstractPackage

Single sample containing full IMU data (raw data and orientations), encoded as fixed-point numbers.

This can be useful for streaming or recording at low sampling rates. In most cases, DataFullPacked is the better option.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds).

  • gyr: int16[3] – Gyroscope measurement, 2000°/s full range.

  • acc: int16[3] – Accelerometer measurement, 16*9.81 m/s² full range.

  • mag: int16[3] – Magnetometer measurement, in µT/16.

  • quat: uint64 – 6D orientation, including rest+magDist flags.

  • delta: int16 – Heading offset. The 9D orientation can be calculated from quat and delta.

  • errorFlags: uint8 – Error flags.

8 + 3*2 + 3*2 + 3*2 + 8 + 2 + 1 = 37 bytes

200 Hz: 7400 bytes/s

100 Hz: 3700 bytes/s

50 Hz: 1850 bytes/s

25 Hz: 925 bytes/s

10 Hz: 370 bytes/s

1 Hz: 37 bytes/s

class capture2go.pkg.DataFull6DFixed[source]

Bases: AbstractPackage

Variant of DataFullFixed that does not include magnetometer data. See DataFullFixed for more details.

Set disableMagData to true in the measurement mode to generate this package instead of DataFullFixed.

Note: Even with magnetometer data output disabled, this package still contains the full 6D and 9D orientations.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds).

  • gyr: int16[3] – Gyroscope measurement, 2000°/s full range.

  • acc: int16[3] – Accelerometer measurement, 16*9.81 m/s² full range.

  • quat: uint64 – 6D orientation, including rest+magDist flags.

  • delta: int16 – Heading offset. The 9D orientation can be calculated from quat and delta.

  • errorFlags: uint8 – Error flags.

8 + 3*2 + 3*2 + 8 + 2 + 1 = 31 bytes

200 Hz: 6200 bytes/s

100 Hz: 3100 bytes/s

50 Hz: 1550 bytes/s

25 Hz: 775 bytes/s

10 Hz: 310 bytes/s

1 Hz: 31 bytes/s

class capture2go.pkg.DataFullFloat200Hz[source]

Bases: AbstractPackage

Single sample containing full IMU data (raw data and orientations) at 200 Hz, encoded as 32-bit floating point numbers.

Unlike the other data packages, this package is not packed and included padding bytes.

Note: In most applications, the more efficient DataFullPacked or DataFullFixed packages should be prefered.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds).

  • gyr: float[3] – Gyroscope measurement in rad/s.

  • acc: float[3] – Accelerometer measurement in m/s².

  • mag: float[3] – Magnetometer measurement in µT.

  • quat: float[4] – 6D orientation quaternion (w, x, y, z).

  • delta: float – Heading offset in rad. The 9D orientation can be calculated from quat and delta.

  • restDetected: bool – Indicates if sensor is at rest.

  • magDistDetected: bool – Indicates if magnetic disturbance is detected.

  • errorFlags: uint8 – Error flags.

8 + 3*4 + 3*4 + 3*4 + 4*4 + 4 + 1 + 1 + 1 = 67 bytes (+ padding)

header: SensorHeader | None = 609

SensorHeader.DATA_FULL_FLOAT_200HZ (0x0261)

class capture2go.pkg.DataQuatPacked[source]

Bases: AbstractPackage

Orientation data, encoded as fixed-point numbers and with 20 samples per package.

This is the main package type for recording and transmitting orientation data.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds) of the first sample.

  • quat: uint64[20] – 6D orientation samples, including rest+magDist flags.

  • delta: int16[20] – Heading offset. The 9D orientation can be calculated from quat and delta.

  • errorFlags: uint8[20] – Error flags.

8 + 20*8 + 20*2 + 20 = 228 bytes

200 Hz: 45600 bytes/s

100 Hz: 22800 bytes/s

50 Hz: 11400 bytes/s

25 Hz: 5700 bytes/s

10 Hz: 2280 bytes/s

1 Hz: 228 bytes/s

class capture2go.pkg.DataQuatFixed[source]

Bases: AbstractPackage

Single orientation sample, encoded as fixed-point numbers.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds).

  • quat: uint64 – 6D orientation, including rest+magDist flags.

  • delta: int16 – Heading offset. The 9D orientation can be calculated from quat and delta.

  • errorFlags: uint8 – Error flags.

8 + 8 + 2 + 1 = 19 bytes

200 Hz: 3800 bytes/s

100 Hz: 1900 bytes/s

50 Hz: 950 bytes/s

25 Hz: 475 bytes/s

10 Hz: 190 bytes/s

1 Hz: 19 bytes/s

class capture2go.pkg.DataQuatFloat[source]

Bases: AbstractPackage

Single orientation sample, encoded as 32-bit floating point numbers.

Note: In most applications, the more efficient QuatFullPacked or QuatFullFixed packages should be prefered.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds).

  • quat: float[4] – 6D orientation quaternion (w, x, y, z).

  • delta: float – Heading offset in rad. The 9D orientation can be calculated from quat and delta.

  • restDetected: bool – Indicates if sensor is at rest.

  • magDistDetected: bool – Indicates if magnetic disturbance is detected.

  • errorFlags: uint8 – Error flags.

8 + 4*4 + 4 + 1 + 1 + 1 = 31 bytes

200 Hz: 6200 bytes/s

100 Hz: 3100 bytes/s

50 Hz: 1550 bytes/s

25 Hz: 775 bytes/s

10 Hz: 310 bytes/s

1 Hz: 31 bytes/s

class capture2go.pkg.DataRawBurst[source]

Bases: AbstractPackage

Raw data at ~1666 Hz of short high-frequency burst measurements.

Each package contains 16 samples, i.e., packages are generated at ~104 Hz.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds) of the first sample.

  • gyr: int16[48] – 16 gyroscope measurements.

  • acc: int16[48] – 16 accelerometer measurements.

  • mag: int16[3] – Magnetometer measurement for first sample.

  • errorFlags: uint8 – Error flags.

8 + 48*2 + 48*2 + 3*2 + 1 = 207 bytes

header: SensorHeader | None = 768

SensorHeader.DATA_RAW_BURST (0x0300)

class capture2go.pkg.DataAccZBurst[source]

Bases: AbstractPackage

Z-component of the accelerometer measurement at ~1666 Hz of short high-frequency burst measurements.

Compared to the full burst mode, choosing this package type reduces the data rate but still allows for measurement of high-frequency vibrations orthogonal to the device surface.

Each package contains 64 samples, i.e., packages are generated at ~26 Hz.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds) of the first sample.

  • accZ: int16[64] – 64 z-axis accelerometer measurements.

  • errorFlags: uint8 – Error flags.

8 + 64*2 + 1 = 137 bytes

header: SensorHeader | None = 769

SensorHeader.DATA_ACCZ_BURST (0x0301)

class capture2go.pkg.DataSyncTrigger[source]

Bases: AbstractPackage

Hardware synchronization event.

When a rising or falling edge of the USB-C sideband use pin (SBU) is detected, a DataSyncTrigger package with the current sensor timestamp is generated. Those packages can be used for precise time synchronization between the sensors and other systems.

Fields:

  • timestamp: int64 – Timestamp (in nanoseconds).

  • value: uint8 – 0 for falling edge, 1 for rising edge.

8 + 1 = 9 bytes

header: SensorHeader | None = 1024

SensorHeader.DATA_SYNC_TRIGGER (0x0400)

class capture2go.pkg.DataFsFileCount[source]

Bases: AbstractPackage

Number of files on the sensor.

Fields:

  • fileCount: uint16 – Number of files.

2 bytes

header: SensorHeader | None = 1281

SensorHeader.DATA_FS_FILE_COUNT (0x0501)

class capture2go.pkg.DataFsFile[source]

Bases: AbstractPackage

Information about a file on the sensor.

Fields:

  • index: uint16 – Index.

  • filename: char[65] – File name.

  • size: uint32 – File size in bytes.

2 + 65 + 4 = 71 bytes

header: SensorHeader | None = 1282

SensorHeader.DATA_FS_FILE (0x0502)

class capture2go.pkg.CmdFsGetBytes[source]

Bases: AbstractPackage

Command to get bytes from a file on the sensor.

Fields:

  • filename: char[65] – File name.

  • startPos: uint32 – Start position in the file.

  • endPos: uint32 – End position in the file. Set to 0 to transfer the whole file.

65 + 4 + 4 = 73 bytes

header: SensorHeader | None = 1283

SensorHeader.CMD_FS_GET_BYTES (0x0503)

class capture2go.pkg.DataFsBytes[source]

Bases: AbstractPackage

Chunk of bytes from a file on the sensor.

Fields:

  • offset: uint32 – Offset in the file.

  • payload: uint8[232] – Payload data (MAX_PAYLOAD_SIZE - 4).

4 + 232 = 236 bytes

header: SensorHeader | None = 1284

SensorHeader.DATA_FS_BYTES (0x0504)

class capture2go.pkg.DataFsFilename[source]

Bases: AbstractPackage

This package contains a file name for filesystem operations, used by various commands.

Fields:

  • filename: char[65] – File name.

65 bytes

class capture2go.pkg.DataFsSize[source]

Bases: AbstractPackage

Size of a file on the sensor.

Fields:

  • filename: char[65] – File name.

  • fileSize: uint32 – File size in bytes.

65 + 4 = 69 bytes

header: SensorHeader | None = 1288

SensorHeader.DATA_FS_SIZE (0x0508)

class capture2go.pkg.SensorError[source]

Bases: AbstractPackage

Represents an error that occurred on the sensor.

Fields:

  • errorCode: ErrorCode, uint8 – Error code.

  • command: SensorHeader, uint16 – If applicable: the command that caused the error, otherwise: ERROR.

1 + 2 = 3 bytes

header: SensorHeader | None = 65535

SensorHeader.ERROR (0xFFFF)

class capture2go.pkg.SensorSerialPackage[source]

Bases: AbstractPackage

Package frame including header, payload size, and checksum.

Fields:

  • startByte: uint8 – Fixed 0x02 byte.

  • crc32: uint32 – Checksum calculated over header and payload.

  • payloadSize: uint8 – Size of payload, between 0 and 236.

  • header: SensorHeader, uint16 – Value that identifies the command or data package.

  • payload: uint8[236] – Variable-length payload, between 0 and 236 bytes.

1 + 4 + 1 + 2 + 236 = 244 bytes