AURobotServers  4
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
UFuncEfLine Class Reference

ScanFeatures class converted to line extract. More...

#include <ufuncline.h>

Inheritance diagram for UFuncEfLine:
Inheritance graph

Public Member Functions

void createResources ()
 
virtual bool handleCommand (UServerInMsg *msg, void *extra)
 
 UFuncEfLine ()
 
virtual ~UFuncEfLine ()
 
- Public Member Functions inherited from UFuncPlugBase
 UFuncPlugBase ()
 
virtual ~UFuncPlugBase ()
 
- Public Member Functions inherited from UFunctionBase
bool addResource (UResBase *resource, UFunctionBase *owner)
 
void closeLogfile ()
 
virtual const char * commandList ()
 
const char * getAliasName ()
 
const char * getLoadedFileName ()
 
void * getLoadedModuleRef ()
 
virtual bool gotAllResources (char *missingThese, int missingTheseCnt)
 
bool isMine (const char *cmdName)
 
bool isStatic ()
 is the module loaded as static A module is static if the ldFilename has a length of zero. More...
 
virtual const char * name ()
 
bool newCmd (UServerInMsg *newMsg, UDataBase *extra)
 
bool newCommand (UServerInMsg *newMsg, void *extra)
 
bool openLogfile (const char *name)
 
void print (const char *preString)
 
virtual void resourceUpdated ()
 
bool sendEndTag (UServerInMsg *msg)
 
bool sendEndTag ()
 
bool sendFullTag (const char *attributes)
 
bool sendHelpDone (UServerInMsg *msg)
 
bool sendHelpDone ()
 
bool sendHelpStart (UServerInMsg *msg, const char *subject)
 
bool sendHelpStart (const char *subject)
 
bool sendHelpStart ()
 
bool sendMsg (UServerInMsg *msg, const char *message, int size)
 
bool sendMsg (const char *message)
 
bool sendMsg (UServerInMsg *msg, const char *message)
 
bool sendMsg (int clientIdx, const char *message, int size)
 
bool sendMsgInt (int clientIdx, const char *message)
 
bool sendStartTag (const char *attributes)
 
bool sendText (UServerInMsg *msg, const char *text)
 
bool sendText (const char *text)
 
virtual void setAliasName (const char *name)
 
virtual void setCommand (const char *cmdList, const char *name, const char *note)
 
void setLoadedModuleRef (void *module, const char *moduleFileName)
 
virtual void setLoadTime (UTime)
 
void setName (const char *name)
 
virtual bool setResource (UResBase *resource, bool remove)
 
void setVerbose (bool value)
 
 UFunctionBase ()
 
virtual ~UFunctionBase ()
 
- Public Member Functions inherited from UCallBack
bool addOnEvent (UOnEvent *dataObject)
 
virtual bool onEvent (const char *interface, const char *dataType, void *data)
 
 UCallBack ()
 
virtual ~UCallBack ()
 
- 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 ()
 
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)
 
void setVarPool (UVarCalc *sharedVarPool)
 
int updateQTvars (int structIdx)
 
 UResVarPool ()
 
virtual ~UResVarPool ()
 
- Public Member Functions inherited from UResBase
void createReplayVar (UVarPool *pool)
 
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 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 ()
 

Protected Member Functions

UPose getCurrentOdoPose (ULaserData *data)
 get the current pose of the robot at the time of the laser data The pose may be fake, and the fake pose is in the laser data structure too More...
 
ULaserDatagetScan (int device, ULaserDevice **las, ULaserData *pushData, bool getOnly, int fake)
 get a laserscan based on these parameters More...
 
bool sendAllLines (UServerInMsg *msg, ULaserDevice *las, ULaserData *data, bool getOnly)
 Process a request for all detected (wall-like) lines in the scan. More...
 
bool sendBoxLines (UServerInMsg *msg, ULaserDevice *las, ULaserData *data, bool getOnly)
 Process a request for (4) wall lines in the scan. More...
 
bool sendBoxPose (UServerInMsg *msg, ULaserDevice *las, ULaserData *data, bool getOnly)
 Process a request for the pose of the south-west corner of the box The reply is send as a special <laser l0="0.0" l1="1.0" .../> type tag. More...
 
bool sendRobotPoseAndSensorPosition (UServerInMsg *msg, ULaserDevice *las, ULaserData *data)
 send robot pose and sensor position (orientation) to client More...
 
- Protected Member Functions inherited from UFunctionBase
int getCmdIndex ()
 
UResBasegetStaticResource (const char *resName, bool mayCreate, bool staticOnly=true)
 get a pointer to a static resource. More...
 
bool isClientAlive (int clientIdx, double holdOffTime)
 
bool sendDebug (UServerInMsg *msg, const char *debugText)
 
bool sendDebug (const char *debugText)
 
bool sendError (UServerInMsg *msg, const char *errorText)
 
bool sendError (const char *errorText)
 
bool sendHelp (UServerInMsg *msg, const char *infoText)
 
bool sendHelp (const char *infoText)
 
bool sendInfo (UServerInMsg *msg, const char *infoText)
 
bool sendInfo (const char *infoText)
 
bool sendWarning (UServerInMsg *msg, const char *warningText)
 
bool sendWarning (const char *warningText)
 
UResBasesetThisResource (const char *ID, UResBase *resource, bool remove, bool *changed, UResBase *currentResPtr, bool *isLocal)
 
- 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

UResAuEfauef
 
int lastDevice
 
unsigned long lastSerial
 
- Protected Attributes inherited from UFunctionBase
char aliasName [MAX_ID_LENGTH]
 
UCmdExecmdHandler
 
char * cmdToks [20]
 
int cmdToksCnt
 
char commandsHandled [MAX_RESOURCE_LIST_SIZE]
 
UServerInMsgmsg
 
char pluginName [MAX_RESOURCE_LIST_SIZE]
 
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
 
UReplayreplayParent
 
UTime replayTimeNext
 

Private Member Functions

void closeLog ()
 
bool handleLine (UServerInMsg *msg, ULaserData *pushData)
 
void openLog (char *)
 

Private Attributes

ULaserData dataBuff
 
FILE * logFile
 

Additional Inherited Members

- Static Public Member Functions inherited from UResVarPool
static const char * getResClassID ()
 
- Public Attributes inherited from UFunctionBase
bool silent
 is reply to client and console to be limited More...
 
- Public Attributes inherited from UReplay
bool replayTimeAdvancePending
 
UTime replayTimeNow
 
- Static Public Attributes inherited from UFunctionBase
static const int MAX_ID_LENGTH = 30
 
static const int MAX_RESOURCE_LIST_SIZE = 250
 
- 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...
 

Detailed Description

ScanFeatures class converted to line extract.

Plugin for Ulmsserver with required functions.

Author
Aske Olsson
Lars Pontoppidan
Lars Mogensen
Christian Andersen (feb 2008)

Constructor & Destructor Documentation

UFuncEfLine::UFuncEfLine ( )

Constructor

References auef, lastDevice, lastSerial, and UFunctionBase::setCommand().

UFuncEfLine::~UFuncEfLine ( )
virtual

Destructor

References auef.

Member Function Documentation

void UFuncEfLine::closeLog ( )
private

Closes log file if open

void UFuncEfLine::createResources ( )
virtual

Called by server after this module is integrated into the server core structure, i.e. all core services are in place, but no commands are serviced for this module yet. Create any resources that this modules needs and add these to the resource pool to be integrated in the global variable pool and method sharing. Remember to add to resource pool by a call to addResource(UResBase * newResource, this). This module must also ensure that any resources creted are deleted (in the destructor of this class). Resource shut-down code should be handled in the resource destructor.

Reimplemented from UFunctionBase.

References UFunctionBase::addResource(), and auef.

UPose UFuncEfLine::getCurrentOdoPose ( ULaserData data)
protected

get the current pose of the robot at the time of the laser data The pose may be fake, and the fake pose is in the laser data structure too

Parameters
dataholds current laserscan, detection time and possibly a fake pose if the data is fake.
Returns
the current pose, or the zero pose if odometry resource is not available.

References UPose::clear(), ULaserData::getFakePose(), UResPoseHist::getPoseAtTime(), ULaserData::getScanTime(), UFunctionBase::getStaticResource(), and ULaserData::isFake().

Referenced by sendBoxLines(), sendBoxPose(), and sendRobotPoseAndSensorPosition().

ULaserData * UFuncEfLine::getScan ( int  device,
ULaserDevice **  las,
ULaserData pushData,
bool  getOnly,
int  fake 
)
protected

get a laserscan based on these parameters

Parameters
deviceuse this device of default if device is -1
las[out] returns a pointer to the used laser scanner
pushDatapoints to push data if such is available, else NULL
getOnlyif true, then the laser scanner device is returned only, and the returned scan is a pointer to a scan buffer (with old information from last time)
fakeif fake > 0 then the data produced is fake, generated from static data. Very usefull when testing without any real scanner (or simulator environment)
Returns
a pointer to a laserscan (never NULL)

References dataBuff, ULaserPool::getScan(), UFunctionBase::getStaticResource(), and scan.

Referenced by handleCommand().

bool UFuncEfLine::handleCommand ( UServerInMsg msg,
void *  extra 
)
virtual
bool UFuncEfLine::handleLine ( UServerInMsg msg,
ULaserData pushData 
)
private

Function to handle scanfeatures command

void UFuncEfLine::openLog ( char *  )
private

Opens log file, if not already open

bool UFuncEfLine::sendAllLines ( UServerInMsg msg,
ULaserDevice las,
ULaserData data,
bool  getOnly 
)
protected

Process a request for all detected (wall-like) lines in the scan.

Parameters
msgholds the client information
lasis a pointer to the laser device
datais a pointer to the current laserscan
getonlyis set to true, if no new processing is to take place, just get result of last processing.
Returns
true if full reply message is send.

References auef, UResAuEf::extractLock, UResAuEf::findFeatures(), UResAuEf::getLastUpdateTime(), UTime::getMilisec(), ULaserData::getScanTime(), UTime::GetSec(), USmlTagIn::getTagName(), UResAuEf::lines, UResAuEf::linesCnt, ULock::lock(), UFunctionBase::sendEndTag(), UFunctionBase::sendMsg(), sendRobotPoseAndSensorPosition(), UServerInMsg::tag, AU2DLineSeg::toXMLString(), ULock::unlock(), AU2DLineSeg::x, and AU2DLineSeg::y.

Referenced by handleCommand().

bool UFuncEfLine::sendBoxLines ( UServerInMsg msg,
ULaserDevice las,
ULaserData data,
bool  getOnly 
)
protected

Process a request for (4) wall lines in the scan.

Parameters
msgholds the client information
lasis a pointer to the laser device
datais a pointer to the current laserscan
getonlyis set to true, if no new processing is to take place, just get result of last processing.
Returns
true if full reply message is send.

References auef, UResAuEf::extractLock, UResAuEf::findFeatures(), getCurrentOdoPose(), UResAuEf::getLastUpdateTime(), UTime::getMilisec(), ULaserData::getScanTime(), UTime::GetSec(), USmlTagIn::getTagName(), UResAuEf::linesCnt, ULock::lock(), UFunctionBase::sendEndTag(), UFunctionBase::sendMsg(), sendRobotPoseAndSensorPosition(), UServerInMsg::tag, AU2DLineSeg::toXMLString(), ULock::unlock(), UResAuEf::updateWalls(), UResAuEf::wallsAge, and UResAuEf::wallSeg.

Referenced by handleCommand().

bool UFuncEfLine::sendBoxPose ( UServerInMsg msg,
ULaserDevice las,
ULaserData data,
bool  getOnly 
)
protected

Process a request for the pose of the south-west corner of the box The reply is send as a special <laser l0="0.0" l1="1.0" .../> type tag.

Parameters
msgholds the client information
lasis a pointer to the laser device
datais a pointer to the current laserscan
getonlyis set to true, if no new processing is to take place, just get result of last processing.
Returns
true if full reply message is send.

References auef, UResAuEf::boxEW, UResAuEf::boxNS, UResAuEf::boxPose, UResAuEf::extractLock, UResAuEf::findFeatures(), getCurrentOdoPose(), ULaserDevice::getDevicePose(), UResAuEf::getLastUpdateTime(), UPose::getPoseToMapPose(), ULaserData::getScanTime(), UPosRot::getX(), UPose::h, ULock::lock(), UFunctionBase::sendMsg(), ULock::unlock(), UResAuEf::updateWalls(), UPose::x, and UPose::y.

Referenced by handleCommand().

bool UFuncEfLine::sendRobotPoseAndSensorPosition ( UServerInMsg msg,
ULaserDevice las,
ULaserData data 
)
protected

send robot pose and sensor position (orientation) to client

Parameters
msgholds the client information
lasis a pointer to the laser device
datais a pointer to the current laserscan
Returns
true if the data could be send.

References USmlTag::codePose(), USmlTag::codePosition(), USmlTag::codeRotation(), getCurrentOdoPose(), ULaserDevice::getDevicePos(), ULaserDevice::getDeviceRot(), and UFunctionBase::sendMsg().

Referenced by sendAllLines(), and sendBoxLines().

Member Data Documentation

UResAuEf* UFuncEfLine::auef
protected

Pointer to a ExtractFeatures resource and resource handler flag

Referenced by createResources(), handleCommand(), sendAllLines(), sendBoxLines(), sendBoxPose(), UFuncEfLine(), and ~UFuncEfLine().

ULaserData UFuncEfLine::dataBuff
private

Data buffer for a laserscan, and information about the last used scan, i.e. serial number and device

Referenced by getScan().

int UFuncEfLine::lastDevice
protected

Last device used

Referenced by UFuncEfLine().

unsigned long UFuncEfLine::lastSerial
protected

Last used scan number

Referenced by UFuncEfLine().

FILE* UFuncEfLine::logFile
private

Log file handle, null if no file open


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