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

#include <ufunctionpassable.h>

Inheritance diagram for UFunctionPassable:
Inheritance graph

Public Member Functions

virtual void createResources ()
 
virtual bool handleCommand (UServerInMsg *msg, void *extra)
 
bool handleObstGet (UServerInMsg *msg, void *extra)
 
bool handleRoad (UServerInMsg *msg, void *extra)
 
bool makePoly (int maxCnt, bool newestUpdatesOnly, bool andFixed)
 
bool polygonToPolyPlugin (UPolygon *poly, char *name, int coordinateSystem, char color)
 
virtual const char * print (const char *preString, char *buff, int buffCnt)
 
bool sendObstacles (UServerInMsg *msg, int maxCnt, bool updateOnly, bool andFixed)
 
bool sendRoadLines (UServerInMsg *msg, int upds, double qual, bool bestOnly)
 
virtual bool setResource (UResBase *resource, bool remove)
 
 UFunctionPassable ()
 
virtual ~UFunctionPassable ()
 
- 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)
 
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)
 
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 Attributes

ULaserPoollasPool
 
unsigned long lastSerial [MAX_LASER_DEVS]
 
UResObstacleobsts
 
bool obstsLocal
 
UResPoseHistodoHist
 
UResPassablepass
 
UResRoadLineroads
 
- 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

bool handlePass (UServerInMsg *msg, void *extra)
 
bool sendFullScan (UServerInMsg *msg, const char *tagName, ULaserDevice *sick, ULaserScan *scan)
 

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
 
- 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...
 
- 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

This plugin (or module) converts a laserscan to a set of passable intervals and obstacles, assuming that the laser is pointing down looking at the road at a distance of about 2.5-3 m. This class is the interface part of the module, the real work is done in the class UResPassable. The class also handles interface for obstacles and road data.

Author
Christian Andersen

Constructor & Destructor Documentation

UFunctionPassable::UFunctionPassable ( )
UFunctionPassable::~UFunctionPassable ( )
virtual

Destructor

References obsts, obstsLocal, pass, and roads.

Member Function Documentation

void UFunctionPassable::createResources ( )
virtual

Called by the server core. Should return the name of function. There should be a first short part separated by a space to some additional info (e.g. version and author). The returned name is intended as informative to clients and should include compile date or version number. Called by the server core when loaded, to get a list of keywords (commands) handled by this plugin. Return a list of handled functions in one string separated by a space. e.g. return "COG". The functions should be unique on the server. 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.

Reimplemented from UFunctionBase.

References UFunctionBase::addResource(), obsts, obstsLocal, pass, and roads.

bool UFunctionPassable::handleCommand ( UServerInMsg msg,
void *  extra 
)
virtual

This function is called by the server core, when it needs a resource provided by this plugin. Return a pointer to a resource with an ID taht matches this 'resID' ID string. The string match should be case sensitive. Returns false if the resource faled to be created (e.g. no memory space). return true if all ressources is available Handle incomming command (intended for command separation) Must return true if the function is handled - otherwise the client will get a failed - reply

Reimplemented from UFunctionBase.

References handleObstGet(), handlePass(), handleRoad(), USmlTagIn::isTagA(), UFunctionBase::sendDebug(), and UServerInMsg::tag.

bool UFunctionPassable::handleObstGet ( UServerInMsg msg,
void *  extra 
)
bool UFunctionPassable::handlePass ( UServerInMsg msg,
void *  extra 
)
private

Is road resource created locally Function to get closest distance

References bool2str(), UPose::clear(), UServerInMsg::client, USmlTag::codeLineSegment(), USmlTag::codePose(), USmlTag::codePosition(), USmlTag::codeRotation(), UResPassable::doFullAnalysis(), UResPassable::doObstAnalysis(), USmlTagIn::getAttValue(), ULaserPi::getCenter(), ULaserPi::getCenterValid(), ULaserPool::getDefDevice(), ULaserPool::getDefDeviceNumber(), ULaserPool::getDevice(), ULaserData::getDeviceNum(), ULaserDevice::getDevicePos(), ULaserDevice::getDevicePose(), ULaserDevice::getDeviceRot(), ULaserData::getFakePose(), ULaserPi::getFitVariance(), ULaserPi::getLeft(), UTime::getMicrosec(), ULaserDevice::getNewestData(), UResObstacle::getOutdoorExtraDist(), UResPassable::getPi(), UResPassable::getPisCnt(), UResPoseHist::getPoseAtTime(), ULaserScan::getQ(), ULaserPi::getRight(), ULaserScan::getRight(), ULaserScan::getRobotPose(), UResPassable::getScan(), ULaserData::getScanTime(), UTime::getSec(), ULaserPi::getSegment(), ULaserScan::getSerial(), ULaserData::getSerial(), USmlTagIn::getTagName(), ULaserPi::getVarMin2(), UResObstacle::isOutdoorContext(), ULaserData::isValid(), lasPool, lastSerial, obsts, odoHist, pass, roads, sendFullScan(), UFunctionBase::sendInfo(), UFunctionBase::sendMsg(), UFunctionBase::sendText(), UFunctionBase::sendWarning(), ULaserData::setFakePose(), ULaserScan::setQ(), str2bool(), UServerInMsg::tag, ULaserScan::time, UResObstacle::updateMappedObstacles(), and ULaserScan::valid.

Referenced by handleCommand().

bool UFunctionPassable::handleRoad ( UServerInMsg msg,
void *  extra 
)

Delete a polygon (sets cont to zero) - or a wildcard set of polygons.

Parameters
nameis name of polygon to delete, may hold multiple wildcards (* or ?) to match some or all polygons (regardless of origin.
Returns
true of poly plugin says OK Handle requests for road lines

References USmlTagIn::getNextAttribute(), lasPool, MAX_SML_NAME_LENGTH, UFunctionBase::sendInfo(), UFunctionBase::sendMsg(), sendRoadLines(), UFunctionBase::sendText(), UFunctionBase::sendWarning(), str2bool(), and UServerInMsg::tag.

Referenced by handleCommand().

bool UFunctionPassable::makePoly ( int  maxCnt,
bool  newestUpdatesOnly,
bool  andFixed 
)

Make obstacle (all) groups to polygon plug-in.

Parameters
maxCntis the number of obstacle groups that are to be polygon'ed (from newest group).
newestUpdatesOnlycopy polygons with most recent update timestamp only.
andFixedshould the group of fixed obstacles be added too.
Returns
true if polygon plugin resopnded positively.

References UObstaclePool::getFixeds(), UObstaclePool::getGroup(), UObstaclePool::getGroupsCnt(), UObstacleGroup::getObstacle(), UObstacleGroup::getObstsCnt(), UObstacle::getPoseLast(), UObstacleGroup::getPPoseLast(), mini(), obsts, polygonToPolyPlugin(), and UPoseTime::t.

Referenced by handleObstGet().

bool UFunctionPassable::polygonToPolyPlugin ( UPolygon poly,
char *  name,
int  coordinateSystem,
char  color 
)

send polygon to poly plugin - mainly for display in client

Parameters
polyis the polygin to send
nameis the name for the polygon in the poly plugin
coordinateSystem0=odo 1=utm 2=map
coloris the color character - like MATLAB r=red ....
Returns
true if successful (else poly pluging is not found)

References UResVarPool::callGlobalV(), UPolygon::color, UVariable::getBool(), UVariable::setDouble(), and UVariable::setValues().

Referenced by makePoly().

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

print status to a string buffer

Reimplemented from UResVarPool.

bool UFunctionPassable::sendFullScan ( UServerInMsg msg,
const char *  tagName,
ULaserDevice sick,
ULaserScan scan 
)
private
bool UFunctionPassable::sendObstacles ( UServerInMsg msg,
int  maxCnt,
bool  updateOnly,
bool  andFixed 
)

Send groups of obstacles to client. May send newly updated obstacles only when 'updatesOnly' is true.

Parameters
msgis reference to command
maxCntis maximum number of obstacle groups (from newest)
updateOnlysends only updated obstacles
andFixedsends (also) near fixed obstacles, as retreived from mapbase.
Returns
true if send.

References bool2str(), USmlTag::codeObstacle(), USmlTag::codePoseTime(), UObstaclePool::getFixeds(), UObstaclePool::getGroup(), UObstaclePool::getGroupsCnt(), UTime::getMicrosec(), UObstacleGroup::getObstacle(), UObstacleGroup::getObstsCnt(), UObstacleGroup::getPoseFirst(), UObstacleGroup::getPoseLast(), UObstacle::getPPoseLast(), UObstacleGroup::getPPoseLast(), UTime::getSec(), UObstacle::getSerial(), UObstacleGroup::getSerial(), USmlTagIn::getTagName(), mini(), obsts, UFunctionBase::sendMsg(), UPoseTime::t, and UServerInMsg::tag.

Referenced by handleObstGet().

bool UFunctionPassable::sendRoadLines ( UServerInMsg msg,
int  upds,
double  qual,
bool  bestOnly 
)
bool UFunctionPassable::setResource ( UResBase resource,
bool  remove 
)
virtual

List (space separated) of shared resources provided by this function. Must be an empty string if no resources are to be shared. Each resource ID must be no longer than 20 characters long. Called by the server core, when a new resource is available (or is removed), local pointers to the resource should be updated as appropriate.

Reimplemented from UFunctionBase.

References UResPoseHist::getOdoPoseID(), ULaserPool::getResClassID(), UResObstacle::getResClassID(), UResBase::isA(), lasPool, obsts, obstsLocal, odoHist, and UFunctionBase::setResource().

Member Data Documentation

ULaserPool* UFunctionPassable::lasPool
protected

Laser pool resource pointer (is not created from this class)

Referenced by handlePass(), handleRoad(), sendRoadLines(), setResource(), and UFunctionPassable().

unsigned long UFunctionPassable::lastSerial[MAX_LASER_DEVS]
protected

Is the resource created locally Last scan number from device N

Referenced by handlePass(), sendRoadLines(), and UFunctionPassable().

UResObstacle* UFunctionPassable::obsts
protected
bool UFunctionPassable::obstsLocal
protected

Is obstacle pool locally created

Referenced by createResources(), setResource(), UFunctionPassable(), and ~UFunctionPassable().

UResPoseHist* UFunctionPassable::odoHist
protected

Pose history resource pointer for odometry pose

Referenced by handleObstGet(), handlePass(), sendRoadLines(), setResource(), and UFunctionPassable().

UResPassable* UFunctionPassable::pass
protected

passable interval resource pointer

Referenced by createResources(), handlePass(), UFunctionPassable(), and ~UFunctionPassable().

UResRoadLine* UFunctionPassable::roads
protected

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