Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

RadioDecoder Class Reference

#include <Devices/RadioDecoder.H>

Inheritance diagram for RadioDecoder:

Inheritance graph
[legend]
Collaboration diagram for RadioDecoder:

Collaboration graph
[legend]
List of all members.

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.

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


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(), CLFATAL, mix, OPT_AudioGrabberDevice, OPT_AudioGrabberStereo, OPT_AudioMixerCdIn, OPT_AudioMixerDevice, OPT_AudioMixerLineIn, and OPT_AudioMixerMicIn.

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(), i, LERROR, LINFO, negmult, posmult, x, and zero.

void RadioDecoder::run  ) 
 

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

Definition at line 248 of file RadioDecoder.C.

References CLFATAL, first, AudioBuffer< T >::getDataPtr(), i, last, MAXRDPULSE, MINRDPULSE, AudioBuffer< T >::nsamples(), RD_THRESH, and RD_WIN.

Referenced by RadioDecoder_run().

void RadioDecoder::start1  )  [protected, virtual]
 

get started (see ModelComponent.H)

Reimplemented from ModelComponent.

Definition at line 117 of file RadioDecoder.C.

References buf, CLFATAL, i, NModelParam< T >::make(), 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.

References RadioDecoder_run().

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 i, LINFO, and zero.


Member Data Documentation

rutz::shared_ptr<NModelParam<float> >* RadioDecoder::negmult [protected]
 

array of negative multiplier calibration values

Definition at line 85 of file RadioDecoder.H.

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

rutz::shared_ptr<NModelParam<float> >* RadioDecoder::posmult [protected]
 

array of positive multiplier calibration values

Definition at line 84 of file RadioDecoder.H.

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

rutz::shared_ptr<NModelParam<float> >* RadioDecoder::zero [protected]
 

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 Mon Nov 23 15:50:50 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4