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

#include <uresroaddrive.h>

Inheritance diagram for UResRoadDrive:
Inheritance graph

Public Member Functions

double driveSide (const int refSide, const double refDist, int repeat)
 
bool findExitPose (int side, double sideDist, double forwardDist, UPose *exitPose)
 
UManSeqgetManLocked ()
 
virtual bool gotAllResources (char *missingThese, int missingTheseCnt)
 
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)
 
void setManUnlocked ()
 
bool setResource (UResBase *resource, bool remove)
 
 UResRoadDrive ()
 
virtual ~UResRoadDrive ()
 
- 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)
 
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)
 
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 bool methodCallV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct, int *returnStructCnt)
 
virtual ~UVarMethodImplement ()
 

Static Public Member Functions

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

Protected Member Functions

void createBaseVar ()
 
double driveRoad (const char *refSide, const double refDist)
 
double setTarget (const char *sideStr, double dist)
 
- 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

UTime lastObstUpdate
 
double lastRefDist
 
int lastRefSide
 
UTime lastRoadUpdate
 
UManSeqman
 
ULock manLock
 
UResPoseHistposeHist
 
UPoseV targetPose
 
UVariablevarEdge
 
UVariablevarEdgeDist
 
UVariablevarFailCnt
 
UVariablevarFwdDist
 
UResVarPoolvarGlobal
 
UVariablevarLoopCnt
 
UVariablevarTgtVel
 
UVariablevarTgtX
 
UVariablevarUpdateTime
 
- 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
 

Additional Inherited Members

- Public Attributes inherited from UReplay
bool replayTimeAdvancePending
 
UTime replayTimeNow
 
- 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 is the shared resource class. It must enherit from the resource base class (or one of its decendent) as shown.

Author
Christian Andersen

Constructor & Destructor Documentation

UResRoadDrive::UResRoadDrive ( )
inline
UResRoadDrive::~UResRoadDrive ( )
virtual

Destructor

References man, and ULock::unlock().

Referenced by UResRoadDrive().

Member Function Documentation

void UResRoadDrive::createBaseVar ( )
protected
double UResRoadDrive::driveRoad ( const char *  refSide,
const double  refDist 
)
protected

Drive along the road as possible, and try to maintain the specified distance from one of the road lines. The refSide is 'left', 'top' or 'right'.

References driveSide().

Referenced by methodCall(), and setManUnlocked().

double UResRoadDrive::driveSide ( const int  refSide,
const double  refDist,
int  repeat 
)
bool UResRoadDrive::findExitPose ( int  side,
double  sideDist,
double  forwardDist,
UPose exitPose 
)

Find xit pose relative to road lines in odometry coordinates. if side is >= 0 then try the distance relative to this side. Side is 0=left, 1=top, 2=right Exit pose should be 'sideDist' away from side line. Exit pose should be 'forwardDist' ahead of robot. Returns true if successful. may fail if no road is avaiable or call to road plugin failed.

References UResVarPool::callGlobal(), UResPoseHist::getNewest(), UPose::getPoseToMap(), ULine::getPositionOnLine(), UResVarPool::getVarPool(), ULine::getXYHeading(), UPose::h, poseHist, UPose::set(), UPosition::set(), UPosition::x, UPose::x, UPosition::y, and UPose::y.

Referenced by driveSide(), getResClassID(), UFunctionRoadDrive::handleCommand(), and setTarget().

UManSeq * UResRoadDrive::getManLocked ( )

Get latest used manouvre sequence in a locked state. When the pointer no longer needed a call must be made to 'setManUnlock()' to allow the roadDrive to continue fretching obstacle avoidance manoeuvres.

References ULock::lock(), man, and manLock.

Referenced by getResClassID(), and UFunctionRoadDrive::handleCommand().

static const char* UResRoadDrive::getResClassID ( )
inlinestatic

Fixed name of this resource type

References findExitPose(), getManLocked(), gotAllResources(), methodCall(), print(), and setResource().

Referenced by UResRoadDrive().

bool UResRoadDrive::gotAllResources ( char *  missingThese,
int  missingTheseCnt 
)
virtual

Is this resource missing any other resources to function optimally? Returns false if any is missing, and a list of the missong resources in the string.

Reimplemented from UResVarPool.

References UResPoseHist::getOdoPoseID(), UResBase::getResID(), UResBase::gotAllResources(), poseHist, and varGlobal.

Referenced by getResClassID().

bool UResRoadDrive::methodCall ( const char *  name,
const char *  paramOrder,
char **  strings,
const double *  doubles,
double *  value,
UDataBase **  returnStruct = NULL,
int *  returnStructCnt = NULL 
)
virtual

The varPool has methods, and a call to one of these are needed. Do the call now and return (a double sized) result in 'value' and return true if the method call is allowed.

Reimplemented from UResVarPool.

References driveRoad(), driveSide(), roundi(), and setTarget().

Referenced by getResClassID().

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

Fixed varsion number for this resource type. Should follow release version, i.e. version 1.28 gives number 128. Should be incremented only when there is change to this class definition, i.e new or changed functions or variables. print status to a string buffer

Reimplemented from UResVarPool.

Referenced by getResClassID().

void UResRoadDrive::setManUnlocked ( )
inline

Unlock the use of the manouvre pointer - must be unlocked as soon as possible to allow roadDrive to function

References createBaseVar(), dist, driveRoad(), driveSide(), manLock, setTarget(), and ULock::unlock().

Referenced by UFunctionRoadDrive::handleCommand().

bool UResRoadDrive::setResource ( UResBase resource,
bool  remove 
)
virtual

The server will offer a resource pointer by this call. If the resource is used, please return true.

Reimplemented from UResVarPool.

References UResPoseHist::getOdoPoseID(), UResBase::getResID(), UResBase::isA(), poseHist, UResVarPool::setResource(), and varGlobal.

Referenced by getResClassID().

double UResRoadDrive::setTarget ( const char *  sideStr,
double  dist 
)
protected

Member Data Documentation

UTime UResRoadDrive::lastObstUpdate
protected

Time of last update of obstacle interface

Referenced by driveSide().

double UResRoadDrive::lastRefDist
protected

Last reference distance

Referenced by driveSide().

int UResRoadDrive::lastRefSide
protected

Last reference side for road drive

Referenced by driveSide().

UTime UResRoadDrive::lastRoadUpdate
protected

Time of last update of road interface

Referenced by driveSide().

UManSeq* UResRoadDrive::man
protected

Last obtainge manouvre sequence obtained

Referenced by driveSide(), getManLocked(), UResRoadDrive(), and ~UResRoadDrive().

ULock UResRoadDrive::manLock
protected

Lock to be used during read of the found manoeuvre

Referenced by driveSide(), getManLocked(), and setManUnlocked().

UResPoseHist* UResRoadDrive::poseHist
protected

local variables provided by this resource. Link to road lines Pose history

Referenced by findExitPose(), gotAllResources(), setResource(), and UResRoadDrive().

UPoseV UResRoadDrive::targetPose
protected

The calculated (and used) target pose and velocity

UVariable* UResRoadDrive::varEdge
protected

index to used reference line (0=left, 1=center, 2=right)

Referenced by createBaseVar(), and driveSide().

UVariable* UResRoadDrive::varEdgeDist
protected

index to used reference line edge distance (positive is left)

Referenced by createBaseVar(), and driveSide().

UVariable* UResRoadDrive::varFailCnt
protected

index to used count of attempts to get a path, but failed, since lase success

Referenced by createBaseVar(), and driveSide().

UVariable* UResRoadDrive::varFwdDist
protected

index to used projection distance in front of robot

Referenced by createBaseVar(), and driveSide().

UResVarPool* UResRoadDrive::varGlobal
protected

Pose history

Referenced by gotAllResources(), setResource(), and UResRoadDrive().

UVariable* UResRoadDrive::varLoopCnt
protected

index to varPool variable loopCount

Referenced by createBaseVar(), and driveSide().

UVariable* UResRoadDrive::varTgtVel
protected

index to varPool variable targetPose Y index to varPool variable tarhet pose H index to varPool variable target velocity

Referenced by createBaseVar(), and driveSide().

UVariable* UResRoadDrive::varTgtX
protected

index to varPool variable target pose X

Referenced by createBaseVar(), and driveSide().

UVariable* UResRoadDrive::varUpdateTime
protected

index to latest update time (road drive calculation)

Referenced by createBaseVar(), and driveSide().


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