AURobotServers
4
|
#include <ureslaserifobst.h>
Public Member Functions | |
void | clear () |
virtual const char * | commandList () |
void | createBaseVar () |
virtual void | handleNewData (USmlTag *tag, const char *ifname) |
const char * | listGroup (int group, char *buff, int buffCnt) |
const char * | listGroups (char *buff, int buffCnt) |
virtual bool | methodCall (const char *name, const char *paramOrder, char **strings, const double *pars, double *value, UDataBase **returnStruct, int *returnStructCnt) |
virtual void | newDataAvailable () |
virtual const char * | print (const char *preString, char *buff, int buffCnt) |
void | setLog (bool open) |
virtual const char * | snprint (const char *preString, char *buff, int buffCnt) |
UResLaserIfObst () | |
~UResLaserIfObst () | |
Public Member Functions inherited from UResIfBase | |
UResIfBase () | |
~UResIfBase () | |
Public Member Functions inherited from UClientFuncBase | |
virtual void | changedNamespace (const char *newNamespace) |
virtual void | doTimeTick () |
int | getMsgCnt () |
bool | getVerbose () |
virtual const char * | name () |
bool | sendMsg (UClientPortSml *cnn, const char *buff, int buffCnt) |
bool | sendMsg (UClientPortSml *cnn, const char *buff) |
void | setVerbose (bool value) |
UClientFuncBase () | |
virtual | ~UClientFuncBase () |
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) |
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 bool | methodCallV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct, int *returnStructCnt) |
virtual | ~UVarMethodImplement () |
Public Member Functions inherited from UObstacleHist | |
void | clear () |
UObstacleGroup * | getGroup (int idx) |
UObstacleGroup * | getGroup (unsigned long serial, bool mayCreate) |
UObstacleGroup * | getGroupFixed () |
int | getGroupNewest () |
UObstacleGroup * | getGroupNewest (int cnt) |
int | getGroupsCnt () |
int | getGroupsMax () |
UObstacleHist () | |
virtual | ~UObstacleHist () |
Static Public Member Functions | |
static const char * | getResClassID () |
Static Public Member Functions inherited from UResVarPool | |
static const char * | getResClassID () |
Public Attributes | |
ULogFile | olog |
Public Attributes inherited from UClientFuncBase | |
ULock | decodeLock |
Public Attributes inherited from UReplay | |
bool | replayTimeAdvancePending |
UTime | replayTimeNow |
Public Attributes inherited from UObstacleHist | |
ULock | ogLock |
Protected Member Functions | |
void | handleObst (USmlTag *tag) |
void | handleObstGrp (USmlTag *tag) |
Protected Member Functions inherited from UClientFuncBase | |
void | handleHelp (USmlTag *tag) |
void | printReply (USmlTagIn *tag, const char *preString) |
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 | |
bool | callDispOnNewData |
unsigned long | latestSerial |
Protected Attributes inherited from UClientFuncBase | |
int | msgHandled |
char | serverNamespace [MAX_SML_NAME_LENGTH] |
int | serverNamespaceValue |
bool | verboseMessages |
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 UObstacleHist | |
UObstacleGroup | fixeds |
UObstacleGroup | groups [MAX_OBST_GRPS] |
int | groupsCnt |
int | groupsNewest |
UTime | updTime |
Private Attributes | |
UVariable * | varGroups |
UVariable * | varOLog |
UVariable * | varSerial |
UVariable * | varTime |
UVariable * | varUpdate |
Additional Inherited Members | |
Static Public Attributes inherited from UObstacleHist | |
static const int | MAX_OBST_GRPS = 100 |
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... | |
Handling of messages that should be converted to an obstacle history pool
@author Christian <chrand@mail.dk>
|
inline |
UResLaserIfObst::~UResLaserIfObst | ( | ) |
References ULogFile::closeLog(), and olog.
Referenced by UResLaserIfObst().
|
inline |
clear all obstacles
References UObstacleHist::clear(), latestSerial, listGroup(), listGroups(), and newDataAvailable().
Referenced by UFunctionLaserIfData::handleLaserIf(), and UFunctionLaserIfData::handleLaserObst().
|
virtual |
Function, that shall return a string with all handled commands, i.e. should return "gmk gmk2d guidemark", if commands starting with any of these three keywords are handled by this function
Reimplemented from UClientFuncBase.
Referenced by getResClassID(), and snprint().
void UResLaserIfObst::createBaseVar | ( | ) |
Create base variables and methods for var-pool
References UResVarPool::addMethod(), UResVarPool::addVar(), UResBase::getResVersion(), varGroups, varOLog, varSerial, varTime, and varUpdate.
Referenced by getResClassID(), and UResLaserIfObst().
|
inlinestatic |
Fixed name of this resource type
References commandList(), createBaseVar(), handleNewData(), and snprint().
Referenced by UNavPaint::setResource(), UFunctionLaserIfData::setResource(), UNavView::setResource(), and UResLaserIfObst().
|
virtual |
Got fresh data destined to this function.
Reimplemented from UClientFuncBase.
References handleObst(), USmlTagIn::isTagA(), UClientFuncBase::msgHandled, and UClientFuncBase::printReply().
Referenced by getResClassID().
|
protected |
Unpack the obst message.
References UVariable::add(), USmlTag::cnnVerbose(), UVariable::getBool(), USmlTagIn::getNextAttribute(), USmlTag::getNextTag(), USmlTagIn::getTagName(), USmlTagIn::getTagStart(), UObstacleHist::groupsCnt, handleObstGrp(), USmlTagIn::isAStartTag(), ULogFile::isOpen(), USmlTagIn::isTagA(), USmlTagIn::isTagAnEnd(), latestSerial, MAX_SML_NAME_LENGTH, newDataAvailable(), UObstacleHist::ogLock, olog, ULogFile::openLog(), UVariable::setInt(), UVariable::setTime(), UTime::setTimeTod(), USmlTag::skipToEndTag(), ULock::tryLock(), ULock::unlock(), UObstacleHist::updTime, varGroups, varOLog, varSerial, varTime, and varUpdate.
Referenced by handleNewData(), and setLog().
|
protected |
Handle the decode of an obstacle group
References UObstacleGroup::clear(), UObstacleHist::fixeds, USmlTagIn::getAttValue(), ULogFile::getF(), UObstacleHist::getGroup(), USmlTag::getObstacleGroup(), USmlTagIn::isAStartTag(), ULogFile::isLogOpen(), latestSerial, UObstacleGroup::logAll(), olog, USmlTag::skipToEndTag(), ULogFile::toLog(), ULock::tryLock(), and ULock::unlock().
Referenced by handleObst(), and setLog().
const char * UResLaserIfObst::listGroup | ( | int | group, |
char * | buff, | ||
int | buffCnt | ||
) |
Make a short list of obstacles in this group
group | is the number of the group - 0 is the newest 1 the next older .... |
buff | is the string buffer to write to |
buffCnt | is the length of the string buffer |
References UObstacleHist::fixeds, UPolygon::getCogXY(), UObstacleGroup::getObstacle(), UObstacleGroup::getObstsCnt(), UPolygon::getPointsCnt(), UObstacleGroup::getSerial(), UObstacleHist::groups, UObstacleHist::groupsCnt, UObstacleHist::groupsNewest, ULock::lock(), UObstacleHist::MAX_OBST_GRPS, ULock::unlock(), UPosition::x, and UPosition::y.
Referenced by clear(), and UFunctionLaserIfData::handleLaserObst().
const char * UResLaserIfObst::listGroups | ( | char * | buff, |
int | buffCnt | ||
) |
Make a short list of obstacles in this group
buff | is the string buffer to write to |
buffCnt | is the length of the string buffer |
References UObstacleHist::fixeds, UTime::getDateTimeAsString(), UObstacleGroup::getObstsCnt(), UObstacleGroup::getPoseLast(), UObstacleGroup::getSerial(), UObstacleHist::groups, UObstacleHist::groupsCnt, UObstacleHist::groupsNewest, ULock::lock(), UObstacleHist::MAX_OBST_GRPS, UPoseTime::t, and ULock::unlock().
Referenced by clear(), and UFunctionLaserIfData::handleLaserObst().
|
virtual |
The varPool has methods, and a call to one of these is needed. Do what is needed and return (a double sized) result in 'value' and return true if the method call is allowed. The 'paramOrder' indicates the valid parameters d, s or c for double, string or class that is available as input values for the call. If the returnStruct and returnStructCnt is not NULL, then a number (no more than initial value of returnStructCnt) of structures based on UDataBase may be returned into returnStruct array of pointers. The returnStructCnt should be modified to the actual number of used pointers (if needed).
Reimplemented from UResVarPool.
References UObstacleHist::fixeds, UObstacleHist::getGroupNewest(), UObstacleHist::getGroupsCnt(), UObstacleGroup::getObstsCnt(), UObstacleHist::groups, ULock::lock(), UObstacleHist::MAX_OBST_GRPS, UObstacleHist::ogLock, roundi(), and ULock::unlock().
Referenced by print().
|
virtual |
Called after decode of a set of obstacle updates
References callDispOnNewData, UResVarPool::callGlobal(), UVariable::getValued(), and varSerial.
Referenced by clear(), handleObst(), and print().
|
inlinevirtual |
Print status for this resource
Reimplemented from UResVarPool.
References methodCall(), UClientFuncBase::name(), newDataAvailable(), and snprint().
|
inline |
Set logfile open or closed
References handleObst(), handleObstGrp(), UVariable::setBool(), and varOLog.
Referenced by UFunctionLaserIfData::handleLaserObst().
|
virtual |
Print status for this resource
References commandList(), UTime::getTimeAsString(), UObstacleHist::groupsCnt, and UObstacleHist::updTime.
Referenced by getResClassID(), UFunctionLaserIfData::handleLaserIf(), UFunctionLaserIfData::handleLaserObst(), and print().
|
protected |
Tell display that new data is available
Referenced by newDataAvailable(), and UResLaserIfObst().
|
protected |
Latest group serial number
Referenced by clear(), handleObst(), handleObstGrp(), and UResLaserIfObst().
ULogFile UResLaserIfObst::olog |
Logfile
Referenced by UFunctionLaserIfData::handleLaserObst(), handleObst(), handleObstGrp(), UResLaserIfObst(), and ~UResLaserIfObst().
|
private |
index to variable with number of obstacle groups
Referenced by createBaseVar(), and handleObst().
|
private |
Should logfile be created
Referenced by createBaseVar(), handleObst(), and setLog().
|
private |
index to variable with latest serial number
Referenced by createBaseVar(), handleObst(), and newDataAvailable().
|
private |
index to variable with latest update time
Referenced by createBaseVar(), and handleObst().
|
private |
Obstacle update counter
Referenced by createBaseVar(), and handleObst().