AURobotServers
4
|
#include <ureslobst.h>
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) |
UVarPool * | addStruct (const char *name, const char *comment, bool copy=false) |
UVariable * | addVar (const char *name, const double initialValue, const char *type, const char *comment) |
UVariable * | addVar (const char *name, const char *initialValue, const char *type, const char *comment) |
UVariable * | addVarA (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) |
UVarCalc * | getVarPool () |
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 () |
UCmdExe * | getCorePointer () |
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 | |
UResBase * | getStaticResource (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... | |
UVariable * | varDebugDumpScanOff |
set global debugDump flag for avoid plugin More... | |
UVariable * | varDebugDumpScanOn |
set global debugDump flag for avoid plugin More... | |
UVariable * | varDistThreshold |
ransac dist from line to support line More... | |
UVariable * | varEnableSplit |
enable spilit of long lines. More... | |
UVariable * | varIgnoreIfFixed |
ignore obstacles that correlated with fixed mapped obstacles More... | |
UVariable * | varLineCnt |
make polygons in poly-plugin for detected lines More... | |
UVariable * | varLineEatDist |
eat measurements this close to lines (after line creation) More... | |
UVariable * | varLineIter |
maximum number of line finding iterations More... | |
UVariable * | varMinLineSupport |
minimum number of supporting measurements to create line More... | |
UVariable * | varMinSplitCnt |
minimum measurements in split part of line More... | |
UVariable * | varNoObst |
area where obstacles should be ognored [x,y,x,y] front-left, back right More... | |
UVariable * | varObstCnt |
number of maintained obstacles More... | |
UVariable * | varSamples |
number of line samples to get best line More... | |
UVariable * | varScan |
most recent processed scan number More... | |
UVariable * | varSplit |
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 |
UReplay * | replayParent |
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 () |
This is the shared resource class. It must enherit from the resource base class (or one of its decendents) as shown.
|
inline |
Constructor
References codeLines(), getList(), makeObst(), makeObstGroups(), scan, sendAsObstacles(), UResBase::setResID(), UResLobstInit(), and ~UResLobst().
|
virtual |
Destructor
Referenced by UResLobst().
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="" ..-> />
buff | is the buffer to write the tags into. |
buffCnt | is the size of 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().
|
protected |
Make the variables that will be available to other plugins
References UResVarPool::addMethod(), UResVarPool::addVar(), varDebugDumpScanOff, varDebugDumpScanOn, varDistThreshold, varEnableSplit, varIgnoreIfFixed, varLineCnt, varLineEatDist, varLineIter, varMinLineSupport, varMinSplitCnt, varNoObst, varObstCnt, varSamples, varScan, and varSplit.
Referenced by getLineCnt(), and UResLobstInit().
|
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().
|
inline |
Get number of generated obstacle groups
References obstGrpCnt.
Referenced by UFuncLobst::handleCommand().
bool UResLobst::makeObst | ( | ULaserData * | scan, |
ULaserDevice * | las | ||
) |
make obstalcles
scan | is the laser scan to handle |
las | is the source laser device |
References a, LEL_GFParams::distThreshold, LEL_GFParams::enableSplit, GFLine::endX, GFLine::endY, ULaserData::getAngleRad(), UVariable::getBool(), ULaserDevice::getDevicePose(), U2Dseg::getDistanceSigned(), UVariable::getDouble(), UVariable::getInt(), ULaserData::getRangeCnt(), ULaserData::getRangeMeter(), ULaserData::getScanTime(), ULaserData::getSerial(), UVariable::getValued(), URotation::Kappa, LEL_GFParams::lineIter, lineList, lineListCnt, makeObstGroups(), LEL_GFParams::minLineSupport, LEL_GFParams::minNoOfPoints, LEL_GFParams::minSplitCnt, obstGrpCnt, URotation::Phi, pntCnt, pntUse, pntX, pntY, ransac(), LEL_GFParams::sampleIter, scantime, serial, U2Dpos::set(), U2Dseg::setFromPoints(), UResVarPool::setGlobalVar(), UVariable::setInt(), UVariable::setValued(), LEL_GFParams::splitDist, GFLine::startX, GFLine::startY, varDebugDumpScanOff, varDebugDumpScanOn, varDistThreshold, varEnableSplit, varLineCnt, varLineEatDist, varLineIter, varMinLineSupport, varMinSplitCnt, varNoObst, varObstCnt, varSamples, varScan, varSplit, U2Dpos::x, UPosition::x, U2Dpos::y, and UPosition::y.
Referenced by UFuncLobst::handleCommand(), and UResLobst().
int UResLobst::makeObstGroups | ( | double | splitDist, |
int | firstCnt | ||
) |
Group remaining detections into obstacle groups - from points in calss array pntX, pntYm pntUse.
splitDist | is distance to next point for split. |
firstCnt | is the first number to use when grouping the measurements. |
References pntCnt, pntUse, pntX, pntY, U2Dpos::x, and U2Dpos::y.
Referenced by makeObst(), and UResLobst().
|
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.
name | is the name of the called function |
paramOrder | is a string with one char for each parameter in the call - d is double, s is string, c is class object. |
params | is 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. |
returnStruct | is an array of class object pointers that can be used as parameters or return objects (may be NULL) |
returnStructCnt | is the number of objects in the returnStruct buffer |
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 | ( | ) |
Generate obstacle polygons and send to obstacle resource.
References UPolygon::add(), UObstaclePool::addObst(), UPolygon::clear(), GFLine::endX, GFLine::endY, UPolygon::extractConvexTo(), UVariable::getBool(), UPolygon::getPointsCnt(), UResPoseHist::getPoseAtTime(), UPose::getPoseToMap(), UResBase::getStaticResource(), lineList, lineListCnt, UResObstacle::obstDataUpdated(), obstGrpCnt, pntCnt, pntUse, pntX, pntY, scantime, UPolygon::setAsPolygon(), GFLine::startX, GFLine::startY, UPoseTime::t, and varIgnoreIfFixed.
Referenced by UFuncLobst::handleCommand(), and UResLobst().
void UResLobst::UResLobstInit | ( | ) |
Initialize resource
References createBaseVar(), lineListCnt, obstGrpCnt, pntCnt, ULogFile::setLogName(), and verbose.
Referenced by UResLobst().
|
protected |
Referenced by codeLines(), makeObst(), methodCallV(), and sendAsObstacles().
|
protected |
Referenced by codeLines(), getLineCnt(), makeObst(), methodCallV(), sendAsObstacles(), and UResLobstInit().
|
staticprotected |
|
staticprotected |
measurements in angle order
|
protected |
number of found - and numbered - obstacle groups.
Referenced by getObstGrpCnt(), makeObst(), sendAsObstacles(), and UResLobstInit().
|
protected |
number of measurements in array
Referenced by makeObst(), makeObstGroups(), sendAsObstacles(), and UResLobstInit().
|
protected |
measurements point to line - or obstacle group - index.
Referenced by makeObst(), makeObstGroups(), and sendAsObstacles().
|
protected |
measurements in angle order - X-coordinate (in robot coordiantes)
Referenced by makeObst(), makeObstGroups(), and sendAsObstacles().
|
protected |
measurements in angle order - Y-coordinate (in robot coordiantes)
Referenced by makeObst(), makeObstGroups(), and sendAsObstacles().
|
protected |
scantime for latest scan
Referenced by makeObst(), methodCallV(), and sendAsObstacles().
|
protected |
scan serial number
Referenced by makeObst().
|
protected |
set global debugDump flag for avoid plugin
Referenced by createBaseVar(), and makeObst().
|
protected |
set global debugDump flag for avoid plugin
Referenced by createBaseVar(), and makeObst().
|
protected |
ransac dist from line to support line
Referenced by createBaseVar(), and makeObst().
|
protected |
enable spilit of long lines.
Referenced by createBaseVar(), and makeObst().
|
protected |
ignore obstacles that correlated with fixed mapped obstacles
Referenced by createBaseVar(), and sendAsObstacles().
|
protected |
make polygons in poly-plugin for detected lines
number of generated laser lines
Referenced by createBaseVar(), and makeObst().
|
protected |
eat measurements this close to lines (after line creation)
Referenced by createBaseVar(), and makeObst().
|
protected |
maximum number of line finding iterations
Referenced by createBaseVar(), and makeObst().
|
protected |
minimum number of supporting measurements to create line
Referenced by createBaseVar(), and makeObst().
|
protected |
minimum measurements in split part of line
Referenced by createBaseVar(), and makeObst().
|
protected |
area where obstacles should be ognored [x,y,x,y] front-left, back right
Referenced by createBaseVar(), and makeObst().
|
protected |
number of maintained obstacles
Referenced by createBaseVar(), and makeObst().
|
protected |
number of line samples to get best line
Referenced by createBaseVar(), and makeObst().
|
protected |
most recent processed scan number
Referenced by createBaseVar(), and makeObst().
|
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().