Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

MapBuilder Class Reference

#include <MapBuilder.h>

Inheritance diagram for MapBuilder:

List of all members.


Detailed Description

Definition at line 30 of file MapBuilder.h.


Public Types

typedef unsigned int MapBuilderVerbosity_t

Public Member Functions

 MapBuilder ()
 Constructor.
virtual ~MapBuilder ()
 Destructor.
virtual void DoStart ()
virtual void DoStop ()
virtual std::string getDescription () const
void printShS (ShapeSpace &) const
unsigned int executeRequest (const MapBuilderRequest &, unsigned int *req_id=NULL)
virtual void processEvent (const EventBase &)
void processImage (const LookoutSketchEvent &)
std::vector< ShapeRootgetShapes (const ShapeSpace &ShS, int minConf=2) const
void importLocalToWorld ()
ShapeRoot importWorldToLocal (const ShapeRoot &worldShape)
template<class T>
Shape< T > importWorldToLocal (const Shape< T > &worldShape)
const Shape< AgentData > & getAgent () const
 utility functions which may be used by MapBuilderRequest's exit condition and others
void setAgent (const Point &worldLocation, const AngTwoPi worldHeading)
 utility functions which may be used by MapBuilderRequest's exit condition and others
void moveAgent (coordinate_t const local_dx, coordinate_t const local_dy, AngTwoPi dtheta)
 utility functions which may be used by MapBuilderRequest's exit condition and others

Static Public Member Functions

static void setRetain (bool r)
 Control whether static structures (mapbuilder, sketchGUI sockets, etc.) are retained.
static bool isRetained ()
static void setVerbosity (MapBuilderVerbosity_t v)
static bool isPointVisible (const Point &pt, const NEWMAT::Matrix &baseToCam, float maxDistanceSq)
static bool isLineVisible (const LineData &ln, const NEWMAT::Matrix &baseToCam)
static bool isShapeVisible (const ShapeRoot &ground_shape, const NEWMAT::Matrix &baseToCam, float maxDistanceSq)

Static Public Attributes

static const MapBuilderVerbosity_t MBVstart = 1<<0
static const MapBuilderVerbosity_t MBVevents = 1<<1
static const MapBuilderVerbosity_t MBVexecute = 1<<2
static const MapBuilderVerbosity_t MBVcomplete = 1<<3
static const MapBuilderVerbosity_t MBVdefineGazePoints = 1<<4
static const MapBuilderVerbosity_t MBVnextGazePoint = 1<<5
static const MapBuilderVerbosity_t MBVshapeSearch = 1<<6
static const MapBuilderVerbosity_t MBVshapesFound = 1<<7
static const MapBuilderVerbosity_t MBVgroundPlane = 1<<8
static const MapBuilderVerbosity_t MBVprojectionFailed = 1<<9
static const MapBuilderVerbosity_t MBVimportShapes = 1<<10
static const MapBuilderVerbosity_t MBVnotAdmissible = 1<<11
static const MapBuilderVerbosity_t MBVshapeMatch = 1<<12
static const MapBuilderVerbosity_t MBVshapesMerge = 1<<13
static const MapBuilderVerbosity_t MBVshouldSee = 1<<14
static const MapBuilderVerbosity_t MBVdeleteShape = 1<<15
static const MapBuilderVerbosity_t MBVsetAgent = 1<<16
static const MapBuilderVerbosity_t MBVbadGazePoint = 1<<17

Protected Member Functions

void executeRequest ()
 Triggers action to execute the request at the front of the queue.
bool requestExitTest ()
 calls exitTest of current request if there is one and returns the result
void requestComplete ()
 posts completion event and deletes current request, executes next request if there is one
void defineGazePts ()
 define gazePts either virtually or by scan
void extendLocal (const NEWMAT::Matrix &baseToCam)
void extendWorld (const NEWMAT::Matrix &baseToCam)
void removeNoise (ShapeSpace &, const NEWMAT::Matrix &baseToCam)
 decrement confidence of shapes which should have been seen according to the baseToCam matrix
void removeGazePts (std::vector< Point > &, const NEWMAT::Matrix &baseToCam)
 erase gaze points which should have been seen according to the baseToCam matrix
bool determineNextGazePoint ()
 Returns true if it has set up a valid next gaze point in nextGazePoint.
bool determineNextGazePoint (const std::vector< ShapeRoot > &)
 Returns true if there is a shape which needs be looked at again and is reachable; sets it up as nextGazePoint.
bool determineNextGazePoint (std::vector< Point > &gazePts)
void moveToNextGazePoint (const bool manualOverride=false)
 Starts robot moving to the next gaze point.
void doNextSearch ()
void doNextSearch2 ()
bool isBadGazePoint (const Point &) const
void projectToGround (const NEWMAT::Matrix &camToBase)
void filterGroundShapes (const NEWMAT::Matrix &baseToCam)
void calculateGroundPlane ()
Shape extraction functions
void getCameraShapes (const Sketch< uchar > &camFrame)
std::vector< Shape< LineData > > getCamLines (const Sketch< uchar > &, const std::set< color_index > &objectColors, const std::set< color_index > &occluderColors) const
std::vector< Shape< EllipseData > > getCamEllipses (const Sketch< uchar > &, const std::set< color_index > &objectColors, const std::set< color_index > &occluderColors) const
std::vector< Shape< PolygonData > > getCamPolygons (const Sketch< uchar > &, const std::set< color_index > &objectColors, const std::set< color_index > &occluderColors) const
std::vector< Shape< LineData > > getCamWalls (const Sketch< uchar > &, unsigned int) const
std::vector< Shape< SphereData > > getCamSpheres (const Sketch< uchar > &, const std::set< color_index > &objectColors, const std::set< color_index > &occluderColors) const
void getCamBlobs (const Sketch< uchar > &camFrame, const std::set< color_index > &colors, const std::map< color_index, int > &minBlobAreas, const std::map< color_index, BlobData::BlobOrientation_t > &blobOrientations, const std::map< color_index, coordinate_t > &assumedBlobHeights)
void getCamBlobs ()
std::vector< Shape< TargetData > > getCamTargets (const Sketch< uchar > &camFrame, const std::set< color_index > &objectColors, const std::set< color_index > &occluderColors) const
Functions to make requests to the Lookout
void storeImage ()
void storeImage (const Point &pt, bool havepoint=true)
void grabCameraImageAndGo ()
void scanForGazePts ()

Static Protected Member Functions

static void matchSrcToDst (ShapeSpace &src, ShapeSpace &dst, std::set< color_index > polygonEdgeColors=std::set< color_index >(), bool mergeSrc=true, bool mergeDst=true)

Protected Attributes

SketchSpacecamSkS
ShapeSpacecamShS
ShapeSpacegroundShS
SketchSpacelocalSkS
ShapeSpacelocalShS
SketchSpaceworldSkS
ShapeSpaceworldShS
const int xres
const int yres
 width and height of camera frame
NEWMAT::ColumnVector ground_plane
 ground plane to which shapes are projected
Shape< AgentData > & theAgent
std::vector< PointbadGazePoints
 gaze points for which HeadPointerMC.lookAtPoint() returned false
std::queue< MapBuilderRequest * > requests
MapBuilderRequestcurReq
unsigned int idCounter
float maxDistSq
 square of current request's max distance parameter
unsigned int pointAtID
unsigned int scanID
 ID's for lookout requests.
Point nextGazePoint
Transformation matrices between local and world frames
NEWMAT::Matrix localToWorldMatrix
NEWMAT::Matrix worldToLocalTranslateMatrix
NEWMAT::Matrix worldToLocalRotateMatrix

Static Protected Attributes

static bool retain = true
 if true, VRmixin::stopCrew will not clear MapBuilder structures

Private Member Functions

 MapBuilder (const MapBuilder &)
 never call this
MapBuilderoperator= (const MapBuilder &)
 never call this

Static Private Attributes

static MapBuilderVerbosity_t verbosity = -1U

Friends

class Lookout

Member Typedef Documentation

typedef unsigned int MapBuilderVerbosity_t

Definition at line 50 of file MapBuilder.h.


Constructor & Destructor Documentation

MapBuilder (  ) 

Constructor.

Definition at line 39 of file MapBuilder.cc.

virtual ~MapBuilder (  )  [inline, virtual]

Destructor.

Definition at line 102 of file MapBuilder.h.

MapBuilder ( const MapBuilder  )  [private]

never call this


Member Function Documentation

static void setRetain ( bool  r  )  [inline, static]

Control whether static structures (mapbuilder, sketchGUI sockets, etc.) are retained.

Definition at line 47 of file MapBuilder.h.

static bool isRetained (  )  [inline, static]

Definition at line 48 of file MapBuilder.h.

Referenced by VRmixin::VRmixin(), and VRmixin::~VRmixin().

static void setVerbosity ( MapBuilderVerbosity_t  v  )  [inline, static]

Definition at line 73 of file MapBuilder.h.

void executeRequest (  )  [protected]

bool requestExitTest (  )  [protected]

calls exitTest of current request if there is one and returns the result

Definition at line 399 of file MapBuilder.cc.

Referenced by MapBuilder::processEvent().

void requestComplete (  )  [protected]

posts completion event and deletes current request, executes next request if there is one

Definition at line 406 of file MapBuilder.cc.

Referenced by MapBuilder::defineGazePts(), MapBuilder::executeRequest(), MapBuilder::grabCameraImageAndGo(), and MapBuilder::processEvent().

void DoStart (  )  [virtual]

Definition at line 56 of file MapBuilder.cc.

Referenced by VRmixin::startCrew().

void DoStop (  )  [virtual]

Definition at line 82 of file MapBuilder.cc.

Referenced by VRmixin::stopCrew().

virtual std::string getDescription (  )  const [inline, virtual]

Definition at line 105 of file MapBuilder.h.

void printShS ( ShapeSpace ShS  )  const

Definition at line 836 of file MapBuilder.cc.

unsigned int executeRequest ( const MapBuilderRequest req,
unsigned int *  req_id = NULL 
)

Definition at line 92 of file MapBuilder.cc.

void processEvent ( const EventBase &  e  )  [virtual]

Definition at line 166 of file MapBuilder.cc.

void processImage ( const LookoutSketchEvent &  e  ) 

Definition at line 207 of file MapBuilder.cc.

Referenced by MapBuilder::grabCameraImageAndGo(), and MapBuilder::processEvent().

bool isPointVisible ( const Point pt,
const NEWMAT::Matrix &  baseToCam,
float  maxDistanceSq 
) [static]

Definition at line 474 of file MapBuilder.cc.

Referenced by MapBuilder::isShapeVisible(), and MapBuilder::removeGazePts().

bool isLineVisible ( const LineData ln,
const NEWMAT::Matrix &  baseToCam 
) [static]

Definition at line 484 of file MapBuilder.cc.

Referenced by MapBuilder::isShapeVisible(), and MapBuilder::removeNoise().

bool isShapeVisible ( const ShapeRoot ground_shape,
const NEWMAT::Matrix &  baseToCam,
float  maxDistanceSq 
) [static]

Definition at line 516 of file MapBuilder.cc.

Referenced by MapBuilder::removeNoise().

const Shape<AgentData>& getAgent (  )  const [inline]

utility functions which may be used by MapBuilderRequest's exit condition and others

Definition at line 120 of file MapBuilder.h.

void setAgent ( const Point worldLocation,
const AngTwoPi  worldHeading 
)

utility functions which may be used by MapBuilderRequest's exit condition and others

Definition at line 420 of file MapBuilder.cc.

Referenced by Pilot::CreepToShape::DoStart(), MapBuilder::DoStart(), MapBuilder::moveAgent(), PFShapeSLAM::setAgent(), and PFShapeLocalization::setAgent().

void moveAgent ( coordinate_t const   local_dx,
coordinate_t const   local_dy,
AngTwoPi  dtheta 
)

utility functions which may be used by MapBuilderRequest's exit condition and others

Definition at line 448 of file MapBuilder.cc.

Referenced by Pilot::CreepToShape::DoStart().

std::vector<ShapeRoot> getShapes ( const ShapeSpace ShS,
int  minConf = 2 
) const [inline]

Definition at line 129 of file MapBuilder.h.

void importLocalToWorld (  ) 

Definition at line 459 of file MapBuilder.cc.

ShapeRoot importWorldToLocal ( const ShapeRoot worldShape  ) 

Definition at line 467 of file MapBuilder.cc.

Shape< T > importWorldToLocal ( const Shape< T > &  worldShape  )  [inline]

Definition at line 229 of file MapBuilder.h.

void getCameraShapes ( const Sketch< uchar > &  camFrame  )  [protected]

Definition at line 864 of file MapBuilder.cc.

Referenced by MapBuilder::processImage().

vector< Shape< LineData > > getCamLines ( const Sketch< uchar > &  camFrame,
const std::set< color_index > &  objectColors,
const std::set< color_index > &  occluderColors 
) const [protected]

Definition at line 878 of file MapBuilder.cc.

Referenced by MapBuilder::getCameraShapes().

vector< Shape< EllipseData > > getCamEllipses ( const Sketch< uchar > &  camFrame,
const std::set< color_index > &  objectColors,
const std::set< color_index > &  occluderColors 
) const [protected]

Definition at line 906 of file MapBuilder.cc.

Referenced by MapBuilder::getCameraShapes().

vector< Shape< PolygonData > > getCamPolygons ( const Sketch< uchar > &  camFrame,
const std::set< color_index > &  objectColors,
const std::set< color_index > &  occluderColors 
) const [protected]

Definition at line 926 of file MapBuilder.cc.

Referenced by MapBuilder::getCameraShapes().

vector< Shape< LineData > > getCamWalls ( const Sketch< uchar > &  camFrame,
unsigned int  floorColor 
) const [protected]

Definition at line 973 of file MapBuilder.cc.

Referenced by MapBuilder::getCameraShapes().

vector< Shape< SphereData > > getCamSpheres ( const Sketch< uchar > &  camFrame,
const std::set< color_index > &  objectColors,
const std::set< color_index > &  occluderColors 
) const [protected]

Definition at line 954 of file MapBuilder.cc.

Referenced by MapBuilder::getCameraShapes().

void getCamBlobs ( const Sketch< uchar > &  camFrame,
const std::set< color_index > &  colors,
const std::map< color_index, int > &  minBlobAreas,
const std::map< color_index, BlobData::BlobOrientation_t > &  blobOrientations,
const std::map< color_index, coordinate_t > &  assumedBlobHeights 
) [protected]

Definition at line 1017 of file MapBuilder.cc.

void getCamBlobs (  )  [protected]

Definition at line 1032 of file MapBuilder.cc.

Referenced by MapBuilder::getCameraShapes().

vector< Shape< TargetData > > getCamTargets ( const Sketch< uchar > &  camFrame,
const std::set< color_index > &  objectColors,
const std::set< color_index > &  occluderColors 
) const [protected]

Definition at line 1053 of file MapBuilder.cc.

Referenced by MapBuilder::getCameraShapes().

void matchSrcToDst ( ShapeSpace src,
ShapeSpace dst,
std::set< color_index >  polygonEdgeColors = std::set<color_index>(),
bool  mergeSrc = true,
bool  mergeDst = true 
) [static, protected]

void storeImage (  )  [inline, protected]

Definition at line 188 of file MapBuilder.h.

Referenced by MapBuilder::executeRequest(), and MapBuilder::moveToNextGazePoint().

void storeImage ( const Point pt,
bool  havepoint = true 
) [protected]

Definition at line 336 of file MapBuilder.cc.

void grabCameraImageAndGo (  )  [protected]

Definition at line 348 of file MapBuilder.cc.

Referenced by MapBuilder::executeRequest().

void scanForGazePts (  )  [protected]

Definition at line 367 of file MapBuilder.cc.

Referenced by MapBuilder::defineGazePts().

void defineGazePts (  )  [protected]

define gazePts either virtually or by scan

Definition at line 768 of file MapBuilder.cc.

Referenced by MapBuilder::executeRequest().

void extendLocal ( const NEWMAT::Matrix &  baseToCam  )  [protected]

Definition at line 381 of file MapBuilder.cc.

Referenced by MapBuilder::processImage().

void extendWorld ( const NEWMAT::Matrix &  baseToCam  )  [protected]

Definition at line 389 of file MapBuilder.cc.

Referenced by MapBuilder::processImage().

void removeNoise ( ShapeSpace ShS,
const NEWMAT::Matrix &  baseToCam 
) [protected]

decrement confidence of shapes which should have been seen according to the baseToCam matrix

Definition at line 723 of file MapBuilder.cc.

Referenced by MapBuilder::extendLocal(), and MapBuilder::extendWorld().

void removeGazePts ( std::vector< Point > &  gazePts,
const NEWMAT::Matrix &  baseToCam 
) [protected]

erase gaze points which should have been seen according to the baseToCam matrix

Definition at line 816 of file MapBuilder.cc.

Referenced by MapBuilder::extendLocal(), and MapBuilder::extendWorld().

bool determineNextGazePoint (  )  [protected]

Returns true if it has set up a valid next gaze point in nextGazePoint.

Definition at line 236 of file MapBuilder.cc.

Referenced by MapBuilder::executeRequest(), and MapBuilder::processEvent().

bool determineNextGazePoint ( const std::vector< ShapeRoot > &  shapes  )  [protected]

Returns true if there is a shape which needs be looked at again and is reachable; sets it up as nextGazePoint.

Definition at line 249 of file MapBuilder.cc.

bool determineNextGazePoint ( std::vector< Point > &  gazePts  )  [protected]

Definition at line 297 of file MapBuilder.cc.

void moveToNextGazePoint ( const bool  manualOverride = false  )  [protected]

Starts robot moving to the next gaze point.

Definition at line 308 of file MapBuilder.cc.

Referenced by MapBuilder::executeRequest(), and MapBuilder::processEvent().

void doNextSearch (  )  [protected]

Definition at line 324 of file MapBuilder.cc.

Referenced by MapBuilder::executeRequest(), and MapBuilder::processEvent().

void doNextSearch2 (  )  [protected]

bool isBadGazePoint ( const Point Pt  )  const [protected]

Definition at line 330 of file MapBuilder.cc.

Referenced by MapBuilder::determineNextGazePoint().

void projectToGround ( const NEWMAT::Matrix &  camToBase  )  [protected]

Definition at line 624 of file MapBuilder.cc.

Referenced by MapBuilder::processImage().

void filterGroundShapes ( const NEWMAT::Matrix &  baseToCam  )  [protected]

Definition at line 536 of file MapBuilder.cc.

Referenced by MapBuilder::processImage().

void calculateGroundPlane (  )  [protected]

Definition at line 604 of file MapBuilder.cc.

Referenced by MapBuilder::executeRequest().

MapBuilder& operator= ( const MapBuilder  )  [private]

never call this


Friends And Related Function Documentation

friend class Lookout [friend]

Definition at line 76 of file MapBuilder.h.


Member Data Documentation

SketchSpace& camSkS [protected]

Definition at line 32 of file MapBuilder.h.

Referenced by MapBuilder::DoStart(), and MapBuilder::processImage().

ShapeSpace& camShS [protected]

SketchSpace& localSkS [protected]

Definition at line 34 of file MapBuilder.h.

Referenced by MapBuilder::DoStart(), and MapBuilder::executeRequest().

SketchSpace& worldSkS [protected]

Definition at line 36 of file MapBuilder.h.

Referenced by MapBuilder::DoStart(), and MapBuilder::executeRequest().

const int xres [protected]

Definition at line 39 of file MapBuilder.h.

Referenced by MapBuilder::getCamWalls().

const int yres [protected]

width and height of camera frame

Definition at line 39 of file MapBuilder.h.

Referenced by MapBuilder::getCamWalls().

NEWMAT::ColumnVector ground_plane [protected]

ground plane to which shapes are projected

Definition at line 41 of file MapBuilder.h.

Referenced by MapBuilder::calculateGroundPlane(), and MapBuilder::projectToGround().

bool retain = true [static, protected]

if true, VRmixin::stopCrew will not clear MapBuilder structures

Definition at line 43 of file MapBuilder.h.

Referenced by MapBuilder::isRetained(), and MapBuilder::setRetain().

const MapBuilderVerbosity_t MBVstart = 1<<0 [static]

Definition at line 51 of file MapBuilder.h.

Referenced by MapBuilder::DoStart().

const MapBuilderVerbosity_t MBVevents = 1<<1 [static]

Definition at line 52 of file MapBuilder.h.

Referenced by MapBuilder::processEvent().

const MapBuilderVerbosity_t MBVexecute = 1<<2 [static]

Definition at line 53 of file MapBuilder.h.

Referenced by MapBuilder::executeRequest().

const MapBuilderVerbosity_t MBVcomplete = 1<<3 [static]

Definition at line 54 of file MapBuilder.h.

Referenced by MapBuilder::requestComplete().

Definition at line 55 of file MapBuilder.h.

const MapBuilderVerbosity_t MBVnextGazePoint = 1<<5 [static]

Definition at line 56 of file MapBuilder.h.

Referenced by MapBuilder::moveToNextGazePoint().

const MapBuilderVerbosity_t MBVgroundPlane = 1<<8 [static]

Definition at line 59 of file MapBuilder.h.

Referenced by MapBuilder::calculateGroundPlane().

Definition at line 60 of file MapBuilder.h.

Referenced by MapBuilder::filterGroundShapes().

const MapBuilderVerbosity_t MBVimportShapes = 1<<10 [static]

Definition at line 61 of file MapBuilder.h.

Referenced by MapBuilder::matchSrcToDst().

const MapBuilderVerbosity_t MBVnotAdmissible = 1<<11 [static]

Definition at line 62 of file MapBuilder.h.

Referenced by MapBuilder::filterGroundShapes(), and MapBuilder::matchSrcToDst().

const MapBuilderVerbosity_t MBVshapeMatch = 1<<12 [static]

Definition at line 63 of file MapBuilder.h.

Referenced by MapBuilder::matchSrcToDst().

const MapBuilderVerbosity_t MBVshapesMerge = 1<<13 [static]

Definition at line 64 of file MapBuilder.h.

Referenced by MapBuilder::matchSrcToDst().

const MapBuilderVerbosity_t MBVshouldSee = 1<<14 [static]

Definition at line 65 of file MapBuilder.h.

Referenced by MapBuilder::removeNoise().

const MapBuilderVerbosity_t MBVdeleteShape = 1<<15 [static]

Definition at line 66 of file MapBuilder.h.

Referenced by MapBuilder::removeNoise().

const MapBuilderVerbosity_t MBVsetAgent = 1<<16 [static]

Definition at line 67 of file MapBuilder.h.

Referenced by MapBuilder::setAgent().

const MapBuilderVerbosity_t MBVbadGazePoint = 1<<17 [static]

Definition at line 68 of file MapBuilder.h.

Referenced by MapBuilder::determineNextGazePoint().

Shape<AgentData>& theAgent [protected]

Agent in the world frame

Definition at line 78 of file MapBuilder.h.

Referenced by MapBuilder::getAgent(), MapBuilder::moveAgent(), and MapBuilder::setAgent().

std::vector<Point> badGazePoints [protected]

gaze points for which HeadPointerMC.lookAtPoint() returned false

Definition at line 84 of file MapBuilder.h.

Referenced by MapBuilder::determineNextGazePoint(), MapBuilder::DoStart(), and MapBuilder::filterGroundShapes().

std::queue<MapBuilderRequest*> requests [protected]

unsigned int idCounter [protected]

Definition at line 88 of file MapBuilder.h.

Referenced by MapBuilder::executeRequest().

float maxDistSq [protected]

square of current request's max distance parameter

Definition at line 90 of file MapBuilder.h.

Referenced by MapBuilder::executeRequest(), MapBuilder::filterGroundShapes(), MapBuilder::isBadGazePoint(), MapBuilder::removeGazePts(), and MapBuilder::removeNoise().

unsigned int scanID [protected]

ID's for lookout requests.

Definition at line 91 of file MapBuilder.h.

Referenced by MapBuilder::processEvent(), and MapBuilder::scanForGazePts().


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

DualCoding 4.0
Generated Thu Nov 22 00:53:58 2007 by Doxygen 1.5.4