|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.openuat.sensors.SamplesSource
org.openuat.sensors.AsciiLineReaderBase
org.openuat.sensors.WiTiltRawReader
public class WiTiltRawReader
This class implements a reader for the "RAW" data format generated by Spark Fun Electronics WiTilt v2.5 sensors. It is a simple ASCII-based format in the form: X=526 Y=473 Z=741 X=522 Y=481 Z=753 X=514 Y=480 Z=747 X=518 Y=474 Z=748 X=521 Y=481 Z=745 This class depends on the devices being pre-configured appropriately, e.g. to sample all 3 axises and with the correct sampling rate. They also need to be configured to generate their "RAW" data stream. There are two ways to connect to a WiTilt device: - With a (virtual) serial port. This can be used then the WiTilt device is connected to a physical serial port via its Debug port or with the operating system RFCOMM emulation, e.g. the /dev/rfommX devices unter Linux or COMX devices under Windows. To use this method, use the method
- Directly from Java with a JSR82 implementation. To use this method, use
the method @see #openBluetooth(String, boolean).
Additionally, this class can be used either with the original firmware, which
displays the menu of the WiTilt device when connecting to it, or with a modified
firmware that goes directly into sampling mode after connecting. This can be
controlled by the boolean parameters given to the open methods.| Field Summary | |
|---|---|
static int |
VALUE_RANGE
|
| Fields inherited from class org.openuat.sensors.AsciiLineReaderBase |
|---|
port, reader, reopenStreamFrom |
| Fields inherited from class org.openuat.sensors.SamplesSource |
|---|
maxNumLines |
| Constructor Summary | |
|---|---|
WiTiltRawReader()
Initializes the WiTilt RAW reader object, but does not open a connection. |
|
| Method Summary | |
|---|---|
void |
dispose()
This closes the serial port or Bluetooth channel properly. |
TimeSeries_Int.Parameters |
getParameters_Int()
Instead of to [-1;1], these integer parameters map to [-1024;1024], i.e. |
TimeSeries.Parameters |
getParameters()
Provides appropriate parameters for interpreting the values to normalize to the [-1;1] range. |
static void |
main(java.lang.String[] args)
|
void |
openBluetooth(java.lang.String deviceAddress,
boolean usingMenu)
Opens a connection to the WiTilt device via an RFCOMM channel with JSR82. |
void |
openSerial(java.lang.String serialPortName,
boolean usingMenu)
Opens a connection to the WiTilt device via a (virtual) serial port. |
protected void |
parseLine(java.lang.String line)
A helper function to parse single line of the format produced by parport-pulsewidth. |
| Methods inherited from class org.openuat.sensors.AsciiLineReaderBase |
|---|
handleSample |
| Methods inherited from class org.openuat.sensors.SamplesSource |
|---|
addSink, addSink, addSink, emitSample, emitSample, getMaxNumLines, removeSink_Int, removeSink, removeSink, simulateSampling, start, stop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int VALUE_RANGE
| Constructor Detail |
|---|
public WiTiltRawReader()
openSerial(String, boolean),
openBluetooth(String, boolean)| Method Detail |
|---|
public void openSerial(java.lang.String serialPortName,
boolean usingMenu)
throws java.io.IOException
serialPortName - The serial port to read from. It will be opened
and initialized with the correct parameters.usingMenu - Set to true when the Witilt device runs the original
firmware and we need to interact with its menu during
initialization. Set to false when using the modified
firmware that goes directly into sampling mode.
InternalApplicationException
java.io.FileNotFoundException - When filename does not exist or can not be opened.
java.io.IOException
public void openBluetooth(java.lang.String deviceAddress,
boolean usingMenu)
throws java.io.IOException
deviceAddress - The Bluetooth MAC address of the WiTilt sensor to connect
to, in the format "AABBCCDDEEFF";usingMenu - Set to true when the Witilt device runs the original
firmware and we need to interact with its menu during
initialization. Set to false when using the modified
firmware that goes directly into sampling mode.
java.io.IOExceptionpublic void dispose()
dispose in class AsciiLineReaderBaseprotected void parseLine(java.lang.String line)
parseLine in class AsciiLineReaderBaseline - The line to parse.public TimeSeries.Parameters getParameters()
getParameters in class SamplesSourcepublic TimeSeries_Int.Parameters getParameters_Int()
getParameters_Int in class SamplesSource
public static void main(java.lang.String[] args)
throws java.io.IOException
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||