AURobotServers
4
|
#include <ulaserpool.h>
Public Member Functions | |
bool | addDevice (ULaserDevice *newDevice) |
ULaserDevice * | getDefDevice () |
int | getDefDeviceNumber () |
ULaserDevice * | getDevice (int deviceNumber) |
ULaserDevice * | getDevice (const char *deviceID) |
int | getDeviceCnt () |
int | getDeviceMax () |
int | getDeviceNumber (ULaserDevice *device) |
UPosRot * | getDevicePose (int idx) |
ULaserData * | getScan (const int device, ULaserDevice **las, ULaserData *dataBuff, ULaserData *pushData, const int fake) |
get the next scan from laser scanner device More... | |
ULaserData * | getScan (const char *device, ULaserDevice **las, ULaserData *dataBuff, ULaserData *pushData, const int fake) |
get the next scan from laser scanner device More... | |
bool | gotAllResources (char *missingThese, int missingTheseCnt) |
const char * | print (const char *preString, char *buff, int buffCnt) |
virtual void | replayAdvanceTime (UTime untilTime) |
virtual bool | replayToTime (UTime untilTime) |
void | setCmdExe (UCmdExe *server) |
void | setDefDevice (int value) |
bool | setDefDevice (const char *device) |
bool | setResource (UResBase *ress, bool remove) |
virtual void | stop (bool andWait) |
ULaserPool () | |
void | ULaserPoolInit () |
~ULaserPool () | |
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) |
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 () |
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 | 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) |
void | replaySetBaseFileName (const char *name, const char *preName="") |
void | replaySetFileName (const char *name) |
virtual bool | replayStep () |
int | replayStep (int steps) |
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 () |
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 | |
UCmdExe * | cmdExe |
ULaserDevice * | lasDevs [MAX_LASER_DEVS] |
int | lasDevsCnt |
struct { | |
UVariable * def | |
UVariable * deviceCnt | |
UVariable * devices | |
} | var |
variable pointers 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 |
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... | |
Pool of laserscanner devices
|
inline |
Constructor
References createBaseVar(), getResClassID(), UResVarPool::setDescription(), UResBase::setResID(), ULaserPoolInit(), and ~ULaserPool().
ULaserPool::~ULaserPool | ( | ) |
bool ULaserPool::addDevice | ( | ULaserDevice * | newDevice | ) |
Add device
References UResVarPool::addStruct(), cmdExe, ULaserDevice::createBaseVars(), ULaserDevice::getDeviceName(), ULaserDevice::getName(), lasDevs, lasDevsCnt, MAX_LASER_DEVS, UServerPush::setCmdExe(), ULaserDevice::setCore(), ULaserDevice::setDeviceNum(), ULaserDevice::setVarStructure(), and var.
Referenced by getDeviceCnt(), and UFunctionLaser::handleSetCommand().
|
protected |
Make the variables that will be available to other plugins
References UResVarPool::addVar(), and var.
Referenced by getDeviceMax(), and ULaserPool().
|
inline |
Get a device pointer
References getDevice(), getDeviceNumber(), and var.
Referenced by UResV360::getSourceData(), UFuncPpl::handleCommand(), UFunctionPassable::handlePass(), UFunctionLaser::handleScanGetCommand(), UFunctionLaser::handleScanPushCommand(), UFunctionLaser::handleSetCommand(), UResLocater::locate(), and UResV360::update().
|
inline |
Get defauylt device number
References getDevicePose(), gotAllResources(), print(), server, setCmdExe(), and var.
Referenced by getScan(), UFunctionPassable::handlePass(), UFunctionLaser::handleScanGetCommand(), and UFunctionPassable::sendRoadLines().
ULaserDevice * ULaserPool::getDevice | ( | int | deviceNumber | ) |
Get a device pointer
References lasDevs, and lasDevsCnt.
Referenced by getDefDevice(), getResClassID(), UFuncLaserBase::getScan(), getScan(), UResV360::getSourceData(), UFunctionPassable::handlePass(), UFunctionLaser::handleScanGetCommand(), UFunctionLaser::handleScanPushCommand(), UFunctionLaser::handleSetCommand(), replayToTime(), setDefDevice(), UResV360::setDefDevice(), and UResV360::update().
ULaserDevice * ULaserPool::getDevice | ( | const char * | deviceID | ) |
Get a device pointer from specification string
References ULaserDevice::getDeviceName(), ULaserDevice::getName(), lasDevs, lasDevsCnt, and MAX_LASER_DEVS.
|
inline |
Get number of created devices
References addDevice(), lasDevsCnt, and setDefDevice().
Referenced by UFunctionLaser::handleSetCommand().
|
inline |
Get maximum number of laser devices allowed in laser pool (a hard coded constant)
References createBaseVar(), getScan(), MAX_LASER_DEVS, replayAdvanceTime(), and replayToTime().
int ULaserPool::getDeviceNumber | ( | ULaserDevice * | device | ) |
Get device number from a device pointer. Returns -1 if device is not found.
References lasDevs, and lasDevsCnt.
Referenced by getDefDevice(), and getScan().
UPosRot* ULaserPool::getDevicePose | ( | int | idx | ) |
Get pose (3D) of the laser scanner sensor
Referenced by getDefDeviceNumber().
|
inlinestatic |
Fixed name of this resource type
References getDevice(), setResource(), and stop().
Referenced by UResV360::gotAllResources(), UFunctionLaser::setResource(), UResV360::setResource(), UFunctionPassable::setResource(), and ULaserPool().
ULaserData * ULaserPool::getScan | ( | const int | device, |
ULaserDevice ** | las, | ||
ULaserData * | dataBuff, | ||
ULaserData * | pushData, | ||
const int | fake | ||
) |
get the next scan from laser scanner device
device | if -1, then scan is from default device, else from the specified device |
las | returns a pointer to the laser scanner device used |
dataBuff | a data buffer that may be used for the laserscan if a buffer is not allocated already. The buffer is also used to hold information on last used scan (serial number and device) |
pushData | may hold a scan already, if so, then only the corresponding laser device is fetched (lo las). |
fake | if > 0 then a fake scan is fetched. 1=random range, 2,3,4 is measurements in a fake building with 4 rooms, with the robot moving through these rooms. |
References device, getDefDeviceNumber(), getDevice(), ULaserData::getDeviceNum(), UResV360::getLastDevice(), UResV360::getNewestData(), ULaserDevice::getNewestData(), ULaserData::getSerial(), UResBase::getStaticResource(), scan, ULaserData::setDeviceNum(), and ULaserData::setSerial().
Referenced by UFuncLaserBase::getDevice(), getDeviceMax(), UFuncLaserBase::getScan(), UFuncLobst::getScan(), UFuncEfLine::getScan(), and getScan().
ULaserData * ULaserPool::getScan | ( | const char * | device, |
ULaserDevice ** | las, | ||
ULaserData * | dataBuff, | ||
ULaserData * | pushData, | ||
const int | fake | ||
) |
get the next scan from laser scanner device
device | the device name or number as string, e.g. v360 or sick. "-1" or NULL or "" for default scanner. |
las | returns a pointer to the laser scanner device used |
dataBuff | a data buffer that may be used for the laserscan if a buffer is not allocated already. The buffer is also used to hold information on last used scan (serial number and device) |
pushData | may hold a scan already, if so, then only the corresponding laser device is fetched (lo las). |
fake | if > 0 then a fake scan is fetched. 1=random range, 2,3,4 is measurements in a fake building with 4 rooms, with the robot moving through these rooms. |
References getDevice(), getDeviceNumber(), and getScan().
|
virtual |
Is this resource missing any ressource pointers to function. Returns true if all is OK. If some is missing, then the missing resource name should be added to the missingThese list,
Reimplemented from UResVarPool.
References cmdExe, UCmdExe::getResClassID(), and UResBase::gotAllResources().
Referenced by getDefDeviceNumber().
|
virtual |
Print laser pool status to a string buffer
Reimplemented from UResVarPool.
References lasDevs, lasDevsCnt, and ULaserDevice::print().
Referenced by getDefDeviceNumber(), and UFunctionLaser::handleSetCommand().
|
virtual |
Advance replay for all devices in replay mode until just before this time The function sets a flag and the steps are performed in main command thread as soon as possible (before next user queue, and before push events)
Reimplemented from UReplay.
References UReplay::replayAdvanceTime(), and replayToTime().
Referenced by getDeviceMax(), and UFunctionLaser::handleSetCommand().
|
virtual |
Advance replay for this resources - if in replay mode - until just before this time
untilTime | advance with steps in logfile until this time is reached |
Reimplemented from UReplay.
References getDevice(), ULaserDevice::isReplayDevice(), lasDevsCnt, and UReplayDevice::replayToTime().
Referenced by getDeviceMax(), and replayAdvanceTime().
void ULaserPool::setCmdExe | ( | UCmdExe * | server | ) |
Set command server to be used by push commands. NB! devices must be loaded before this call. (or the call repeated).
References lasDevs, and lasDevsCnt.
Referenced by getDefDeviceNumber().
void ULaserPool::setDefDevice | ( | int | value | ) |
Set default device. If value is not inside valid range, then the closest valid device is selected.
References lasDevsCnt, maxi(), mini(), and var.
Referenced by getDeviceCnt(), UFunctionLaser::handleScanGetCommand(), and UFunctionLaser::handleSetCommand().
bool ULaserPool::setDefDevice | ( | const char * | device | ) |
Set default device to the lase device of the type (name) of 'device'. Returns true if such a name match is found
References device, getDevice(), ULaserDevice::getName(), lasDevsCnt, and var.
|
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. Set ressources as needed
Reimplemented from UResVarPool.
References cmdExe, UCmdExe::getResClassID(), UResBase::isA(), and UResBase::setResource().
Referenced by getResClassID().
|
virtual |
Stop any running subthread - we are going down
Reimplemented from UResBase.
References lasDevs, lasDevsCnt, and ULaserDevice::stop().
Referenced by getResClassID().
void ULaserPool::ULaserPoolInit | ( | ) |
Initialize laser pool
References cmdExe, lasDevs, lasDevsCnt, MAX_LASER_DEVS, UResBase::replay, and UFakeMap::varPool.
Referenced by ULaserPool().
|
protected |
Default device Pointer to server core
Referenced by addDevice(), gotAllResources(), setResource(), and ULaserPoolInit().
UVariable* ULaserPool::def |
UVariable* ULaserPool::deviceCnt |
UVariable* ULaserPool::devices |
|
protected |
Array of pointers to laser devices (already created
Referenced by addDevice(), getDevice(), getDeviceNumber(), print(), setCmdExe(), stop(), ULaserPoolInit(), and ~ULaserPool().
|
protected |
Count of available devices
Referenced by addDevice(), getDevice(), getDeviceCnt(), getDeviceNumber(), print(), replayToTime(), setCmdExe(), setDefDevice(), stop(), ULaserPoolInit(), and ~ULaserPool().
struct { ... } ULaserPool::var |
variable pointers
Referenced by addDevice(), createBaseVar(), getDefDevice(), getDefDeviceNumber(), and setDefDevice().