org.openuat.sensors
Class XsensLogReader

java.lang.Object
  extended by org.openuat.sensors.SamplesSource
      extended by org.openuat.sensors.AsciiLineReaderBase
          extended by org.openuat.sensors.XsensLogReader

public class XsensLogReader
extends AsciiLineReaderBase

This class implements a reader for the data format generated by Carl Fischer's Linux "logger" tool for sampling accelerometer data from Xsens devices.

Version:
1.0
Author:
Rene Mayrhofer

Field Summary
static int SAMPLE_RATE
          The sample rate in Hz.
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
XsensLogReader(java.io.InputStream stream)
          Initializes the parallel port PWM log reader.
XsensLogReader(java.lang.String filename)
          Initializes the parallel port PWM log reader.
 
Method Summary
 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)
           
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
dispose, 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

VALUE_RANGE

public static final int VALUE_RANGE
See Also:
Constant Field Values

SAMPLE_RATE

public static final int SAMPLE_RATE
The sample rate in Hz.

See Also:
Constant Field Values
Constructor Detail

XsensLogReader

public XsensLogReader(java.lang.String filename)
               throws java.io.FileNotFoundException
Initializes the parallel port PWM log reader. It only saves the passed parameters and opens the InputStream to read from the specified file, and thus implicitly to check if the file exists and can be opened.

Parameters:
filename - The log to read from. This may either be a normal log file when simulation is intended or it can be a FIFO/pipe to read online data.
Throws:
java.io.FileNotFoundException - When filename does not exist or can not be opened.

XsensLogReader

public XsensLogReader(java.io.InputStream stream)
Initializes the parallel port PWM log reader. It only saves the passed parameters. This is an alternative to @see #ParallelPortPWMReader(String, int) and should only be used in special cases.

Parameters:
stream - Specifies the InputStream to read from.
Method Detail

parseLine

protected void parseLine(java.lang.String line)
A helper function to parse single line of the format produced by parport-pulsewidth. This method creates the samples and emits events.

Specified by:
parseLine in class AsciiLineReaderBase
Parameters:
line - The line to parse.

getParameters

public TimeSeries.Parameters getParameters()
Provides appropriate parameters for interpreting the values to normalize to the [-1;1] range.

Specified by:
getParameters in class SamplesSource

getParameters_Int

public TimeSeries_Int.Parameters getParameters_Int()
Instead of to [-1;1], these integer parameters map to [-1024;1024], i.e. MAXIMUM_RANGE in TimeSeries_Int.

Specified by:
getParameters_Int in class SamplesSource

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException


2005-2009, Rene Mayrhofer.