RadioDecoder Class Reference

This class runs a thread which records servo position from sound card. More...

#include <Devices/RadioDecoder.H>

Inheritance diagram for RadioDecoder:
Inheritance graph
[legend]
Collaboration diagram for RadioDecoder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RadioDecoder (OptionManager &mgr, const std::string &descrName="R/C Radio Decoder", const std::string &tagName="RadioDecoder")
 Constructor.
 ~RadioDecoder ()
 Destructor.
void zeroCalibrate (const int nbiter=20)
 Calibrate the zero (will block until done).
void rangeCalibrate (const int nbiter=200)
 Calibrate the positive and negative ranges to +/-1.0.
float getVal (const int channel) const
 Access function; values guaranteed within ]-1.0 .. 1.0[.
void run ()
 This method should not be called (implements thread code).

Protected Member Functions

void start1 ()
 get started (see ModelComponent.H)
void start2 ()
 get started (see ModelComponent.H)
void stop1 ()
 get stopped (see ModelComponent.H)

Protected Attributes

rutz::shared_ptr< NModelParam
< float > > * 
zero
 array of zero calibration values
rutz::shared_ptr< NModelParam
< float > > * 
posmult
 array of positive multiplier calibration values
rutz::shared_ptr< NModelParam
< float > > * 
negmult
 array of negative multiplier calibration values

Detailed Description

This class runs a thread which records servo position from sound card.

Radio-control servomechanisms are controlled by a pulse-width-modulated protocol in which a 1-2ms pulse (from 0V to 4.8V) is generated every 18-25ms. The width of the pulse (between 1 and 2ms) determines the position of the servo. This class uses an AudioGrabber to record pulses, for example coming from an R/C receiver. It then computes the pulse width and converts it to a number between -1.0 and 1.0. The current pulse values are available via getVal(), which is a non-blocking function call.

Definition at line 60 of file RadioDecoder.H.


Constructor & Destructor Documentation

RadioDecoder::RadioDecoder ( OptionManager mgr,
const std::string descrName = "R/C Radio Decoder",
const std::string tagName = "RadioDecoder" 
)

Constructor.

Definition at line 71 of file RadioDecoder.C.

References ModelComponent::addSubComponent(), OPT_AudioGrabberDevice, and OPT_AudioMixerDevice.

RadioDecoder::~RadioDecoder (  ) 

Destructor.

Definition at line 167 of file RadioDecoder.C.


Member Function Documentation

float RadioDecoder::getVal ( const int  channel  )  const

Access function; values guaranteed within ]-1.0 .. 1.0[.

Definition at line 171 of file RadioDecoder.C.

References ASSERT, negmult, posmult, and zero.

Referenced by rangeCalibrate().

void RadioDecoder::rangeCalibrate ( const int  nbiter = 200  ) 

Calibrate the positive and negative ranges to +/-1.0.

Definition at line 210 of file RadioDecoder.C.

References getVal(), negmult, posmult, and zero.

void RadioDecoder::run (  ) 

This method should not be called (implements thread code).

Definition at line 248 of file RadioDecoder.C.

References AudioBuffer< T >::getDataPtr(), and AudioBuffer< T >::nsamples().

void RadioDecoder::start1 (  )  [protected, virtual]

get started (see ModelComponent.H)

Reimplemented from ModelComponent.

Definition at line 117 of file RadioDecoder.C.

References negmult, posmult, and zero.

void RadioDecoder::start2 (  )  [protected, virtual]

get started (see ModelComponent.H)

Reimplemented from ModelComponent.

Definition at line 147 of file RadioDecoder.C.

void RadioDecoder::stop1 (  )  [protected, virtual]

get stopped (see ModelComponent.H)

Reimplemented from ModelComponent.

Definition at line 154 of file RadioDecoder.C.

References negmult, posmult, and zero.

void RadioDecoder::zeroCalibrate ( const int  nbiter = 20  ) 

Calibrate the zero (will block until done).

Definition at line 191 of file RadioDecoder.C.

References zero.


Member Data Documentation

array of negative multiplier calibration values

Definition at line 85 of file RadioDecoder.H.

Referenced by getVal(), rangeCalibrate(), start1(), and stop1().

array of positive multiplier calibration values

Definition at line 84 of file RadioDecoder.H.

Referenced by getVal(), rangeCalibrate(), start1(), and stop1().

array of zero calibration values

Definition at line 83 of file RadioDecoder.H.

Referenced by getVal(), rangeCalibrate(), start1(), stop1(), and zeroCalibrate().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:46 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3