AURobotServers
4
|
#include <uresbase.h>
Public Member Functions | |
void | createReplayVar (UVarPool *pool) |
virtual void | createResources () |
UCmdExe * | getCorePointer () |
char * | getLogFileName (char *fn, const int fnCnt) |
int | getResFuncIdx () |
const char * | getResID () |
int | getResVersion () |
virtual bool | gotAllResources (char *, int) |
bool | isA (const char *idStr) |
bool | isAlsoA (const char *id) |
virtual void | print (const char *preString) |
virtual const char * | print (const char *preString, char *buff, int buffCnt) |
virtual void | saveSettings () |
void | setCorePointer (UCmdExe *serverCore) |
void | setResFuncIdx (int idx) |
virtual void | setResID (const char *id, const int version) |
virtual bool | setResource (UResBase *, bool) |
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 () | |
Protected Member Functions | |
UResBase * | getStaticResource (const char *resName, bool mayCreate, bool staticOnly=true) |
get a pointer to a static resource. More... | |
Protected Attributes | |
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 |
Private Attributes | |
UCmdExe * | core |
max length of replay filename More... | |
struct { | |
UVariable * line | |
UVariable * replay | |
UVariable * time | |
} | var |
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... | |
Base class for a shared resource. Includes commen handling of replay.
UResBase::UResBase | ( | ) |
Constructor
References core, resID, resIsAlso, setResID(), and var.
|
virtual |
Destructor
References UReplay::replayFile.
void UResBase::createReplayVar | ( | UVarPool * | pool | ) |
Replay N singles from the logfile.
steps | number of steps to advance true if N steps were available in replay file. Set replay flag. If replay flag is changed to true, the logfile (odo.log) is attempted opened. If successfull, the current pose history is cleared and the first record read and implemented. If not successfull, the replay flag is set to true, and the pose history is cleared only. Returns true if replay file is opened Set new replay file name. If replay is in progress, then the old file is closed, before assigning the new name. |
name | is the new mane. Create local replay variables for status updates |
References UVarPool::addVar(), and var.
Referenced by UCamPool::createBaseVar(), and createResources().
|
inlinevirtual |
Create any resources that this modules needs This method is called after the resource is registred by the server.
Reimplemented in UFuncLaserBox, UFuncTOF, UResKeep, UFuncTOF, UResPoly, UFuncPTgrey, UFuncV4lGst, UFunctionBase, UResIfVar, UResPcp, UFunctionAvoid, UFunctionRoadDrive, UImagePool, UFuncKinect, UFuncEfLine, UFunctionSmrIf, UFunctionPassable, UFunctionLaserIfScan, UFuncRule, UFuncPcp, UFuncRhdIf, UFunctionDrivePos, UFuncPlan, UFuncGndAna, UFuncKeep, UFuncPiCam, UFuncPoly, UFuncBin, UFuncCron, UFuncLobst, UFuncMapObst, UFuncFile, UFunctionLocater, UFunctionIf, UFunctionGps, UFuncObj3d, UFuncRoseBot, UFunctionDisp, UFuncV360, UFunctionPoseHist, UFunctionVarPool, UFunctionCamGmk, UFunctionLaser, UFunctionImgPool, UFuncStereo, UFunctionCamBase, and UFuncImu.
References createReplayVar(), getStaticResource(), and updateReplayStatus().
Referenced by UCmdExe::addResource().
|
inline |
Get current pointer to core (UCmdExe)
References core.
Referenced by UResIfVar::handleVar(), and UResMapObst::sendMapLinesToLocalizer().
char * UResBase::getLogFileName | ( | char * | fn, |
const int | fnCnt | ||
) |
Advance replay for all resources 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) Replay one step in the logfile.
untilTime | advance with steps in logfile until this time is reached |
line | is a pointer to the line. |
fn | buffer for destination filename |
fnCnt | is the length of the provided buffer Returns pointer to fn[] string. Get the full logfile name. This is the data path followed by the resource name and the '.log' extension |
fn | buffer for destination filename |
fnCnt | is the length of the provided buffer Returns pointer to fn[] string. |
References dataPath, and resID.
Referenced by stop().
|
inline |
Get the function index of the owner of this resource
References resFuncIdx.
Referenced by UResPool::getResFunc(), UCmdExe::getStaticResource(), UCmdExe::isResourceOwner(), and UResPool::removeResourceFunc().
|
inline |
Get resource ID
References resID.
Referenced by UCmdExe::addResource(), UFunctionBase::addResource(), UFunctionGps::createResources(), UFuncBin::createResources(), UCmdExe::deleteFunction(), UResRoadDrive::gotAllResources(), UResDrivePos::gotAllResources(), UFuncRule::listAllMissions(), UResV360::print(), UResPool::print(), UFunctionBase::setAliasName(), UFunctionVarPool::setResource(), UFuncView::setResource(), UResRoadDrive::setResource(), UResDrivePos::setResource(), UResDisp::setResource(), UFunctionBase::setThisResource(), UCamPool::UCamPoolInit(), UPaintPoseHist::UPaintPoseHist(), and UResVarPool::UResVarPool().
|
inline |
Get version number for this resource
References isA(), print(), and resVersion.
Referenced by UResObstacle::addObstacleParameters(), UResPassable::addPassableIntervalParameters(), UResLaserIfObst::createBaseVar(), UResCamIf::createBaseVar(), UResLaserIfSf::createBaseVar(), UResSmrCtl::createBaseVar(), UResLaserIf::createBaseVar(), UResLaserIfScan::createBaseVar(), UResDrivePos::createBaseVar(), UResRoadDrive::createBaseVar(), UCmdExe::createBaseVar(), UFuncRule::listAllMissions(), UResAuEf::print(), UResPool::print(), UResPoseHist::setResID(), UResVarPool::setResource(), UCamPool::UCamPoolInit(), UImagePool::UImagePoolInit(), UResCamIfCam::UResCamIfCam(), UResDrivePos::UResDrivePos(), UResLaserIfScan::UResLaserIfScan(), and UResLocater::UResLocater().
|
protected |
get a pointer to a static resource.
resName | The name of the resource to be acquired. |
mayCreate | if set to true, then the resource will be created if it do not exist already. |
staticOnly | if true only a static resource is returned. Should realy only be used for non-static resources if inside the same plugin. |
References core, and UCmdExe::getStaticResource().
Referenced by UResAvoid::copyAvoidObstacles(), UResAvoid::copyCellPolys(), UResAvoid::copyFootprintPolys(), createResources(), UCamPool::decodeReplayLine(), UResPassable::doObstAnalysis(), UResMapObst::getNearObstacles(), ULaserPool::getScan(), UResLocater::locate(), UResLobst::methodCallV(), UResLocater::polygonToPolyPlugin(), UResLobst::sendAsObstacles(), UResMapObst::sendMapLinesToLocalizer(), UResLocater::set_poselast(), UResLocater::set_state(), UResLocater::set_utmstate(), UImagePool::setLogImg(), UResLocater::setUtmPoseToMapPose(), UQtgui::updateImg(), UResObstacle::updateMappedObstacles(), and UQtgui::updateVar().
|
inlinevirtual |
Test if all needed resources are loaded. 'missingThese is a buffer where missing resources should be written. 'missingTheseCnt' isthe buffer size not to be resexceeded. Should return true if all resources are available.
Reimplemented in UFunctionBase, UResNavIfMan, UCamPool, UResVarPool, UResDisp, UResLaserIfRoad, ULaserPool, UImagePool, UResLaserIfScan, UResDrivePos, UResRoadDrive, UResCamIf, UResPoseHist, UResCamIfImg, and UResV360.
References isAlsoA().
Referenced by UResPoseHist::gotAllResources(), UResRoadDrive::gotAllResources(), UResDrivePos::gotAllResources(), ULaserPool::gotAllResources(), UResLaserIfRoad::gotAllResources(), and UResVarPool::gotAllResources().
bool UResBase::isA | ( | const char * | idStr | ) |
Tests if this resource matches the provided name
References resID.
Referenced by UResPool::getResource(), getResVersion(), UFuncKinect::makeObj3Dcloud(), UResSmrCtl::methodCall(), UResObstacle::methodCallV(), UResMapObst::methodCallV(), UResLobst::methodCallV(), UResAvoid::methodCallV(), UResPool::print(), UResPoseHist::setPoseResult(), UFunctionLaser::setResource(), UFunctionCamBase::setResource(), UResLink::setResource(), UFunctionImgBase::setResource(), UFunctionVarPool::setResource(), UFunctionPoseHist::setResource(), UResV360::setResource(), UResLaserIfSf::setResource(), UFuncLoca2::setResource(), UNavPaint::setResource(), ULaserPool::setResource(), UResSmrCtl::setResource(), UFuncView::setResource(), UResPoseHist::setResource(), UFunctionBase::setResource(), UResCamIfImg::setResource(), UResAvoid::setResource(), UResRoadDrive::setResource(), UFunctionPassable::setResource(), UResDrivePos::setResource(), UResIfVar::setResource(), UResLaserIfScan::setResource(), UImagePool::setResource(), UFuncLocalize::setResource(), UResSmrIf::setResource(), UResDisp::setResource(), UCamPool::setResource(), UNavView::setResource(), UResGps::setResource(), UServerPush::setResource(), UFuncLaserBox::setResource(), and UResRuleState::setResource().
bool UResBase::isAlsoA | ( | const char * | id | ) |
Test if this object has inherited from a ressource with this ID
References inThisStringList(), and resIsAlso.
Referenced by gotAllResources(), UFunctionVarPool::setResource(), UResIf::setResource(), UResCamIf::setResource(), UResLaserIf::setResource(), UResSmrIf::setResource(), UServerPort::setResource(), and UServerPush::setResource().
|
virtual |
Print the (short) status of resource
Reimplemented in UFunctionBase, UCmdExe, and UCamPool.
Referenced by getResVersion(), and UResPool::print().
|
virtual |
Print the (short) status of resource - to a string buffer
Reimplemented in UResRuleState, UResGps, UResObj3d, UResKeep, UResPoseHist, UResNavIfMan, UResRule, UResPoly, UResDisp, UPoseHistNotUsed, UResCron, UResLaserIfRoad, ULaserPool, UResIfVar, UCamPool, UFunctionAvoid, UFunctionRoadDrive, UFunctionPassable, UImagePool, UFunctionIf, UFunctionLaserIfData, UFunctionLaserIfScan, UResSmrIf, UFunctionDrivePos, UResLaserIfScan, UResPcp, UResRoadLine, UFunctionSmrIf, UResDrivePos, UFuncRule, UResLaserIf, UResRoadDrive, UResV360, UResCamIf, UResAuEf, UResAvoid, UFunctionLocater, UResCamIfImg, UResPassable, UResLaserIfObst, UResVarPool, UResSmrCtl, UResCamIfGmk, UResObstacle, UResCamIfPath, UResCamIfCam, UResIf, and UResMapObst.
|
inlinevirtual |
Save settings for this resource as needed This is called after the stop call, so all action should be stopped at this call. but all modules are still loaded.
Reimplemented in UCamPool.
References setResID().
Referenced by UResPool::saveSettings().
|
inline |
Set pointer to core (UCmdExe)
References core.
Referenced by UCmdExe::addResource(), and UCmdExe::UCmdExeInit().
|
inline |
Set reference index to function owning the resource. This is called by server core and should not be changed.
References resFuncIdx.
Referenced by UCmdExe::addResource().
|
virtual |
Function to set a resource ID, this should NOT be called after the resource is known to the server.
[in] | *id | is the new name (possibly an alias) for this version of the resource |
Reimplemented in UResPoseHist.
References MAX_RESOURCE_ID_LENGTH, MAX_RESOURCE_ISALSO_LENGTH, UReplay::REPLAY_FILE_NAME_LENGTH, UReplay::replayFileName, resID, resIsAlso, and resVersion.
Referenced by UFunctionGps::createResources(), UFuncBin::createResources(), saveSettings(), UFunctionBase::setCommand(), UResPoseHist::setResID(), UCamPool::UCamPool(), UCamPool::UCamPoolInit(), UCmdExe::UCmdExe(), UFunctionBase::UFunctionBase(), UImagePool::UImagePool(), ULaserPool::ULaserPool(), UPoseHistNotUsed::UPoseHistNotUsed(), UResAuEf::UResAuEf(), UResAvoid::UResAvoid(), UResBase(), UResBin::UResBin(), UResCamIf::UResCamIf(), UResCamIfCam::UResCamIfCam(), UResCamIfGmk::UResCamIfGmk(), UResCamIfImg::UResCamIfImg(), UResCamIfPath::UResCamIfPath(), UResDrivePos::UResDrivePos(), UResDummy::UResDummy(), UResIf::UResIf(), UResIfBase::UResIfBase(), UResIfVar::UResIfVar(), UResLaserIf::UResLaserIf(), UResLaserIfObst::UResLaserIfObst(), UResLaserIfScan::UResLaserIfScan(), UResLaserIfSf::UResLaserIfSf(), UResLobst::UResLobst(), UResLocater::UResLocater(), UResMapObst::UResMapObst(), UResObstacle::UResObstacle(), UResPassable::UResPassable(), UResPcp::UResPcp(), UResRhdIf::UResRhdIf(), UResRoadDrive::UResRoadDrive(), UResRoadLine::UResRoadLine(), UResRoseBot::UResRoseBot(), UResSmrCtl::UResSmrCtl(), UResV360::UResV360(), and UResVarPool::UResVarPool().
|
inlinevirtual |
Called when resource situation has changed. No resources are needed here.
Reimplemented in UResRuleState, UFuncLaserBox, UResGps, UResNavIfMan, UCamPool, UResVarPool, UResDisp, UResLaserIfRoad, UResSmrIf, UFuncLocalize, UImagePool, UResLaserIfScan, UResIfVar, UResLaserIf, UResCamIf, UResDrivePos, UFunctionPassable, UResRoadDrive, UResAvoid, UFunctionBase, UResCamIfImg, UResPoseHist, UFunctionLaserIfData, UFunctionLaserIfScan, UFuncView, UResSmrCtl, ULaserPool, UFuncLoca2, UResIf, UResLaserIfSf, UResV360, UFunctionPoseHist, UFuncPlugBasePush, UFunctionCamData, UFunctionImgBase, UFunctionVarPool, UFunctionCamBase, and UFunctionLaser.
Referenced by UCmdExe::deleteFunction(), UCmdExe::resourcesUpdated(), ULaserPool::setResource(), UResDisp::setResource(), and UResVarPool::setResource().
|
inlinevirtual |
Stop any running subthread - we are going down
Reimplemented in UResRuleState, UResKeep, UFuncTOF, UFuncV4lGst, UFuncTOF, UCmdExe, UResCron, UFuncRadar, UResDisp, UFuncKinect, UFuncPTgrey, UResRhdIf, UFuncPiCam, UResSmrCtl, ULaserPool, UFuncView, and UFuncImu.
References getLogFileName().
Referenced by UResPool::stop(), UResDummy::~UResDummy(), and UResMapObst::~UResMapObst().
|
virtual |
If replay status is maintained in global vars, then it is time to update
Reimplemented from UReplay.
Reimplemented in UImagePool, and UFuncKinect.
References UReplay::isReplay(), UReplay::replayFile, UReplay::replayLogLine, UReplay::replayTimeNow, and var.
Referenced by createResources().
|
private |
max length of replay filename
Is the resource in replay mode - this may trigger an update to time call Next Replay time available in logfile Replay file handlereplay filename Maximum length of a line in the logfile Buffer for latest line (but not used) line from logfile Current line number in logfile replay to time needs an update - set by the replay advance time call and reset by main command thread when serviced. Current replay time, and the time that should be advanced to by all other replaying devices Pointer to server core (UCmdExe), to access static resources
Referenced by getCorePointer(), getStaticResource(), setCorePointer(), and UResBase().
UVariable* UResBase::line |
Referenced by UResLobst::codeLines(), UFuncKinect::decodeReplayLine(), UImagePool::decodeReplayLine(), UCamPool::decodeReplayLine(), UCmdExe::executeScriptFile(), UCamPool::getImagelogFilename(), UResMapObst::getNearObstacles(), UResSmrCtl::getSMRCLDrive2cmd(), UFuncCropRow::handleCommand(), UFuncLocalize::handleLocalize(), UFuncLocalize::handleLocalizeMHF(), UFuncLocalize::handleLocalizeUKF(), UFuncLinefinder::houghTest(), UFuncTracking::loadFileList(), UFuncLoca2::markBestJointMatches(), UFunctionVarPool::sendDescription(), UResMapObst::sendMapLinesToLocalizer(), UImagePool::showImagesAsDefault(), and UFuncKinect::UFuncKinect().
UVariable* UResBase::replay |
Referenced by UResPoseHist::addIfNeeded(), UFunctionCam::handleCamSetCommand(), UFunctionPoseHist::handlePoseHistCommand(), UFunctionLaser::handleSetCommand(), UResPoseHist::replayStep(), UResIf::replayToTime(), UResIf::setReplay(), UResPoseHist::setReplay(), ULaserPool::ULaserPoolInit(), and UResPoseHist::UResPoseHist().
|
protected |
Index to function owner of resource
Referenced by getResFuncIdx(), setResFuncIdx(), and UCmdExe::UCmdExeInit().
|
protected |
Name of resource (identification)
Referenced by getLogFileName(), getResID(), isA(), setResID(), UCmdExe::sysModuleCmd(), and UResBase().
|
protected |
Name of resource (identification)
Referenced by isAlsoA(), setResID(), and UResBase().
|
protected |
Resource version number. This number may be used for a compliance test.
Referenced by getResVersion(), setResID(), UCamPool::UCamPoolInit(), UImagePool::UImagePoolInit(), UPoseHistNotUsed::UPoseHistNotUsed(), UResCamIfCam::UResCamIfCam(), UResDrivePos::UResDrivePos(), UResLaserIfScan::UResLaserIfScan(), and UResLocater::UResLocater().
UVariable* UResBase::time |
Referenced by UResPoseHist::getMapPoseID(), and UFuncPpl::handleCommand().
struct { ... } UResBase::var |
Local variables for replay status
Referenced by createReplayVar(), UFuncTracking::FirstImage(), UFunctionCamGmk::handleGmkGetCommand(), UResIfVar::handleVar(), UFunctionVarPool::handleVarValues(), UFunctionVarPool::initCallReturnStructType(), UFuncBallKL::maskColors(), UFuncPiPi::maskColors(), UFuncBall::maskColors(), UFuncBall_improved::maskColors(), UFuncLinefinder::maskColors(), UResMapObst::methodCallV(), UFuncTracking::TrackObjects(), UResVarPool::updateQTvars(), updateReplayStatus(), and UResBase().