Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
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)
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

 ROOT
 indicates the root menu is currently displayed (save/load data sets...)
 CHOOSE
 indicates the sample type selection is displayed
 READY
 waiting for user to indicate 0 point
 MOVING
 recording, waiting for the motion stop event
 READING_1
 waiting for user to supply the first measurement coordinate
 READING_2
 waiting for user to supply the second measurement coordinate
 CLEAR
 clear data confirmation menu
 fs
 forward-sideways
 fr
 forward-rotate
 sr
 sideways-rotate
 br
 backward-rotate
 bs
 backward-sideways
 r
 pure rotation
 NUM_SRC
 number of data 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, 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 the currently selected type of data being recorded
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]

Enumerator:
ROOT  indicates the root menu is currently displayed (save/load data sets...)
CHOOSE  indicates the sample type selection is displayed
READY  waiting for user to indicate 0 point
MOVING  recording, waiting for the motion stop event
READING_1  waiting for user to supply the first measurement coordinate
READING_2  waiting for user to supply the second measurement coordinate
CLEAR  clear data confirmation menu

Definition at line 46 of file WalkCalibration.h.

enum WalkCalibration::dataSource [protected]

allows representation of the current sample type

Enumerator:
fs  forward-sideways
fr  forward-rotate
sr  sideways-rotate
br  backward-rotate
bs  backward-sideways
r  pure rotation
NUM_SRC  number of data types

Definition at line 57 of file WalkCalibration.h.


Member Function Documentation

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 218 of file WalkCalibration.cc.

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 301 of file WalkCalibration.cc.


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

Tekkotsu v3.0
Generated Fri May 11 20:08:57 2007 by Doxygen 1.4.7