Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

DualCoding::Lookout Class Reference

The Lookout accepts LookoutRequests to move the head and collect sensor information. More...

#include <Lookout.h>

Inheritance diagram for DualCoding::Lookout:

Detailed Description

The Lookout accepts LookoutRequests to move the head and collect sensor information.

HeadMotionType can be none (user will point the head himself), pointAt, scan, track, or search. The data collected can be an image or distance reading, or for scan operations, it can be a list of locations where certain VisionObject or VisionRegion streams reported hits.

Definition at line 26 of file Lookout.h.

List of all members.

Public Member Functions

 Lookout ()
 Constructor.
virtual void doStart ()
 Delegate function for subclasses to be notified when the behavior starts up.
virtual void doStop ()
 Delegate function for subclasses to be notified when the behavior starts up.
virtual void doEvent ()
 Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event.
virtual std::string getDescription () const
 Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis).
unsigned int executeRequest (const LookoutRequestBase &)
unsigned int executeRequest (BehaviorBase *requestingBehavior, const LookoutRequestBase &req)
bool busy ()
void stopTrack ()
void moveHeadToPoint ()
void relax ()
 Inactivates all Lookout motion commands; called when MapBuilder finishes.

Static Public Member Functions

static std::string getClassDescription ()
 Gives a short description of what this class of behaviors does... you should override this (but don't have to).
static Shape< PolygonData > groundSearchPoints ()
 returns a polygon with points for searching the ground around the robot
static Point findLocationFor (const float normX, const float normY)

Static Public Attributes

static const unsigned int invalid_LO_ID = (unsigned int)-1

Protected Types

enum  TrackerStates {
  inactive, moveToAcquire, tracking, searching,
  centering, lost
}
enum  LookoutTimerSourceId_t { settle_timer = 1, sample_timer, lost_timer, scan_timer }

Protected Member Functions

virtual void executeRequest ()
virtual void requestComplete (bool result=true)
template<class T >
void pushRequest (const LookoutRequestBase &req)

void processPointAtEvent (const EventBase &event)
bool findPixelModes ()

void setupTrack ()
void processTrackEvent (const EventBase &event)

Protected Attributes

std::vector< std::map< uchar,
unsigned int > > 
pixelHistograms
std::priority_queue< floatdistanceSamples
MC_ID pointer_id
 id for HeadPointerMC for pointing the camera
MC_ID posture_id
 id for PostureMC for pointing the IR sensors
MC_ID sequence_id
 id for MotionSequenceMC for scanning
std::queue< LookoutRequestBase * > requests
 queue of pending LookoutRequestBase instances, including the current request
LookoutRequestBasecurReq
 pointer to request currently being executed
LookoutPointRequestcurPAR
 current Point-At request (same object as curReq)
bool successSave
enum
DualCoding::Lookout::TrackerStates 
trackerState

Private Member Functions

Lookoutoperator= (const Lookout &)
 Lookout (const Lookout &)

Private Attributes

unsigned int idCounter



void setupScan ()
void triggerScanMotionSequence ()
void processScanEvent (const EventBase &event)
void scanAlongLine (const Point &start, const Point &end)
void scanAlongPolygon (const std::vector< Point > &vertices, const bool closed=false)
void scanArea (const Point &topLeft, const Point &topRight, const Point &bottomLeft, const Point &bottomRight)
void storeVisionRegionDataTo (std::vector< Point > &, const std::set< color_index > &, int)
static Point findLocationFor (const VisionObjectEvent &visev)
static Point findLocationFor (const CMVision::region *reg)



void setupSearch ()
void processSearchEvent (const EventBase &event)
void triggerSearchMotionSequence ()
static void searchAt (HeadPointerMC &hpmc_temp, std::vector< float > &jointvals, const Point &target)

Member Enumeration Documentation

Enumerator:
settle_timer 
sample_timer 
lost_timer 
scan_timer 

Definition at line 143 of file Lookout.h.

Enumerator:
inactive 
moveToAcquire 
tracking 
searching 
centering 
lost 

Definition at line 134 of file Lookout.h.


Constructor & Destructor Documentation

DualCoding::Lookout::Lookout (  ) 

Constructor.

Definition at line 31 of file Lookout.cc.

DualCoding::Lookout::Lookout ( const Lookout  )  [private]

Member Function Documentation

bool DualCoding::Lookout::busy (  ) 

Definition at line 40 of file Lookout.h.

void DualCoding::Lookout::doEvent (  )  [virtual]

Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event.

Default implementation watches for 'private' text message events (those forwarded by a BehaviorSwitchControl from ControllerGUI input) and will publically rebroadcast them. The idea is that your own processEvent gets first dibs, but if the behavior doesn't handle the text message, it will be handed off for others.

Reimplemented from BehaviorBase.

Definition at line 235 of file Lookout.cc.

void DualCoding::Lookout::doStart (  )  [virtual]

Delegate function for subclasses to be notified when the behavior starts up.

Should be overridden by subclasses to subscribe to events, install motion commands, etc.

doStart() is basically a hook to allow subclasses to jump in and do some customization of behavior parameters while the behavior is starting. If you are writing a behavior class and do not expect further derivation, just override doStart() yourself. However, if you do expect further derivation of your class, consider using preStart() or postStart() instead, and leave doStart() for the 'leaf' classes.

Reimplemented from BehaviorBase.

Definition at line 42 of file Lookout.cc.

void DualCoding::Lookout::doStop (  )  [virtual]

Delegate function for subclasses to be notified when the behavior starts up.

May be overridden to cleanup when the behavior is shutting down. However events will automatically be unsubscribed, and by using addMotion(), motions will automatically be removed by stop(), so you may not need any cleanup.

Reimplemented from BehaviorBase.

Definition at line 58 of file Lookout.cc.

void DualCoding::Lookout::executeRequest (  )  [protected, virtual]

Definition at line 144 of file Lookout.cc.

Referenced by executeRequest(), and requestComplete().

unsigned int DualCoding::Lookout::executeRequest ( BehaviorBase requestingBehavior,
const LookoutRequestBase req 
)

Definition at line 113 of file Lookout.cc.

unsigned int DualCoding::Lookout::executeRequest ( const LookoutRequestBase req  ) 

Definition at line 120 of file Lookout.cc.

Point DualCoding::Lookout::findLocationFor ( const CMVision::region reg  )  [static, protected]

Definition at line 458 of file Lookout.cc.

static Point DualCoding::Lookout::findLocationFor ( const VisionObjectEvent visev  )  [static, protected]

Definition at line 83 of file Lookout.h.

Point DualCoding::Lookout::findLocationFor ( const float  normX,
const float  normY 
) [static]
bool DualCoding::Lookout::findPixelModes (  )  [protected]

Definition at line 327 of file Lookout.cc.

Referenced by processPointAtEvent().

static std::string DualCoding::Lookout::getClassDescription (  )  [static]

Gives a short description of what this class of behaviors does... you should override this (but don't have to).

If you do override this, also consider overriding getDescription() to return it

Reimplemented from BehaviorBase.

Definition at line 35 of file Lookout.h.

Referenced by getDescription().

virtual std::string DualCoding::Lookout::getDescription (  )  const [virtual]

Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis).

By default simply returns getName(), because any calls from a BehaviorBase function to getClassDescription() are going to call BehaviorBase::getClassDescription(), not ~YourSubClass~getClassDescription(), because static functions can't be virtual in C++ (doh!)

This means that getDescription called on a pointer to a BehaviorBase of unknown subtype would always return an empty string, which is pretty useless. So instead we return the name in this situation. If you want getDescription to return getClassDescription, you'll have to override it in your subclass to do so.

Reimplemented from BehaviorBase.

Definition at line 36 of file Lookout.h.

Shape< PolygonData > DualCoding::Lookout::groundSearchPoints (  )  [static]

returns a polygon with points for searching the ground around the robot

Definition at line 75 of file Lookout.cc.

void DualCoding::Lookout::moveHeadToPoint (  ) 

Definition at line 198 of file Lookout.cc.

Referenced by executeRequest().

Lookout& DualCoding::Lookout::operator= ( const Lookout  )  [private]
void DualCoding::Lookout::processPointAtEvent ( const EventBase event  )  [protected]

Definition at line 268 of file Lookout.cc.

Referenced by doEvent().

void DualCoding::Lookout::processScanEvent ( const EventBase event  )  [protected]

Definition at line 492 of file Lookout.cc.

Referenced by doEvent().

void DualCoding::Lookout::processSearchEvent ( const EventBase event  )  [protected]

Definition at line 912 of file Lookout.cc.

Referenced by doEvent().

void DualCoding::Lookout::processTrackEvent ( const EventBase event  )  [protected]

Definition at line 713 of file Lookout.cc.

Referenced by doEvent().

template<class T >
void DualCoding::Lookout::pushRequest ( const LookoutRequestBase req  )  [protected]

Definition at line 58 of file Lookout.h.

void DualCoding::Lookout::relax (  ) 

Inactivates all Lookout motion commands; called when MapBuilder finishes.

Definition at line 192 of file Lookout.cc.

void DualCoding::Lookout::requestComplete ( bool  result = true  )  [protected, virtual]
void DualCoding::Lookout::scanAlongLine ( const Point &  start,
const Point &  end 
) [protected]

Definition at line 603 of file Lookout.cc.

Referenced by setupScan().

void DualCoding::Lookout::scanAlongPolygon ( const std::vector< Point > &  vertices,
const bool  closed = false 
) [protected]

Definition at line 644 of file Lookout.cc.

Referenced by setupScan().

void DualCoding::Lookout::scanArea ( const Point &  topLeft,
const Point &  topRight,
const Point &  bottomLeft,
const Point &  bottomRight 
) [protected]
void DualCoding::Lookout::searchAt ( HeadPointerMC hpmc_temp,
std::vector< float > &  jointvals,
const Point &  target 
) [static, protected]

Definition at line 1022 of file Lookout.cc.

Referenced by triggerSearchMotionSequence().

void DualCoding::Lookout::setupScan (  )  [protected]

Definition at line 558 of file Lookout.cc.

Referenced by executeRequest().

void DualCoding::Lookout::setupSearch (  )  [protected]

Definition at line 896 of file Lookout.cc.

Referenced by executeRequest().

void DualCoding::Lookout::setupTrack (  )  [protected]

Definition at line 691 of file Lookout.cc.

Referenced by executeRequest().

void DualCoding::Lookout::stopTrack (  ) 

Definition at line 763 of file Lookout.cc.

Referenced by processTrackEvent().

void DualCoding::Lookout::storeVisionRegionDataTo ( std::vector< Point > &  data,
const std::set< color_index > &  colors,
int  minArea 
) [protected]

Definition at line 465 of file Lookout.cc.

Referenced by processScanEvent().

void DualCoding::Lookout::triggerScanMotionSequence (  )  [protected]

Definition at line 582 of file Lookout.cc.

Referenced by processScanEvent().

void DualCoding::Lookout::triggerSearchMotionSequence (  )  [protected]

Definition at line 986 of file Lookout.cc.

Referenced by processSearchEvent().


Member Data Documentation

current Point-At request (same object as curReq)

Definition at line 131 of file Lookout.h.

Referenced by doStop(), executeRequest(), findPixelModes(), moveHeadToPoint(), processPointAtEvent(), and requestComplete().

std::priority_queue<float> DualCoding::Lookout::distanceSamples [protected]

Definition at line 124 of file Lookout.h.

Referenced by executeRequest().

unsigned int DualCoding::Lookout::idCounter [private]

Definition at line 118 of file Lookout.h.

Referenced by executeRequest().

const unsigned int DualCoding::Lookout::invalid_LO_ID = (unsigned int)-1 [static]

Definition at line 51 of file Lookout.h.

std::vector<std::map<uchar,unsigned int> > DualCoding::Lookout::pixelHistograms [protected]

Definition at line 123 of file Lookout.h.

Referenced by executeRequest(), and findPixelModes().

queue of pending LookoutRequestBase instances, including the current request

Definition at line 129 of file Lookout.h.

Referenced by doStop(), executeRequest(), pushRequest(), and requestComplete().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:20 2016 by Doxygen 1.6.3