PyVMU Documentation

Introduction

PyVMU is a Python-based toolkit for interfacing with the Variense VMU931 IMU device.

It supports communication with, and parsing of the VMU931 data streams.

Usage

class pyvmu.vmu931.VMU931Parser(device='/dev/tty.usbmodem1411', accelerometer=False, magnetometer=False, gyroscope=False, euler=False, quaternion=False, heading=False)[source]

This class is responsible for communicating with and parsing data from the VMU931 inertial measurement unit.

__init__(device='/dev/tty.usbmodem1411', accelerometer=False, magnetometer=False, gyroscope=False, euler=False, quaternion=False, heading=False)[source]

Opens a connection to the VMU931 device

Parameters:
  • device – Serial device name (on Windows) or path (nix, including OS X).
  • accelerometer – Enable/disable accelerometer data streaming.
  • magnetometer – Enable/disable magnetometer data streaming.
  • gyroscope – Enable/disable gyroscope data streaming.
  • euler – Enable/disable euler angle data streaming.
  • quaternion – Enable/disable quaternion data streaming.
  • heading – Enable/disable compass heading data streaming.
calibrate()[source]

Calibrate the VMU931 (be sure to lay the device on a flat surface, with Z axis pointing upward)

parse(callback=None)[source]

Parses a single packet from the VMU931 device, returning a namedtuple. Typically called multiple times from within a loop.

If device status is currently known, we wait for an incoming status packet and parse it. This method will block until status is received (so that we’re in a known state). This should never happen outside of the automatic call to parse() made during initialisation.

When a status packet is received, self.device_status is updated to represent the new state.

If a callback method is specified (through the callback argument) when calling parse(), that method will be called when the packet is parsed.

Parameters:callback – Method to call after processing each packet
Returns:processed packet
request_status()[source]

Request a new status packet from the VMU931

set_accelerometer(state)[source]

Enable/disable streaming of accelerometer data.

Parameters:state – True/False, desired state
set_accelerometer_resolution(resolution)[source]

Sets the accelerometer output resolution of the VMU931 device.

Parameters:resolution – 2, 4, 8 or 16.
set_euler(state)[source]

Enable/disable streaming of euler angle data.

Parameters:state – True/False, desired state
set_gyroscope(state)[source]

Enabled/disable streaming of gyroscope data.

Parameters:state – True/False, desired state
set_gyroscope_resolution(resolution)[source]

Sets the gyroscope output resolution of the VMU931 device.

Parameters:resolution – 250, 500, 1000 or 2000.
set_heading(state)[source]

Enable/disable streaming of compass heading data.

Parameters:state – True/False, desired state
set_magnetometer(state)[source]

Enable/disable streaming of magnetometer data.

Parameters:state – True/False, desired state
set_quaternion(state)[source]

Enable/disable streaming of quaternion data.

Parameters:state – True/False, desired state