Module: IMUSensor

Module to access bluetooth IMU sensor (MotionNet sensor from UTDallas)

Version:
  • $$Id$$
Author:
  • Hunter Massey
Source:

Methods

(static) Stream()

Construct an instance of a Controller object type. This starts a thread in the java code that constantly reads input on the serial port that was linked to the sensor. If the code stops unexpectedly it is possible this serial port will remain open and ptolemy will need to be restarted. This code may be 'dumb' as it simply reads the input buffer whenever the getSample method is called and returns it. Checking whether this sample is a new one is done in the accessor.

Example: var imuSensor = require('IMUSensor'); var stream = imuSensor.Stream(); initialize: stream.start(bluetooth serialport #); setInterval(getSample, this.getParameter(samplingRate)); getSample: var sample = stream.getSample(); if (prevSample != sample) { prevSample = sample; this.send('stream', sample); }

Source: