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

#include <ureslobst.h>

Inheritance diagram for UResLobst:
Inheritance graph

Public Member Functions

char * codeLines (char *buff, int buffCnt)
 
int getLineCnt ()
 
const char * getList (const char *preStr, char *buff, const int buffCnt)
 
int getObstGrpCnt ()
 
bool makeObst (ULaserData *scan, ULaserDevice *las)
 
int makeObstGroups (double splitDist, int firstCnt)
 
virtual bool methodCallV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct, int *returnStructCnt)
 
bool sendAsObstacles ()
 
 UResLobst ()
 
void UResLobstInit ()
 
virtual ~UResLobst ()
 
- 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)
 
virtual const char * print (const char *preString, char *buff, int buffCnt)
 
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 ~UVarMethodImplement ()
 
- Public Member Functions inherited from ULogFile
void closeLog ()
 
void doFlush ()
 
FILE * getF ()
 
const char * getLogFileName ()
 
const char * getLogName ()
 
bool isLogOpen ()
 
bool isOpen ()
 
void logLock ()
 
bool logRename (const char *name)
 
void logUnlock ()
 
bool openLog ()
 
bool openLog (bool doOpen)
 
bool openLog (const char *resName)
 
void setLogFlush (bool doFlush)
 
void setLogName (const char *resName, const char *ext="log")
 
void setLogNameNumber (int number)
 add a number to the logfile name, That is if the logName is 'svs' and number is 2 (and logPath is '/rhome/demo'), then logfilename is set to '/rhome/demo/svs_2.log'. The purpose is to have an alternative, if the file renaming fails (if the file system is locked or something). More...
 
void setLogTime (UTime timestamp)
 
void toLog (const char *logString)
 
void toLog (const char *s1, const char *s2)
 
void toLog (const int num, const char *s1, const char *s2)
 
void toLog (const char *s1, const int num, const char *s2)
 
void toLog (const char *s1, const int n1, const int n2, const char *s2)
 
void toLog (const char *s1, const int num, const char *s2, const char *s3)
 
void toLog (const char *s1, const int n1, const int n2, const char *s2, const char *s3)
 
 ULogFile ()
 
void useLogTime (bool value)
 
 ~ULogFile ()
 

Public Attributes

bool verbose
 
- Public Attributes inherited from UReplay
bool replayTimeAdvancePending
 
UTime replayTimeNow
 

Protected Member Functions

void createBaseVar ()
 
- 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

GFLine lineList [MAX_RANSAC_LINES]
 
int lineListCnt
 
int obstGrpCnt
 number of found - and numbered - obstacle groups. More...
 
int pntCnt
 number of measurements in array More...
 
int pntUse [MPC]
 measurements point to line - or obstacle group - index. More...
 
double pntX [MPC]
 measurements in angle order - X-coordinate (in robot coordiantes) More...
 
double pntY [MPC]
 measurements in angle order - Y-coordinate (in robot coordiantes) More...
 
UTime scantime
 scantime for latest scan More...
 
unsigned int serial
 scan serial number More...
 
UVariablevarDebugDumpScanOff
 set global debugDump flag for avoid plugin More...
 
UVariablevarDebugDumpScanOn
 set global debugDump flag for avoid plugin More...
 
UVariablevarDistThreshold
 ransac dist from line to support line More...
 
UVariablevarEnableSplit
 enable spilit of long lines. More...
 
UVariablevarIgnoreIfFixed
 ignore obstacles that correlated with fixed mapped obstacles More...
 
UVariablevarLineCnt
 make polygons in poly-plugin for detected lines More...
 
UVariablevarLineEatDist
 eat measurements this close to lines (after line creation) More...
 
UVariablevarLineIter
 maximum number of line finding iterations More...
 
UVariablevarMinLineSupport
 minimum number of supporting measurements to create line More...
 
UVariablevarMinSplitCnt
 minimum measurements in split part of line More...
 
UVariablevarNoObst
 area where obstacles should be ognored [x,y,x,y] front-left, back right More...
 
UVariablevarObstCnt
 number of maintained obstacles More...
 
UVariablevarSamples
 number of line samples to get best line More...
 
UVariablevarScan
 most recent processed scan number More...
 
UVariablevarSplit
 max distance between measurements to maintain line 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 ULogFile
int failCnt
 
FILE * logFile
 
ULock logFileLock
 
char logFileName [MAX_FILENAME_SIZE]
 
bool logFlush
 
char logName [MAX_FILENAME_SIZE]
 
UTime logTime
 
bool logTimeUse
 

Static Protected Attributes

static const int MAX_RANSAC_LINES = 50
 
static const int MPC = 1200
 measurements in angle order More...
 
- 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...
 

Additional Inherited Members

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

Detailed Description

This is the shared resource class. It must enherit from the resource base class (or one of its decendents) as shown.

Author
Christian Andersen

Constructor & Destructor Documentation

UResLobst::UResLobst ( )
inline
UResLobst::~UResLobst ( )
virtual

Destructor

Referenced by UResLobst().

Member Function Documentation

char * UResLobst::codeLines ( char *  buff,
int  buffCnt 
)

Code the result of the line estimates into a sequence of xml tags, like <line x="" y="" th="" l="" name="">
<line x="" ..-> />
<line x="" ..-> />

Parameters
buffis the buffer to write the tags into.
buffCntis the size of the buffer.
Returns
a pointer to the buffer.

References U2Dseg::codeXml(), GFLine::endX, GFLine::endY, UResBase::line, lineList, lineListCnt, U2Dseg::setFromPoints(), GFLine::startX, and GFLine::startY.

Referenced by UFuncLobst::handleCommand(), and UResLobst().

void UResLobst::createBaseVar ( )
protected
int UResLobst::getLineCnt ( )
inline

Get number of generated obstacle groups

References createBaseVar(), lineListCnt, and methodCallV().

Referenced by UFuncLobst::handleCommand().

const char * UResLobst::getList ( const char *  preStr,
char *  buff,
const int  buffCnt 
)

Get list of found obstalcles

Referenced by UResLobst().

int UResLobst::getObstGrpCnt ( )
inline

Get number of generated obstacle groups

References obstGrpCnt.

Referenced by UFuncLobst::handleCommand().

bool UResLobst::makeObst ( ULaserData scan,
ULaserDevice las 
)
int UResLobst::makeObstGroups ( double  splitDist,
int  firstCnt 
)

Group remaining detections into obstacle groups - from points in calss array pntX, pntYm pntUse.

Parameters
splitDistis distance to next point for split.
firstCntis the first number to use when grouping the measurements.
Returns
number of found groups.

References pntCnt, pntUse, pntX, pntY, U2Dpos::x, and U2Dpos::y.

Referenced by makeObst(), and UResLobst().

bool UResLobst::methodCallV ( const char *  name,
const char *  paramOrder,
UVariable params[],
UDataBase **  returnStruct,
int *  returnStructCnt 
)
virtual

Function to implement an inter plug-in method call using UVariables as parameter (and return value). Structures of the base type UDatabase (but not UVariables) may be returned in the returnStruct pointer array. The returnStructCnt should be set to returned count, if values are returned.

Parameters
nameis the name of the called function
paramOrderis a string with one char for each parameter in the call - d is double, s is string, c is class object.
paramsis an array of UVariable pointers, one pointer for each character in paramOrder. NB! params are not declared as constant, and may be used to return values.
returnStructis an array of class object pointers that can be used as parameters or return objects (may be NULL)
returnStructCntis the number of objects in the returnStruct buffer
Returns
true if the method is recognised (exists), when false is returned a invalid name or parameter list is detected.

Reimplemented from UVarMethodImplement.

References GFLine::endX, GFLine::endY, UResPoseHist::getPoseAtTime(), UResBase::getStaticResource(), UPose::h, UDataBase::isA(), UResBase::isA(), lineList, lineListCnt, ULock::lock(), mini(), scantime, U2Dseg::setFromPoints(), GFLine::startX, GFLine::startY, UPoseTime::t, ULock::unlock(), UPose::x, and UPose::y.

Referenced by getLineCnt().

bool UResLobst::sendAsObstacles ( )
void UResLobst::UResLobstInit ( )

Initialize resource

References createBaseVar(), lineListCnt, obstGrpCnt, pntCnt, ULogFile::setLogName(), and verbose.

Referenced by UResLobst().

Member Data Documentation

GFLine UResLobst::lineList[MAX_RANSAC_LINES]
protected
int UResLobst::lineListCnt
protected
const int UResLobst::MAX_RANSAC_LINES = 50
staticprotected
const int UResLobst::MPC = 1200
staticprotected

measurements in angle order

int UResLobst::obstGrpCnt
protected

number of found - and numbered - obstacle groups.

Referenced by getObstGrpCnt(), makeObst(), sendAsObstacles(), and UResLobstInit().

int UResLobst::pntCnt
protected

number of measurements in array

Referenced by makeObst(), makeObstGroups(), sendAsObstacles(), and UResLobstInit().

int UResLobst::pntUse[MPC]
protected

measurements point to line - or obstacle group - index.

Referenced by makeObst(), makeObstGroups(), and sendAsObstacles().

double UResLobst::pntX[MPC]
protected

measurements in angle order - X-coordinate (in robot coordiantes)

Referenced by makeObst(), makeObstGroups(), and sendAsObstacles().

double UResLobst::pntY[MPC]
protected

measurements in angle order - Y-coordinate (in robot coordiantes)

Referenced by makeObst(), makeObstGroups(), and sendAsObstacles().

UTime UResLobst::scantime
protected

scantime for latest scan

Referenced by makeObst(), methodCallV(), and sendAsObstacles().

unsigned int UResLobst::serial
protected

scan serial number

Referenced by makeObst().

UVariable* UResLobst::varDebugDumpScanOff
protected

set global debugDump flag for avoid plugin

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varDebugDumpScanOn
protected

set global debugDump flag for avoid plugin

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varDistThreshold
protected

ransac dist from line to support line

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varEnableSplit
protected

enable spilit of long lines.

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varIgnoreIfFixed
protected

ignore obstacles that correlated with fixed mapped obstacles

Referenced by createBaseVar(), and sendAsObstacles().

UVariable* UResLobst::varLineCnt
protected

make polygons in poly-plugin for detected lines

number of generated laser lines

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varLineEatDist
protected

eat measurements this close to lines (after line creation)

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varLineIter
protected

maximum number of line finding iterations

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varMinLineSupport
protected

minimum number of supporting measurements to create line

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varMinSplitCnt
protected

minimum measurements in split part of line

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varNoObst
protected

area where obstacles should be ognored [x,y,x,y] front-left, back right

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varObstCnt
protected

number of maintained obstacles

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varSamples
protected

number of line samples to get best line

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varScan
protected

most recent processed scan number

Referenced by createBaseVar(), and makeObst().

UVariable* UResLobst::varSplit
protected

max distance between measurements to maintain line

Referenced by createBaseVar(), and makeObst().

bool UResLobst::verbose

Is the resource to output verbose message to console

Referenced by UFuncLobst::handleCommand(), and UResLobstInit().


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