Homepage Demos Overview Downloads Tutorials Reference
Credits

WalkCalibration Class Reference

#include <WalkCalibration.h>

Inheritance diagram for WalkCalibration:

Inheritance graph
[legend]
List of all members.

Detailed Description

allows interactive calibration of a walk engine

In retrospect, this might have been a little easier to do as a ControlBase/StateNode multiple inheritance instead of ControlBase/EventListener... oh well.

Definition at line 17 of file WalkCalibration.h.

Public Member Functions

 WalkCalibration ()
 constructor
 ~WalkCalibration ()
 destructor
virtual ControlBaseactivate (MotionManager::MC_ID disp_id, Socket *gui)
 Called when the control is activated (or the control system is reactivating).
virtual void refresh ()
 called when the child has deactivated and this control should refresh its display, or some other event (such as the user pressing the refresh button) has happened to cause a refresh to be needed
virtual void deactivate ()
 called when this control is being popped from the control stack
virtual ControlBasedoSelect ()
 when the user has trigger an "open selection" - default is to return the hilighted control*/
virtual void processEvent (const EventBase &e)
 listens for locomotion events so we know when to stop recording
virtual ControlBasetakeInput (const std::string &msg)
 called when the user has supplied a text string (may or may not have been prompted by doReadStdIn()! May not even be active yet - the user can direct the same input to a set of hilighted menus)
virtual void setHilights (const std::vector< unsigned int > &hi)
 sets the hilighted slots
virtual void hilightFirst ()
 sets the hilight to the first non-null slot

Protected Types

enum  {
  ROOT, CHOOSE, READY, MOVING,
  READING_1, READING_2, CLEAR
}
enum  dataSource {
  fs, fr, sr, br,
  bs, r, NUM_SRC
}
 allows representation of the current sample type More...

Protected Member Functions

void setupRoot ()
 sets state to root menu
void setupChoose ()
 sets state to choose type menu
void setupReady ()
 sets state to ready menu
void setupMoving ()
 sets state to moving menu
void setupReading1 ()
 sets state to enter first measurement menu
void setupReading2 ()
 sets state to enter second measurement menu
void setupClear ()
 sets state to clear confirmation menu
unsigned int getType ()
 returns current sample type
unsigned int getFirstIndex (dataSource t)
 returns a name index for the first measurement type
unsigned int getSecondIndex (dataSource t)
 returns a name index for the second measurement type
char * getIndexName (unsigned int t)
 returns name for measurement type
char * getFirstMeasure (dataSource t)
 returns name for first measurement type
char * getSecondMeasure (dataSource t)
 returns name for second measurement type
float arclen (float d, float a, float sign)
 calculates arc distance corresponding to a displacement and angle, negated if necessary to match sign
void addSample ()
 adds data point corresponding to measurements stored in firstIn and secondIn
void addSample (std::vector< float * > &dat, unsigned int row, float sol)
 adds data point to dat at row with solution (deprecated)
void addSample (std::vector< float * > &dat, float x, float y, float a)
 adds data point to dat for a given x,y,a (and old_x, old_y, old_a)

Static Protected Member Functions

static void loadData (const std::string &name, std::vector< float * > &data)
 does the work of loading data sets
static void saveData (const std::string &name, const std::vector< float * > &data)
 does the work of saving data sets
static void clearData (std::vector< float * > &data)
 clears current data
static void report (unsigned int row, float cmd, float actual)
 reports data as they are being taken
static void err (const std::string &str)
 pops up an error message on the controller and also displays it on the console

Protected Attributes

enum WalkCalibration:: { ... }  st
 the currently active state
enum WalkCalibration::dataSource curType
 allows representation of the current sample type
float old_x
 the x velocity recorded when we started moving
float old_y
 the y velocity recorded when we started moving
float old_a
 the a velocity recorded when we started moving
unsigned int startTime
 the time recording started
unsigned int stopTime
 the time recording stopped
ControlBasehelp
 control holding help info
FileInputControlload
 control for loading data
StringInputControlsave
 control for saving data
ControlBasemeasure
 control for taking measurements
ControlBaseclear
 control for clearing data
ToggleControlpolar
 control for selecting polar measurements for fs/bs
ToggleControlrect
 control for selecting cartesian measurements for fs/bs
bool isPolar
 true if polar measurements is selected
std::string lastLoad
 name last data file selected (so we know if a new has been selected
float firstIn
 the input given for the first measurement
float secondIn
 the input given for the second measurement
std::vector< float * > data [NUM_SRC]
 an array of vectors of sample points (one veotor for each of the sample types)
unsigned int cnts [NUM_SRC]
 count of samples for each sample type (cnts[i] should equal data[i].size())
std::string status
 string to send for ControllerGUI status message (current count of each sample type)

Static Protected Attributes

static char * datanames [NUM_SRC] = { "fs","fr","sr","br","bs","rr" }
 name for each sample type

Private Member Functions

 WalkCalibration (const WalkCalibration &)
 don't call
WalkCalibrationoperator= (const WalkCalibration &)
 don't call


Member Enumeration Documentation

anonymous enum [protected]
 

Enumeration values:
ROOT 
CHOOSE 
READY 
MOVING 
READING_1 
READING_2 
CLEAR 

Definition at line 46 of file WalkCalibration.h.

enum WalkCalibration::dataSource [protected]
 

allows representation of the current sample type

Enumeration values:
fs 
fr 
sr 
br 
bs 
r 
NUM_SRC 

Definition at line 57 of file WalkCalibration.h.


Constructor & Destructor Documentation

WalkCalibration::WalkCalibration  ) 
 

constructor

Definition at line 15 of file WalkCalibration.cc.

WalkCalibration::~WalkCalibration  ) 
 

destructor

Definition at line 175 of file WalkCalibration.cc.

WalkCalibration::WalkCalibration const WalkCalibration  )  [private]
 

don't call


Member Function Documentation

ControlBase * WalkCalibration::activate MotionManager::MC_ID  disp_id,
Socket gui
[virtual]
 

Called when the control is activated (or the control system is reactivating).

Takes the id number of a LedMC which the control should use, maintained by Controller. Controls share the display which is passed, and may use the socket gui to communicate with the GUI controller, if it is connected.

Returns:
a ControlBase pointer. Return:
  • this if the control should stay active (if it's not a one-shot command)
  • NULL to return to parent
  • other address to spawn a child control

Reimplemented from ControlBase.

Definition at line 184 of file WalkCalibration.cc.

void WalkCalibration::addSample std::vector< float * > &  dat,
float  x,
float  y,
float  a
[protected]
 

adds data point to dat for a given x,y,a (and old_x, old_y, old_a)

Definition at line 895 of file WalkCalibration.cc.

void WalkCalibration::addSample std::vector< float * > &  dat,
unsigned int  row,
float  sol
[protected]
 

adds data point to dat at row with solution (deprecated)

Definition at line 878 of file WalkCalibration.cc.

void WalkCalibration::addSample  )  [protected]
 

adds data point corresponding to measurements stored in firstIn and secondIn

Definition at line 795 of file WalkCalibration.cc.

Referenced by takeInput().

float WalkCalibration::arclen float  d,
float  a,
float  sign
[protected]
 

calculates arc distance corresponding to a displacement and angle, negated if necessary to match sign

Definition at line 737 of file WalkCalibration.cc.

Referenced by addSample().

void WalkCalibration::clearData std::vector< float * > &  data  )  [static, protected]
 

clears current data

Definition at line 408 of file WalkCalibration.cc.

Referenced by doSelect(), and loadData().

virtual void WalkCalibration::deactivate  )  [inline, virtual]
 

called when this control is being popped from the control stack

Reimplemented from ControlBase.

Definition at line 29 of file WalkCalibration.h.

ControlBase * WalkCalibration::doSelect  )  [virtual]
 

when the user has trigger an "open selection" - default is to return the hilighted control*/

The value which is returned is then activate()ed and pushed on the Controller's stack

Reimplemented from ControlBase.

Definition at line 215 of file WalkCalibration.cc.

void WalkCalibration::err const std::string &  str  )  [static, protected]
 

pops up an error message on the controller and also displays it on the console

Definition at line 867 of file WalkCalibration.cc.

Referenced by loadData(), saveData(), setupMoving(), and takeInput().

unsigned int WalkCalibration::getFirstIndex dataSource  t  )  [protected]
 

returns a name index for the first measurement type

Definition at line 647 of file WalkCalibration.cc.

Referenced by setupChoose(), setupMoving(), and setupReady().

char * WalkCalibration::getFirstMeasure dataSource  t  )  [protected]
 

returns name for first measurement type

Definition at line 694 of file WalkCalibration.cc.

Referenced by processEvent(), setupReading1(), and takeInput().

char * WalkCalibration::getIndexName unsigned int  t  )  [protected]
 

returns name for measurement type

Definition at line 680 of file WalkCalibration.cc.

Referenced by setupChoose(), setupMoving(), and setupReady().

unsigned int WalkCalibration::getSecondIndex dataSource  t  )  [protected]
 

returns a name index for the second measurement type

Definition at line 664 of file WalkCalibration.cc.

Referenced by setupChoose(), setupMoving(), and setupReady().

char * WalkCalibration::getSecondMeasure dataSource  t  )  [protected]
 

returns name for second measurement type

Definition at line 718 of file WalkCalibration.cc.

Referenced by processEvent(), setupReading2(), and takeInput().

unsigned int WalkCalibration::getType  )  [protected]
 

returns current sample type

void WalkCalibration::hilightFirst  )  [virtual]
 

sets the hilight to the first non-null slot

Reimplemented from ControlBase.

Definition at line 348 of file WalkCalibration.cc.

Referenced by setupClear().

void WalkCalibration::loadData const std::string &  name,
std::vector< float * > &  data
[static, protected]
 

does the work of loading data sets

Definition at line 362 of file WalkCalibration.cc.

Referenced by refresh().

WalkCalibration& WalkCalibration::operator= const WalkCalibration  )  [private]
 

don't call

void WalkCalibration::processEvent const EventBase e  )  [virtual]
 

listens for locomotion events so we know when to stop recording

Implements EventListener.

Definition at line 283 of file WalkCalibration.cc.

void WalkCalibration::refresh  )  [virtual]
 

called when the child has deactivated and this control should refresh its display, or some other event (such as the user pressing the refresh button) has happened to cause a refresh to be needed

Reimplemented from ControlBase.

Definition at line 190 of file WalkCalibration.cc.

Referenced by doSelect(), processEvent(), and takeInput().

void WalkCalibration::report unsigned int  row,
float  cmd,
float  actual
[static, protected]
 

reports data as they are being taken

Definition at line 856 of file WalkCalibration.cc.

Referenced by addSample().

void WalkCalibration::saveData const std::string &  name,
const std::vector< float * > &  data
[static, protected]
 

does the work of saving data sets

Definition at line 386 of file WalkCalibration.cc.

Referenced by refresh().

void WalkCalibration::setHilights const std::vector< unsigned int > &  hi  )  [virtual]
 

sets the hilighted slots

Reimplemented from ControlBase.

Definition at line 335 of file WalkCalibration.cc.

void WalkCalibration::setupChoose  )  [protected]
 

sets state to choose type menu

Definition at line 426 of file WalkCalibration.cc.

Referenced by doSelect().

void WalkCalibration::setupClear  )  [protected]
 

sets state to clear confirmation menu

Definition at line 635 of file WalkCalibration.cc.

Referenced by doSelect().

void WalkCalibration::setupMoving  )  [protected]
 

sets state to moving menu

Definition at line 540 of file WalkCalibration.cc.

Referenced by doSelect().

void WalkCalibration::setupReading1  )  [protected]
 

sets state to enter first measurement menu

Definition at line 600 of file WalkCalibration.cc.

Referenced by processEvent().

void WalkCalibration::setupReading2  )  [protected]
 

sets state to enter second measurement menu

Definition at line 617 of file WalkCalibration.cc.

Referenced by setupReading1(), and takeInput().

void WalkCalibration::setupReady  )  [protected]
 

sets state to ready menu

Definition at line 450 of file WalkCalibration.cc.

Referenced by doSelect(), and takeInput().

void WalkCalibration::setupRoot  )  [protected]
 

sets state to root menu

Definition at line 414 of file WalkCalibration.cc.

Referenced by doSelect(), and WalkCalibration().

ControlBase * WalkCalibration::takeInput const std::string &  msg  )  [virtual]
 

called when the user has supplied a text string (may or may not have been prompted by doReadStdIn()! May not even be active yet - the user can direct the same input to a set of hilighted menus)

The value which is returned is then activate()ed and pushed on the Controller's stack

Reimplemented from ControlBase.

Definition at line 298 of file WalkCalibration.cc.


Member Data Documentation

ControlBase* WalkCalibration::clear [protected]
 

control for clearing data

Definition at line 103 of file WalkCalibration.h.

Referenced by doSelect(), setupRoot(), WalkCalibration(), and ~WalkCalibration().

unsigned int WalkCalibration::cnts[NUM_SRC] [protected]
 

count of samples for each sample type (cnts[i] should equal data[i].size())

Definition at line 112 of file WalkCalibration.h.

Referenced by addSample(), doSelect(), refresh(), setupClear(), and WalkCalibration().

enum WalkCalibration::dataSource WalkCalibration::curType [protected]
 

allows representation of the current sample type

Referenced by addSample(), doSelect(), processEvent(), refresh(), setupMoving(), setupReading1(), setupReading2(), setupReady(), and takeInput().

std::vector<float*> WalkCalibration::data[NUM_SRC] [protected]
 

an array of vectors of sample points (one veotor for each of the sample types)

Definition at line 111 of file WalkCalibration.h.

Referenced by addSample(), doSelect(), and refresh().

char * WalkCalibration::datanames = { "fs","fr","sr","br","bs","rr" } [static, protected]
 

name for each sample type

Definition at line 12 of file WalkCalibration.cc.

Referenced by refresh().

float WalkCalibration::firstIn [protected]
 

the input given for the first measurement

Definition at line 109 of file WalkCalibration.h.

Referenced by addSample(), and takeInput().

ControlBase* WalkCalibration::help [protected]
 

control holding help info

Definition at line 99 of file WalkCalibration.h.

Referenced by setupRoot(), WalkCalibration(), and ~WalkCalibration().

bool WalkCalibration::isPolar [protected]
 

true if polar measurements is selected

Definition at line 106 of file WalkCalibration.h.

Referenced by addSample(), getFirstMeasure(), getSecondMeasure(), refresh(), and setupReady().

std::string WalkCalibration::lastLoad [protected]
 

name last data file selected (so we know if a new has been selected

Definition at line 107 of file WalkCalibration.h.

Referenced by refresh().

FileInputControl* WalkCalibration::load [protected]
 

control for loading data

Definition at line 100 of file WalkCalibration.h.

Referenced by refresh(), setupRoot(), WalkCalibration(), and ~WalkCalibration().

ControlBase* WalkCalibration::measure [protected]
 

control for taking measurements

Definition at line 102 of file WalkCalibration.h.

Referenced by doSelect(), setupRoot(), WalkCalibration(), and ~WalkCalibration().

float WalkCalibration::old_a [protected]
 

the a velocity recorded when we started moving

Definition at line 95 of file WalkCalibration.h.

Referenced by addSample(), and setupMoving().

float WalkCalibration::old_x [protected]
 

the x velocity recorded when we started moving

Definition at line 93 of file WalkCalibration.h.

Referenced by addSample(), and setupMoving().

float WalkCalibration::old_y [protected]
 

the y velocity recorded when we started moving

Definition at line 94 of file WalkCalibration.h.

Referenced by addSample(), and setupMoving().

ToggleControl* WalkCalibration::polar [protected]
 

control for selecting polar measurements for fs/bs

Definition at line 104 of file WalkCalibration.h.

Referenced by doSelect(), refresh(), setHilights(), and setupReady().

ToggleControl* WalkCalibration::rect [protected]
 

control for selecting cartesian measurements for fs/bs

Definition at line 105 of file WalkCalibration.h.

Referenced by doSelect(), setHilights(), and setupReady().

StringInputControl* WalkCalibration::save [protected]
 

control for saving data

Definition at line 101 of file WalkCalibration.h.

Referenced by refresh(), setupRoot(), WalkCalibration(), and ~WalkCalibration().

float WalkCalibration::secondIn [protected]
 

the input given for the second measurement

Definition at line 110 of file WalkCalibration.h.

Referenced by addSample(), and takeInput().

enum { ... } WalkCalibration::st [protected]
 

the currently active state

Referenced by doSelect(), hilightFirst(), processEvent(), refresh(), setHilights(), setupChoose(), setupClear(), setupMoving(), setupReading1(), setupReading2(), setupReady(), setupRoot(), and takeInput().

unsigned int WalkCalibration::startTime [protected]
 

the time recording started

Definition at line 96 of file WalkCalibration.h.

Referenced by addSample(), processEvent(), and setupMoving().

std::string WalkCalibration::status [protected]
 

string to send for ControllerGUI status message (current count of each sample type)

Definition at line 115 of file WalkCalibration.h.

Referenced by refresh(), setupClear(), and setupRoot().

unsigned int WalkCalibration::stopTime [protected]
 

the time recording stopped

Definition at line 97 of file WalkCalibration.h.

Referenced by addSample(), and processEvent().


The documentation for this class was generated from the following files:

Tekkotsu v2.2.2
Generated Tue Jan 4 15:45:35 2005 by Doxygen 1.4.0