AURobotServers  4
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
UResAuEf Class Reference

#include <uresauef.h>

Inheritance diagram for UResAuEf:
Inheritance graph

Public Member Functions

int findFeatures (ULaserData *ldata)
 
UTime getLastUpdateTime ()
 get the last time the wall lines were updated More...
 
bool initializeWalls ()
 Initialize the wall estimate Use the longest seen line as a starting point and define other lines from this, setting unseed walls as close as possible. More...
 
bool isLogOpen ()
 ask if logfile is open More...
 
void openLog (bool close)
 open or close fixed logfile More...
 
virtual const char * print (const char *preString, char *buff, int buffCnt)
 
int updateWalls (UPose newPose)
 update the estimate of walls, assuming the room is rectangular. The result is in the wall[0..3] array with 0=north, 1= east, 2=south, and 3=west, assuming initial position is heading east, i.e. heading at an approximately right angle towards the east wall. Updates further a wallValid[0..4] array. The method is to find number of sides that is updated. More...
 
 UResAuEf ()
 
void UResAuEfInit ()
 
void wallReset ()
 Reset wall estimate to no walls. More...
 
virtual ~UResAuEf ()
 
- Public Member Functions inherited from UResVarPool
int addMethod (const char *formalName, const char *paramTypes, const char *comment)
 
int addMethodV (const char *formalName, const char *paramTypes, const char *comment)
 
UVarPooladdStruct (const char *name, const char *comment, bool copy=false)
 
UVariableaddVar (const char *name, const double initialValue, const char *type, const char *comment)
 
UVariableaddVar (const char *name, const char *initialValue, const char *type, const char *comment)
 
UVariableaddVarA (const char *name, const char *initialValue, const char *type, const char *comment)
 
bool callGlobal (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt)
 
bool callGlobalV (const char *name, const char *paramOrder, UVariable **params, UDataBase **returnStruct, int *returnStructCnt)
 Call a method from the root var pool scope It may be in the structure direct (no '.') or in any sub-structure that the 'name.subname' indicate. More...
 
bool callLocal (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt)
 
bool callVS (const char *function, const char *stringParam)
 
int callVSCD (const char *function, const char *strPar, UDataBase *data, int cooSys)
 
void createBaseVar ()
 
virtual bool createVarSpace (const int varCnt, const int structCnt, const int methCnt, const char *note, bool copy=false)
 
bool getGlobalString (const char *name, const char **value)
 
bool getGlobalValue (const char *name, double *value)
 
bool getGlobalValue (const char *name, const char **value)
 
bool getGlobalValue (const char *name, bool *value)
 
bool getGlobalValue (const char *name, UTime *value)
 
bool getLocalValue (const char *name, double *value)
 get a value in this variable tree More...
 
bool getLocalValue (const char *name, bool *value)
 
bool getLocalValue (const char *name, UTime *value)
 
double getLocalValue (int idx)
 
UPosition getLocalValue3D (int idx)
 
UPosRot getLocalValue6D (int idx)
 
bool getLocalValueBool (int idx)
 
int getLocalValueInt (int idx)
 
UTime getLocalValueTime (int idx)
 
const char * getLogFileName ()
 
const char * getVarDescription (int idx)
 
UVarCalcgetVarPool ()
 
virtual bool gotAllResources (char *missingThese, int missingTheseCnt)
 
bool isLogFileOpen ()
 
bool isLogFileOpen (const char *structName)
 
bool isVarPoolUpdated (int lastCnt, int *newCnt)
 
void logFileClose ()
 
bool logFileOpen ()
 
void logFileStart (const char *structName, bool open)
 
virtual bool methodCall (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct=NULL, int *returnStructCnt=NULL)
 
bool setGlobalVar (const char *name, const double value, bool mayAdd)
 Assigns a value to a variable. The variable may be a part of a structure. More...
 
bool setLocalVar (int idx, double value, const int element)
 
bool setLocalVar (const char *name, const double value, bool mayAdd)
 Assigns a value to a variable. The variable may be a part of a structure. More...
 
bool setLocalVar3D (int idx, UPosition *value)
 
bool setLocalVar6D (int idx, UPosRot *value)
 
bool setLocalVarAdd (int idx, double value, const int element)
 
bool setLocalVarPose (int idx, UPose *value)
 
virtual bool setResource (UResBase *resource, bool remove)
 
void setVarPool (UVarCalc *sharedVarPool)
 
int updateQTvars (int structIdx)
 
 UResVarPool ()
 
virtual ~UResVarPool ()
 
- Public Member Functions inherited from UResBase
void createReplayVar (UVarPool *pool)
 
virtual void createResources ()
 
UCmdExegetCorePointer ()
 
char * getLogFileName (char *fn, const int fnCnt)
 
int getResFuncIdx ()
 
const char * getResID ()
 
int getResVersion ()
 
bool isA (const char *idStr)
 
bool isAlsoA (const char *id)
 
virtual void print (const char *preString)
 
virtual void saveSettings ()
 
void setCorePointer (UCmdExe *serverCore)
 
void setResFuncIdx (int idx)
 
virtual void setResID (const char *id, const int version)
 
virtual void stop (bool)
 
virtual void updateReplayStatus ()
 
 UResBase ()
 
virtual ~UResBase ()
 
- Public Member Functions inherited from UReplay
void addChild (UReplay *child)
 
virtual bool decodeReplayLine (char *)
 
char * getLogFileName (char *fn, const int fnCnt)
 
char * getReplayFileName (char *fn, const int fnCnt)
 
int getReplayLogLine ()
 
bool isReplay ()
 
bool isReplayFileOpen ()
 
void removeChild (UReplay *child)
 
virtual void replayAdvanceTime (UTime untilTime)
 
void replaySetBaseFileName (const char *name, const char *preName="")
 
void replaySetFileName (const char *name)
 
virtual bool replayStep ()
 
int replayStep (int steps)
 
virtual bool replayToTime (UTime untilTime)
 
void setParent (UReplay *parent)
 
bool setReplay (bool value)
 
 UReplay ()
 
virtual ~UReplay ()
 
- Public Member Functions inherited from ULock
bool lock ()
 
void lockInit ()
 
void post ()
 
bool tryLock ()
 
bool tryWait ()
 
 ULock ()
 
void unlock ()
 
bool wait ()
 
 ~ULock ()
 
- Public Member Functions inherited from UVarMethodImplement
virtual bool methodCallV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct, int *returnStructCnt)
 
virtual ~UVarMethodImplement ()
 
- Public Member Functions inherited from AUExtractFeatures
 AUExtractFeatures ()
 
void doClusters (double configClusterDiff, double configRangeMin)
 Divide laser scanner data into clusters. More...
 
void doDiscard (int configDiscardDots, double configDiscardSize)
 
void doFindCircles (int configCircleMinDots, double configCircleMSQ, double configCircleMinR, double configCircleMaxR, double configCircleMinCg, double configCircleMaxCg)
 Tries to make circles out of neighbouring line segments. More...
 
void doMerge (double configMergeMSQ)
 Merges segments. More...
 
int doSplits (double configSplitMSQ)
 Splits segments if msq > configSplitMSQ. More...
 
void extractFeatures (RangeData *data_)
 Extract features from a RangeData dataset. More...
 
void extractFeatures (RangeData *data_, AUEFReturnStruct *res)
 Initiates the feature extraction from a RangeData object. More...
 
PolarLineFitfindLongestLine (bool rightwise)
 
int findSplit (PolarLineFit *line)
 Find point to split segment. More...
 
int getCircleCount ()
 Number of circles extracted. More...
 
int getFeatures (AUEFReturnStruct *res)
 Return features to struct. More...
 
int getLineCount ()
 Number of lines extracted. More...
 
int getParam (int p, char *value)
 
CircleFitgetSegmentCircle (int idx)
 get corcle fit structure More...
 
int getSegmentCount ()
 Number of segments extracted. More...
 
PolarLineFitgetSegmentLine (int idx)
 get line segment More...
 
int paramCount ()
 
const char * paramName (int p)
 
void segmentToStringCart (int seg, char *reply)
 XML format of segment. More...
 
void segmentToStringPolar (int seg, char *reply)
 XML format of segment. More...
 
void setDefaults ()
 Set all configurable vars to default. More...
 
void setParam (int p, const char *value)
 
virtual ~AUExtractFeatures ()
 

Static Public Member Functions

static const char * getResClassID ()
 
- Static Public Member Functions inherited from UResVarPool
static const char * getResClassID ()
 

Public Attributes

U2Dlined abcs [MAX_LINES]
 lines extracted in Ax+By+C=0 format More...
 
double boxEW
 box size "width" east-west More...
 
double boxNS
 box size "height" North-south More...
 
UPose boxPose
 pose of box coordinate system More...
 
ULock extractLock
 lock to disallow two threads to be in this function at the same time More...
 
AU2DLineSeg lines [MAX_LINES]
 lines extracted in latest go More...
 
int linesCnt
 number of valid lines More...
 
const char * llogName
 name of logfile More...
 
U2Dlined walls [4]
 wall lines north, east, west, south - in Ax+By+C=0 format More...
 
int wallsAge [4]
 
AU2DLineSeg wallSeg [4]
 wall lines in pos-angle-length format More...
 
- Public Attributes inherited from UReplay
bool replayTimeAdvancePending
 
UTime replayTimeNow
 

Static Public Attributes

static const int MAX_LINES = SEGMENTS_MAX
 maximum number of lines allowed to be extracted (defined in auextractfeatures.h) More...
 

Protected Member Functions

void createBaseVar ()
 
void getParams ()
 copy extractions parameters from global to extract function More...
 
double limitToHalfPi (double th)
 convert the angle th into a value in the range +/- pi/2 More...
 
bool toCartesian (ULaserData *ldata, RangeData *rdata)
 convert the polar rangedata to cartesian. More...
 
- Protected Member Functions inherited from UResVarPool
void setDescription (const char *note, bool copy=false)
 
- Protected Member Functions inherited from UResBase
UResBasegetStaticResource (const char *resName, bool mayCreate, bool staticOnly=true)
 get a pointer to a static resource. More...
 

Protected Attributes

UPose lastPose
 latest pose of robot More...
 
FILE * llog
 logfile handle More...
 
ULock llogLock
 resource lock to protect log-file (avoid writing after log is just closed) More...
 
bool makeWalls90deg
 force walls to be at right angle to each other More...
 
double minLineLength
 minimum line length for association to a wall line More...
 
double safeWallLength
 walls lines longer than this overwrites the distance criteria More...
 
UVariablevarClustDif
 index to extract parameter value cluster separateion distance More...
 
UVariablevarClustMinCnt
 index to extract parameter value minimum cluster size More...
 
UVariablevarCnt
 index to extract parameter value last found number of lines More...
 
UVariablevarDiscard
 index to extract parameter value doDiscard More...
 
UVariablevarDiscardCnt
 index to extract parameter value discard measurement count More...
 
UVariablevarDiscardSize
 index to extract parameter value minimum line size More...
 
UVariablevarMakeWalls90deg
 index to makeWalls90deg boolean value More...
 
UVariablevarMerge
 index to extract parameter value doMerge More...
 
UVariablevarMergeDev
 index to extract parameter value Merge deviation More...
 
UVariablevarMinLineLength
 index to minimum line-to-wall association More...
 
UVariablevarSafeWallLength
 index to safeWallLength More...
 
UVariablevarSplit
 index to extract parameter value doSplot More...
 
UVariablevarSplitDev
 index to extract parameter value split cluster deviation More...
 
UVariablevarTime
 index to extract parameter value last analysis time More...
 
UVariablevarWallAgeLimit
 pointer to wall reset age More...
 
UVariablevarWallAngLimit
 pointer to angle limid More...
 
UVariablevarWallDistLimit
 pointer to wall distance limit More...
 
int wallAgeResetLimit
 wall correlation distance is ignored if wall is not updated in this number of scans More...
 
double wallAngLimit
 wall correlation angle limit, when correlation with new lines More...
 
double wallDistLimit
 wall correlation distance limit for maintained wall More...
 
- Protected Attributes inherited from UResBase
int resFuncIdx
 
char resID [MAX_RESOURCE_ID_LENGTH]
 
char resIsAlso [MAX_RESOURCE_ISALSO_LENGTH]
 
int resVersion
 
- Protected Attributes inherited from UReplay
bool replay
 
FILE * replayFile
 
char replayFileName [REPLAY_FILE_NAME_LENGTH]
 replay filename More...
 
char replayLine [MAX_LOG_LINE_LENGTH]
 
int replayLogLine
 
UReplayreplayParent
 
UTime replayTimeNext
 
- Protected Attributes inherited from AUExtractFeatures
double configCircleMaxCg
 Min coverage for circle. More...
 
double configCircleMaxR
 Max allowed radius for circle. More...
 
double configCircleMinCg
 Min coverage for circle. More...
 
int configCircleMinDots
 Min dots for circle. More...
 
double configCircleMinR
 Min allowed radius for circle. More...
 
double configCircleMSQ
 Max MSQ for circle. More...
 
double configClusterDiff
 Range diff. resulting in cluster split. More...
 
int configDiscardDots
 Discard elements exceeding this MSQ. More...
 
double configDiscardSize
 Discard segments with length/diameter smaller than this. More...
 
double configMergeMSQ
 Max mean square error accepted for merges. More...
 
int configMinSegment
 Minimum number of points in segment. More...
 
char configMode
 Split and merge configuration. More...
 
double configRangeMin
 Dots below range min. are disregarded. More...
 
double configSplitMSQ
 Mean square error resulting in split. More...
 
RangeDatadata
 Laser scanner data. More...
 
struct AUExtractFeatures::segment_s segment [SEGMENTS_MAX]
 
int segments
 number of segments allocated More...
 

Additional Inherited Members

- Static Protected Attributes inherited from UReplay
static const int MAX_LOG_LINE_LENGTH = 10000
 
static const int REPLAY_FILE_NAME_LENGTH = 264
 max length of replay filename More...
 

Constructor & Destructor Documentation

UResAuEf::UResAuEf ( )
inline
UResAuEf::~UResAuEf ( )
virtual

Destructor

References llog.

Referenced by UResAuEf().

Member Function Documentation

void UResAuEf::createBaseVar ( )
protected
int UResAuEf::findFeatures ( ULaserData ldata)
UTime UResAuEf::getLastUpdateTime ( )

get the last time the wall lines were updated

Returns
the timestamp, as set in the global variable

References UVariable::getTime(), and varTime.

Referenced by isLogOpen(), UFuncEfLine::sendAllLines(), UFuncEfLine::sendBoxLines(), and UFuncEfLine::sendBoxPose().

void UResAuEf::getParams ( )
protected

copy extractions parameters from global to extract function

< Split and merge configuration

< Minimum number of points in segment

< Range diff. resulting in cluster split

< Mean square error resulting in split

< Max mean square error accepted for merges

< Discard elements exceeding this MSQ

< Discard segments with length/diameter smaller than this

References AUExtractFeatures::configClusterDiff, AUExtractFeatures::configDiscardDots, AUExtractFeatures::configDiscardSize, AUExtractFeatures::configMergeMSQ, AUExtractFeatures::configMinSegment, AUExtractFeatures::configMode, AUExtractFeatures::configSplitMSQ, EF_DO_DISCARD, EF_DO_MERGE, EF_DO_SPLIT, UVariable::getBool(), UVariable::getInt(), UVariable::getValued(), makeWalls90deg, minLineLength, safeWallLength, sqr(), varClustDif, varClustMinCnt, varDiscard, varDiscardCnt, varDiscardSize, varMakeWalls90deg, varMerge, varMergeDev, varMinLineLength, varSafeWallLength, varSplit, varSplitDev, varWallAgeLimit, varWallAngLimit, varWallDistLimit, wallAgeResetLimit, wallAngLimit, and wallDistLimit.

Referenced by findFeatures(), and isLogOpen().

static const char* UResAuEf::getResClassID ( )
inlinestatic

Fixed name of this resource type

References findFeatures(), openLog(), and print().

Referenced by UResAuEf().

bool UResAuEf::initializeWalls ( )

Initialize the wall estimate Use the longest seen line as a starting point and define other lines from this, setting unseed walls as close as possible.

References U2Dlined::A(), abcs, U2Dlined::B(), AU2DLineSeg::length, lines, linesCnt, U2Dlined::set(), walls, and wallsAge.

Referenced by isLogOpen(), and updateWalls().

bool UResAuEf::isLogOpen ( )
inline
double UResAuEf::limitToHalfPi ( double  th)
protected

convert the angle th into a value in the range +/- pi/2

Referenced by isLogOpen().

void UResAuEf::openLog ( bool  close)

open or close fixed logfile

Parameters
closecloses the logfile if true, else open

References dataPath, llog, llogLock, llogName, ULock::lock(), MAX_FILENAME_LENGTH, and ULock::unlock().

Referenced by getResClassID(), and UFuncEfLine::handleCommand().

const char * UResAuEf::print ( const char *  preString,
char *  buff,
int  buffCnt 
)
virtual

Fixed varsion number for this resource type. Should follow release version, i.e. version 1.28 gives number 128. Should be incremented only when there is change to this class definition, i.e new or changed functions or variables. print status to a string buffer

Reimplemented from AUExtractFeatures.

References UResBase::getResVersion(), linesCnt, and llog.

Referenced by getResClassID().

bool UResAuEf::toCartesian ( ULaserData ldata,
RangeData rdata 
)
protected
int UResAuEf::updateWalls ( UPose  newPose)

update the estimate of walls, assuming the room is rectangular. The result is in the wall[0..3] array with 0=north, 1= east, 2=south, and 3=west, assuming initial position is heading east, i.e. heading at an approximately right angle towards the east wall. Updates further a wallValid[0..4] array. The method is to find number of sides that is updated.

References a, U2Dlined::A(), abcs, absf(), U2Dlined::B(), boxEW, boxNS, boxPose, U2Dlined::C(), U2Dlined::getCrossing(), UPose::h, initializeWalls(), lastPose, AU2DLineSeg::length, limitToPi(), lines, linesCnt, makeWalls90deg, MAX_LINES, minLineLength, safeWallLength, U2Dlined::set(), AU2DLineSeg::setLine(), wallAgeResetLimit, wallAngLimit, wallDistLimit, walls, wallsAge, wallSeg, AU2DLineSeg::x, UPose::x, AU2DLineSeg::y, and UPose::y.

Referenced by isLogOpen(), UFuncEfLine::sendBoxLines(), and UFuncEfLine::sendBoxPose().

void UResAuEf::UResAuEfInit ( )

Initialize class

References createBaseVar(), linesCnt, llog, llogName, and wallsAge.

Referenced by UResAuEf().

void UResAuEf::wallReset ( )

Reset wall estimate to no walls.

References wallsAge.

Referenced by UFuncEfLine::handleCommand(), and isLogOpen().

Member Data Documentation

U2Dlined UResAuEf::abcs[MAX_LINES]

lines extracted in Ax+By+C=0 format

Referenced by findFeatures(), initializeWalls(), and updateWalls().

double UResAuEf::boxEW

box size "width" east-west

Referenced by UFuncEfLine::sendBoxPose(), and updateWalls().

double UResAuEf::boxNS

box size "height" North-south

Referenced by UFuncEfLine::sendBoxPose(), and updateWalls().

UPose UResAuEf::boxPose

pose of box coordinate system

Referenced by UFuncEfLine::sendBoxPose(), and updateWalls().

ULock UResAuEf::extractLock

lock to disallow two threads to be in this function at the same time

Referenced by UFuncEfLine::sendAllLines(), UFuncEfLine::sendBoxLines(), and UFuncEfLine::sendBoxPose().

UPose UResAuEf::lastPose
protected

latest pose of robot

Referenced by updateWalls().

AU2DLineSeg UResAuEf::lines[MAX_LINES]

lines extracted in latest go

Referenced by findFeatures(), initializeWalls(), UFuncEfLine::sendAllLines(), and updateWalls().

int UResAuEf::linesCnt
FILE* UResAuEf::llog
protected

logfile handle

Referenced by findFeatures(), isLogOpen(), openLog(), print(), UResAuEfInit(), and ~UResAuEf().

ULock UResAuEf::llogLock
protected

resource lock to protect log-file (avoid writing after log is just closed)

Referenced by findFeatures(), and openLog().

const char* UResAuEf::llogName

name of logfile

Referenced by UFuncEfLine::handleCommand(), openLog(), and UResAuEfInit().

bool UResAuEf::makeWalls90deg
protected

force walls to be at right angle to each other

Referenced by getParams(), and updateWalls().

const int UResAuEf::MAX_LINES = SEGMENTS_MAX
static

maximum number of lines allowed to be extracted (defined in auextractfeatures.h)

Referenced by findFeatures(), and updateWalls().

double UResAuEf::minLineLength
protected

minimum line length for association to a wall line

Referenced by getParams(), and updateWalls().

double UResAuEf::safeWallLength
protected

walls lines longer than this overwrites the distance criteria

Referenced by getParams(), and updateWalls().

UVariable* UResAuEf::varClustDif
protected

index to extract parameter value cluster separateion distance

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varClustMinCnt
protected

index to extract parameter value minimum cluster size

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varCnt
protected

index to extract parameter value last found number of lines

Referenced by createBaseVar(), and findFeatures().

UVariable* UResAuEf::varDiscard
protected

index to extract parameter value doDiscard

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varDiscardCnt
protected

index to extract parameter value discard measurement count

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varDiscardSize
protected

index to extract parameter value minimum line size

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varMakeWalls90deg
protected

index to makeWalls90deg boolean value

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varMerge
protected

index to extract parameter value doMerge

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varMergeDev
protected

index to extract parameter value Merge deviation

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varMinLineLength
protected

index to minimum line-to-wall association

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varSafeWallLength
protected

index to safeWallLength

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varSplit
protected

index to extract parameter value doSplot

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varSplitDev
protected

index to extract parameter value split cluster deviation

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varTime
protected

index to extract parameter value last analysis time

Referenced by createBaseVar(), findFeatures(), and getLastUpdateTime().

UVariable* UResAuEf::varWallAgeLimit
protected

pointer to wall reset age

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varWallAngLimit
protected

pointer to angle limid

Referenced by createBaseVar(), and getParams().

UVariable* UResAuEf::varWallDistLimit
protected

pointer to wall distance limit

Referenced by createBaseVar(), and getParams().

int UResAuEf::wallAgeResetLimit
protected

wall correlation distance is ignored if wall is not updated in this number of scans

Referenced by getParams(), and updateWalls().

double UResAuEf::wallAngLimit
protected

wall correlation angle limit, when correlation with new lines

Referenced by getParams(), and updateWalls().

double UResAuEf::wallDistLimit
protected

wall correlation distance limit for maintained wall

Referenced by getParams(), and updateWalls().

U2Dlined UResAuEf::walls[4]

wall lines north, east, west, south - in Ax+By+C=0 format

Referenced by initializeWalls(), and updateWalls().

int UResAuEf::wallsAge[4]

to what level are the walls valid -1 = not initialized, 0 = initialized, but not updated with reliable data 1 = updated in latest scan N = Updated N scans ago, where N=2..

Referenced by initializeWalls(), UFuncEfLine::sendBoxLines(), updateWalls(), UResAuEfInit(), and wallReset().

AU2DLineSeg UResAuEf::wallSeg[4]

wall lines in pos-angle-length format

Referenced by UFuncEfLine::sendBoxLines(), and updateWalls().


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