AURobotServers
4
|
#include <uresroaddrive.h>
Public Member Functions | |
double | driveSide (const int refSide, const double refDist, int repeat) |
bool | findExitPose (int side, double sideDist, double forwardDist, UPose *exitPose) |
UManSeq * | getManLocked () |
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) |
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 () |
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 () |
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 () |
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 | |
UResBase * | getStaticResource (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 |
UManSeq * | man |
ULock | manLock |
UResPoseHist * | poseHist |
UPoseV | targetPose |
UVariable * | varEdge |
UVariable * | varEdgeDist |
UVariable * | varFailCnt |
UVariable * | varFwdDist |
UResVarPool * | varGlobal |
UVariable * | varLoopCnt |
UVariable * | varTgtVel |
UVariable * | varTgtX |
UVariable * | varUpdateTime |
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 |
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... | |
This is the shared resource class. It must enherit from the resource base class (or one of its decendent) as shown.
|
inline |
Constructor
References createBaseVar(), UResVarPool::createVarSpace(), getResClassID(), man, poseHist, UResBase::setResID(), varGlobal, and ~UResRoadDrive().
|
virtual |
|
protected |
Create the smrif related variables
References UResVarPool::addMethod(), UResVarPool::addVar(), UResBase::getResVersion(), varEdge, varEdgeDist, varFailCnt, varFwdDist, varLoopCnt, varTgtVel, varTgtX, and varUpdateTime.
Referenced by setManUnlocked(), and UResRoadDrive().
|
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 | ||
) |
Drive along the road as possible, and try to maintain the specified distance from one of the road lines. The refSide is 0=left, 1=top, 2=right.
References UVariable::add(), UResVarPool::callGlobal(), findExitPose(), UResVarPool::getGlobalValue(), UVariable::getValued(), UResVarPool::getVarPool(), UPose::h, lastObstUpdate, lastRefDist, lastRefSide, lastRoadUpdate, ULock::lock(), man, manLock, UVariable::setDouble(), UVariable::setInt(), UVariable::setPose(), UTime::setTime(), ULock::unlock(), varEdge, varEdgeDist, varFailCnt, varFwdDist, varLoopCnt, varTgtVel, varTgtX, varUpdateTime, UPose::x, and UPose::y.
Referenced by driveRoad(), UFunctionRoadDrive::handleCommand(), methodCall(), and setManUnlocked().
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().
|
inlinestatic |
Fixed name of this resource type
References findExitPose(), getManLocked(), gotAllResources(), methodCall(), print(), and setResource().
Referenced by UResRoadDrive().
|
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().
|
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().
|
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().
|
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().
|
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().
|
protected |
Set target pose in varPool from these parameters
References UVariable::d, findExitPose(), UVarPool::getLocalValue(), UResVarPool::getVarPool(), UPoseV::getVel(), UPose::h, UVariable::i, UVarPool::setLocalVar(), UPose::x, and UPose::y.
Referenced by methodCall(), and setManUnlocked().
|
protected |
Time of last update of obstacle interface
Referenced by driveSide().
|
protected |
Last reference distance
Referenced by driveSide().
|
protected |
Last reference side for road drive
Referenced by driveSide().
|
protected |
Time of last update of road interface
Referenced by driveSide().
|
protected |
Last obtainge manouvre sequence obtained
Referenced by driveSide(), getManLocked(), UResRoadDrive(), and ~UResRoadDrive().
|
protected |
Lock to be used during read of the found manoeuvre
Referenced by driveSide(), getManLocked(), and setManUnlocked().
|
protected |
local variables provided by this resource. Link to road lines Pose history
Referenced by findExitPose(), gotAllResources(), setResource(), and UResRoadDrive().
|
protected |
The calculated (and used) target pose and velocity
|
protected |
index to used reference line (0=left, 1=center, 2=right)
Referenced by createBaseVar(), and driveSide().
|
protected |
index to used reference line edge distance (positive is left)
Referenced by createBaseVar(), and driveSide().
|
protected |
index to used count of attempts to get a path, but failed, since lase success
Referenced by createBaseVar(), and driveSide().
|
protected |
index to used projection distance in front of robot
Referenced by createBaseVar(), and driveSide().
|
protected |
Pose history
Referenced by gotAllResources(), setResource(), and UResRoadDrive().
|
protected |
index to varPool variable loopCount
Referenced by createBaseVar(), and driveSide().
|
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().
|
protected |
index to varPool variable target pose X
Referenced by createBaseVar(), and driveSide().
|
protected |
index to latest update time (road drive calculation)
Referenced by createBaseVar(), and driveSide().