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

#include <uresv360.h>

Inheritance diagram for UResV360:
Inheritance graph

Public Member Functions

virtual void callGotNewDataWithObject ()
 
int getDefDevice ()
 
UPose getLaserPose ()
 
ULaserDevicegetLastDevice ()
 
int getMeasurementCnt ()
 
bool getNewestData (ULaserData *laserData, int last, int fake)
 
int getSectorCnt ()
 
bool gotAllResources (char *missingThese, int missingTheseCnt)
 
const char * print (const char *preString, char *buff, int buffCnt)
 
int setDefDevice (const char *devString)
 
void setLaserPose (UPose newLaserPose)
 
bool setResource (UResBase *resource, bool remove)
 
bool update (ULaserData *laserData, ULaserDevice *laserDevice, int fake)
 
 UResV360 ()
 
 ~UResV360 ()
 
- 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)
 
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 ()
 
- Public Member Functions inherited from UServerPush
int addPushCommand (UServerInMsg *msg)
 
bool doPushCall (UServerPushElement *pe, const char *value)
 
void flushClientCmds (int clientIdx)
 
UServerPushImplementgetImplementor ()
 
int getPushCmdCnt (int *cmdCnt, int *callCnt)
 
UServerPushQueuegetPushQueue ()
 
bool gotCmdExe ()
 
void gotNewData (void *pData)
 
bool isUpdated (int lastCnt, int *newCnt)
 
bool needNewData ()
 
void print (const char *preString)
 
void print (const char *preString, char *buff, int buffCnt)
 
void servicePendingPushCmds ()
 
void setCmdExe (UServerPushImplement *executor)
 
void setImplementor (UServerPushImplement *executor)
 
bool setResource (UResBase *resource, bool remove)
 
bool setUpdated (const char *value)
 Add watch object if needed. An image or other object is updated. set object as updated, with an extra qualifier, that may be used as a parameter in a push call. this push list is then added to the to the push list examined by the server thread. when server thread reach this push list it will call to get a possible associated data structure by a call to needNewData() whish is expected to call gotNewData(void * data_structure) - but now in the server thread. More...
 
 UServerPush ()
 
virtual ~UServerPush ()
 

Static Public Member Functions

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

Protected Member Functions

void createBaseVar ()
 
bool getSourceData (ULaserData *laserData, int last, int fake)
 
- 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

int defDevice
 
int fakeTargetState
 
ULaserDevicelasDev
 
ULaserPoollasPool
 
UResPoseHistposeHist
 
ULaserData pushData
 
ULaserData sourceData
 
UV360Scanv360
 
struct {
   UVariable *   lastSerial
 last scan number used to update More...
 
   UVariable *   notValidArea
 area where self-detect should be suppressed. More...
 
   UVariable *   resolution
 virtual scan resolution (in degrees) More...
 
   UVariable *   updateCnt
 number of updates of virtual scanner More...
 
   UVariable *   updateTime
 timestamp of last update More...
 
var
 pointers to local variables in the global variables database More...
 
- 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

Ressource for virtual laserscanner with 360 deg coverage

Author
Christian Andersen

Constructor & Destructor Documentation

UResV360::UResV360 ( )
inline
UResV360::~UResV360 ( )

Destructor

References v360.

Referenced by UResV360().

Member Function Documentation

void UResV360::callGotNewDataWithObject ( )
virtual

Called by cmdExe to get push object followed by a call to 'gotNewData(object)'. Should be overwritten by push object holder.

Reimplemented from UServerPush.

References ULaserData::getDeviceNum(), UV360Scan::getScan(), UServerPush::gotNewData(), ULock::lock(), pushData, ULaserData::setDeviceNum(), sourceData, ULock::unlock(), and v360.

Referenced by getLastDevice().

void UResV360::createBaseVar ( )
protected

Make the variables that will be available to other plugins

References UResVarPool::addVar(), and var.

Referenced by getLastDevice(), and UResV360().

int UResV360::getDefDevice ( )
inline

GEt the default device number for laser scanner source

References defDevice.

Referenced by UFuncV360::handleV360Command().

UPose UResV360::getLaserPose ( )

Get current setting of laser scanner position on robot

References UV360Scan::getLaserPose(), and v360.

Referenced by getResClassID(), and UFuncV360::handleV360Command().

ULaserDevice* UResV360::getLastDevice ( )
inline

Get the last used device for laser scanner source

References callGotNewDataWithObject(), createBaseVar(), getSourceData(), lasDev, and setDefDevice().

Referenced by ULaserPool::getScan().

int UResV360::getMeasurementCnt ( )
inline

Get number of stored measurements in a scan

References UV360Scan::getSectorCnt(), ULock::lock(), ULock::unlock(), update(), and v360.

bool UResV360::getNewestData ( ULaserData laserData,
int  last,
int  fake 
)

Get newest virtual scan with a source serial number grater than 'last'

Parameters
laserDatais where the result is to be placed.
lastis the scannumber of the last scan, newest scannumber has to be bigger that this,
fakeif > 0 then scan is generated from fake source.
Returns
true if a v360 scan is available

References UV360Scan::getScan(), UV360Scan::getScanSerial(), gotAllResources(), ULock::lock(), ULock::unlock(), update(), and v360.

Referenced by getResClassID(), UFuncLaserBase::getScan(), ULaserPool::getScan(), and UFunctionLaser::handleScanGetCommand().

static const char* UResV360::getResClassID ( )
inlinestatic

Fixed name of this resource type

References getLaserPose(), getNewestData(), gotAllResources(), print(), setLaserPose(), and setResource().

Referenced by UFunctionLaser::setResource(), and UResV360().

int UResV360::getSectorCnt ( )
inline

Get number of sectors each scan

References UV360Scan::getSectorCnt(), and v360.

bool UResV360::getSourceData ( ULaserData laserData,
int  last,
int  fake 
)
protected

Get fresh source from default device. The data serial number must be newer than 'last' to avoid reuse of same dataset. Data is returned into the user provided buffer 'laserData'. The function returns true if data is in buffer (and is valid).

References defDevice, ULaserPool::getDefDevice(), ULaserPool::getDevice(), ULaserDevice::getNewestData(), lasPool, and sourceData.

Referenced by getLastDevice().

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

Checks if needed ressources are available

Reimplemented from UResVarPool.

References UResPoseHist::getOdoPoseID(), ULaserPool::getResClassID(), lasPool, and poseHist.

Referenced by getNewestData(), getResClassID(), and update().

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

Print status to string preceding the string with this 'preString'. The target string is 'buff' with a maximum length of 'buffCnt'.

Reimplemented from UResVarPool.

References UV360Scan::getCurrentPose(), UV360Scan::getMeasurementCnt(), UResBase::getResID(), UV360Scan::getScanSerial(), UV360Scan::getSectorCnt(), UPose::h, v360, UPose::x, and UPose::y.

Referenced by getResClassID().

int UResV360::setDefDevice ( const char *  devString)

Set the default device number for laser scanner source

References defDevice, ULaserPool::getDevice(), ULaserDevice::getDeviceNum(), and lasPool.

Referenced by getLastDevice(), and UFuncV360::handleV360Command().

void UResV360::setLaserPose ( UPose  newLaserPose)

Set current setting of laser scanner position on robot

References UV360Scan::setLaserPose(), and v360.

Referenced by getResClassID(), and UFuncV360::handleV360Command().

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

Set Resource is called by the core on change of ressource configuration (added or removed). The function should return true if ressource is used (the link is used)

Reimplemented from UResVarPool.

References UResPoseHist::getOdoPoseID(), ULaserPool::getResClassID(), UResBase::isA(), lasPool, ULock::lock(), poseHist, UServerPush::setResource(), and ULock::unlock().

Referenced by getResClassID().

bool UResV360::update ( ULaserData laserData,
ULaserDevice laserDevice,
int  fake 
)

Update the virtual laserscan with this laserdata, or get a new from this device

Parameters
laserDatais a pointer to scandata - NULL if new data is to be obtained
laserDeviceis a pointer to the laserdevice, from where to obtain data, NULL will use default device (may not be V360).
fakeis a fake number - if > 0, then this is used to obtain data.
Returns
true if updated

References defDevice, UTime::GetDecSec(), ULaserPool::getDefDevice(), ULaserPool::getDevice(), ULaserData::getDeviceNum(), ULaserDevice::getDevicePose(), ULaserData::getFakePose(), ULaserDevice::getNewestData(), UResPoseHist::getPoseAtTime(), UV360Scan::getResolution(), ULaserData::getScanTime(), ULaserData::getSerial(), gotAllResources(), ULaserData::isValid(), URotation::Kappa, lasDev, lasPool, ULock::lock(), poseHist, UPose::set(), ULaserData::setDeviceNum(), UV360Scan::setLaserPose(), UPoseTime::setPt(), UServerPush::setUpdated(), sourceData, ULock::unlock(), UV360Scan::update(), v360, var, U2Dpos::x, UPosition::x, U2Dpos::y, and UPosition::y.

Referenced by getMeasurementCnt(), getNewestData(), UFuncLaserBase::getScan(), UFunctionLaser::handleScanGetCommand(), and UFuncV360::handleV360Command().

Member Data Documentation

int UResV360::defDevice
protected

Default laserscanner source device

Referenced by getDefDevice(), getSourceData(), setDefDevice(), update(), and UResV360().

int UResV360::fakeTargetState
protected

Fake pose target state

Referenced by UResV360().

ULaserDevice* UResV360::lasDev
protected

last used laser device

Referenced by getLastDevice(), update(), and UResV360().

ULaserPool* UResV360::lasPool
protected

Pointer to laser scanner pool

Referenced by getSourceData(), gotAllResources(), setDefDevice(), setResource(), update(), and UResV360().

UVariable* UResV360::lastSerial

last scan number used to update

UVariable* UResV360::notValidArea

area where self-detect should be suppressed.

UResPoseHist* UResV360::poseHist
protected

Pointer to pose history ressource

Referenced by gotAllResources(), setResource(), update(), and UResV360().

ULaserData UResV360::pushData
protected

data buffer used during a push call

Referenced by callGotNewDataWithObject().

UVariable* UResV360::resolution

virtual scan resolution (in degrees)

ULaserData UResV360::sourceData
protected

Laser measurement data buffer Laser source laser measurement data buffer

Referenced by callGotNewDataWithObject(), getSourceData(), and update().

UVariable* UResV360::updateCnt

number of updates of virtual scanner

UVariable* UResV360::updateTime

timestamp of last update

UV360Scan* UResV360::v360
protected
struct { ... } UResV360::var

pointers to local variables in the global variables database

Referenced by createBaseVar(), and update().


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