
#include <Devices/RadioDecoder.H>
Inheritance diagram for RadioDecoder:


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.
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. |
|
|
Destructor.
Definition at line 167 of file RadioDecoder.C. |
|
|
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(). |
|
|
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. |
|
|
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(). |
|
|
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. |
|
|
get started (see ModelComponent.H)
Reimplemented from ModelComponent. Definition at line 147 of file RadioDecoder.C. References RadioDecoder_run(). |
|
|
get stopped (see ModelComponent.H)
Reimplemented from ModelComponent. Definition at line 154 of file RadioDecoder.C. |
|
|
Calibrate the zero (will block until done).
Definition at line 191 of file RadioDecoder.C. |
|
|
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(). |
1.4.4