AURobotServers
4
|
#include <ucampool.h>
Public Member Functions | |
void | closeImageLogging () |
bool | findDevices () |
void | flushClientCmds (int clientIdx) |
UCamPush * | getCam (int device) |
UCamPush * | getCam (const char *posName) |
UCamPush * | getCamByPoolIndex (int index) |
int | getDeviceCount () |
int | getFirstCamDevice () |
const char * | getImagelogFilename () |
bool | gotAllResources (char *missingThese, int missingTheseCnt) |
bool | isImagelogOpen () |
bool | isLogPng () |
bool | isLogSaveImg () |
UCamPush * | makeDevice (int devNum, const char *posName) |
bool | openImageLogging (const char *name) |
bool | openImageLogging () |
virtual void | print (const char *preString) |
virtual const char * | print (const char *preString, char *buff, int buffCnt) |
bool | saveSettings (Uconfig *ini) |
virtual void | saveSettings () |
void | setCmdExe (UCmdExe *executor) |
void | setLogPng (bool value) |
void | setLogSaveImg (bool value) |
bool | setResource (UResBase *resource, bool remove) |
void | setVerbose (bool value) |
UCamPool () | |
void | UCamPoolInit () |
virtual | ~UCamPool () |
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) |
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) |
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 () |
virtual bool | decodeReplayLine (char *line) |
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 | |
UImageLog * | imageLog |
UVariable * | varCams |
camera devices More... | |
UVariable * | varCamsCnt |
number of camera devices More... | |
UVariable * | varUseGigE |
guppy support More... | |
UVariable * | varUseGuppy |
guppy support More... | |
UVariable * | varUseIeeeOld |
guppy support 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 |
Private Attributes | |
UCamPush * | cam [MAX_MOUNTED_CAMERAS] |
int | camCnt |
UCmdExe * | cmdExe |
UImagePool * | imgPool |
bool | verboseMessages |
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 cameras mounted on a robot.
|
inline |
Constructor
References getResClassID(), UResBase::setResID(), UCamPoolInit(), and ~UCamPool().
|
virtual |
void UCamPool::closeImageLogging | ( | ) |
Close logfile - and stop logging
References UImageLog::closeLogging(), imageLog, and ULogFile::isOpen().
Referenced by getImagelogFilename(), and UFunctionImage::handleImageGetCommand().
|
protected |
Create initial var-pool variables
References UResVarPool::addVar(), UResBase::createReplayVar(), UResVarPool::getVarPool(), UVariable::setBool(), varCams, varCamsCnt, varUseGigE, varUseGuppy, and varUseIeeeOld.
Referenced by getImagelogFilename(), and UCamPoolInit().
|
protectedvirtual |
Decode this replay line, that is assumed to be valid.
line | is a pointer to the line. |
Reimplemented from UReplay.
References UPosition::dist(), getCam(), UImagePool::getImage(), UCamMounted::getPos(), UPosRot::getPos(), UPosRot::getRot(), UResBase::getStaticResource(), UImage::imageNumber, img, imgPool, UImage::imgTime, URotation::Kappa, UResBase::line, UImage::loadBMP(), UImage::loadPNG(), mini(), URotation::Omega, URotation::Phi, UReplay::replayLine, replayPath, UImage::setName(), UCamMounted::setPosOnRobot(), UTime::setTimeTod(), UImage::updated(), UTime::valid, UPosition::x, UPosition::y, and UPosition::z.
Referenced by getImagelogFilename().
bool UCamPool::findDevices | ( | ) |
Create camera structures from found devices
References UResVarPool::addStruct(), cam, camCnt, UCamDevBase::closeDevice(), cmdExe, UCamDevBase::deviceExist(), FIRST_GIGE_DEVICE_NUMBER, FIRST_GRABBER_DEVICE_NUMBER, FIRST_IEEE1394_DEVICE_NUMBER, FIRST_REPLAY_DEVICE_NUMBER, getCam(), UCamDevBase::getCameraName(), UCamPanTiltDevice::getPanPos(), UVarPool::getStruct(), UCamPanTiltDevice::getTiltPos(), UResVarPool::getVarPool(), imageLog, UCamDevBase::isCameraOpen(), ULock::lock(), MAX_MOUNTED_CAMERAS, UCamDevBase::openDeviceDefault(), UCamPanTiltDevice::pantiltSetPosition(), UCamPanTiltDevice::pantiltToHomePosition(), print(), UServerPush::setCmdExe(), UCamDevBase::setDeviceNumber(), UComCam::setFromCam(), UCamMounted::setImageLogging(), UCamDevBase::setInitialized(), UVariable::setInt(), UCamBase::setVarPool(), ULock::unlock(), varCams, varCamsCnt, verboseMessages, and Wait().
Referenced by UFunctionCamBase::createResources(), UFunctionCam::handleCamsGetCommand(), and setVerbose().
void UCamPool::flushClientCmds | ( | int | clientIdx | ) |
Flush all active commands from (a dead) client
Referenced by getCamByPoolIndex().
UCamPush * UCamPool::getCam | ( | int | device | ) |
Get a camera device from the device number
References cam, camCnt, UCamBase::getDev(), and UCamDevBase::getDeviceNumber().
Referenced by UFuncCog::centerOfGravity(), decodeReplayLine(), UFuncFocus::doFocus(), findDevices(), UFunctionCamBase::getCam(), UFunctionCamBase::getCamAndRawImage(), UFunctionCamBase::getImage(), UFuncKinect::GetXYZCoordinates(), UFunctionCam::handleCamGetCommand(), UFunctionCam::handleCamPushCommand(), UFunctionCam::handleCamSetCommand(), UFunctionCam::handleCamsGetCommand(), UFuncRectify::handleCommand(), UFuncBall_improved::handleCommand(), UFuncBallKL::handleCommand(), UFuncCropRow::handleCommand(), UFuncStraightLine::handleCommand(), UFuncLinefinder::handleCommand(), UFuncFz::handleCommand(), UFunctionCamGmk::handleGmkGetCommand(), UFuncPiCam::logImageToFile(), UFuncPTgrey::logImageToFile(), UFuncKinect::logImageToFile(), UFuncTOF::logImageToFile(), UImageLog::logImgPoolImage(), makeDevice(), UFuncKinect::makeObj3Dcloud(), UFuncStereo::processImages(), UFuncPiCam::run(), UFuncKinect::run(), setVerbose(), and UFuncKinect::updateCloud().
UCamPush * UCamPool::getCam | ( | const char * | posName | ) |
Get a camera device from the camera position name, i.e. 'cameraLeft'
References cam, camCnt, and UCamMounted::getPosName().
|
inline |
Get camera by index number in cam-pool. this may not be in device order
References cam, flushClientCmds(), print(), and saveSettings().
Referenced by UFunctionCamBase::getImage(), and UFunctionCam::handleCamsGetCommand().
|
inline |
Get camera device count
References camCnt.
Referenced by UFunctionCamBase::getImage(), and UFunctionCam::handleCamsGetCommand().
int UCamPool::getFirstCamDevice | ( | ) |
Get first camera device number.
References cam, camCnt, UCamBase::getDev(), and UCamDevBase::getDeviceNumber().
Referenced by UFunctionCamBase::getDefaultCamDevice(), and setVerbose().
|
inline |
Get image log filename
References closeImageLogging(), createBaseVar(), decodeReplayLine(), ULogFile::getLogName(), gotAllResources(), imageLog, UResBase::line, and setResource().
Referenced by UFunctionImage::handleImageGetCommand().
|
inlinestatic |
Resource ID for this class
Referenced by UFunctionCamBase::setResource(), and UCamPool().
|
virtual |
Test if pool has all needed resources.
Reimplemented from UResVarPool.
References cmdExe, and UCmdExe::getResClassID().
Referenced by getImagelogFilename().
|
inline |
Is image log open
References imageLog, and ULogFile::isOpen().
Referenced by UFunctionCam::handleCamSetCommand(), and UFunctionImage::handleImageGetCommand().
|
inline |
is image log format PNG
References imageLog, and UImageLog::isPng().
Referenced by UFunctionCam::handleCamSetCommand().
|
inline |
Is image logging set to save image itself too?
References imageLog, and UImageLog::isLogSaveImg().
Referenced by UFunctionImage::handleImageGetCommand().
UCamPush * UCamPool::makeDevice | ( | int | devNum, |
const char * | posName | ||
) |
Make a device, that needs no physical camera - or a camera with a separate interface, like the kinect
devNum | is the device number to create. |
posName | is an optional posName (must be unique), set to NULL if to be set later |
References UResVarPool::addStruct(), cam, UCamDevBase::CAM_DEV_REPLAY, camCnt, UCamDevBase::closeDevice(), cmdExe, UCamDevBase::deviceExist(), FIRST_GRABBER_DEVICE_NUMBER, FIRST_USERCAM_DEVICE_NUMBER, getCam(), UCamDevBase::getCameraName(), UCamBase::getDev(), UCamDevBase::getDeviceNumber(), UVarPool::getStruct(), UResVarPool::getVarPool(), imageLog, UCamDevBase::isThisA(), ULock::lock(), MAX_MOUNTED_CAMERAS, UServerPush::setCmdExe(), UCamDevBase::setDeviceNumber(), UCamMounted::setImageLogging(), UCamDevBase::setInitialized(), UVariable::setInt(), UCamMounted::setMountName(), UCamBase::setVarPool(), ULock::unlock(), varCams, and varCamsCnt.
Referenced by UFunctionCamBase::getCam(), UFunctionCam::handleCamSetCommand(), UFuncPiCam::logImageToFile(), UFuncPTgrey::logImageToFile(), UFuncKinect::logImageToFile(), UFuncTOF::logImageToFile(), UFuncPiCam::run(), UFuncKinect::run(), and setVerbose().
bool UCamPool::openImageLogging | ( | const char * | name | ) |
Open logfile - same as request logging of images
References imageLog, ULogFile::isOpen(), and UImageLog::openLogging().
Referenced by UFunctionCam::handleCamSetCommand(), and UFunctionImage::handleImageGetCommand().
|
inline |
Open image logging in default logfile
Referenced by saveSettings().
|
virtual |
Print the state of cameras
Reimplemented from UResBase.
Referenced by findDevices(), and getCamByPoolIndex().
|
virtual |
Print the state of cameras to a string buffer
Reimplemented from UResVarPool.
References cam, camCnt, MAX_MOUNTED_CAMERAS, and UCamPush::print().
bool UCamPool::saveSettings | ( | Uconfig * | ini | ) |
Save camera settings to configuration file. This saves the settings if the position name is different from the default 'posUnknown'. If the position is 'posUnknown', then the position name is set to 'posD' (D beeing the device number) and the parametes are set under this name. If two cameras has the same position name, then the last are assigned a new name. If 'ini' is NULL, then the values are saved in the default config-file.
|
inlinevirtual |
Save settings to default configuration file - the file mentioned in the global string configFileCal (defined in ugen4/ucommon.h.
Reimplemented from UResBase.
References openImageLogging().
Referenced by getCamByPoolIndex().
|
inline |
set image log format
References imageLog, and UImageLog::setPng().
Referenced by UFunctionCam::handleCamSetCommand().
|
inline |
Set image logging set to save image itself or not.
References imageLog, and UImageLog::setSaveImg().
Referenced by UFunctionImage::handleImageGetCommand().
|
virtual |
Set (or remove) ressource (core pointer needed by event handling)
Reimplemented from UResVarPool.
References cam, cmdExe, UCamBase::getDev(), UImagePool::getImage(), UCmdExe::getResClassID(), UImagePool::getResClassID(), img, imgPool, UResBase::isA(), ULock::lock(), MAX_MOUNTED_CAMERAS, UServerPush::setCmdExe(), UCamDevBase::setPushBuffer(), and ULock::unlock().
Referenced by getImagelogFilename().
|
inline |
Resource version of this class Set verbose messages - mostly for debug purpose
References findDevices(), getCam(), getFirstCamDevice(), makeDevice(), and verboseMessages.
void UCamPool::UCamPoolInit | ( | ) |
Camera pool initialization
References cam, camCnt, cmdExe, createBaseVar(), UResBase::getResID(), UResBase::getResVersion(), imageLog, imgPool, MAX_MOUNTED_CAMERAS, UReplay::replaySetFileName(), UResBase::resVersion, ULogFile::setLogName(), UResBase::setResID(), and verboseMessages.
Referenced by UCamPool().
|
private |
Array of camera structures.
Referenced by findDevices(), flushClientCmds(), getCam(), getCamByPoolIndex(), getFirstCamDevice(), makeDevice(), print(), setResource(), UCamPoolInit(), and ~UCamPool().
|
private |
Number of created camera structures.
Referenced by findDevices(), flushClientCmds(), getCam(), getDeviceCount(), getFirstCamDevice(), makeDevice(), print(), UCamPoolInit(), and ~UCamPool().
|
private |
Command executor for push commands.
Referenced by findDevices(), gotAllResources(), makeDevice(), setCmdExe(), setResource(), and UCamPoolInit().
|
protected |
Logfile for continued logging of images
Referenced by closeImageLogging(), findDevices(), getImagelogFilename(), isImagelogOpen(), isLogPng(), isLogSaveImg(), makeDevice(), openImageLogging(), setLogPng(), setLogSaveImg(), UCamPoolInit(), and ~UCamPool().
|
private |
Image pool pointer for push buffer images
Referenced by decodeReplayLine(), setResource(), and UCamPoolInit().
|
protected |
camera devices
Referenced by createBaseVar(), findDevices(), and makeDevice().
|
protected |
number of camera devices
Referenced by createBaseVar(), findDevices(), and makeDevice().
|
protected |
guppy support
Referenced by createBaseVar().
|
protected |
guppy support
Referenced by createBaseVar().
|
protected |
guppy support
Referenced by createBaseVar().
|
private |
Print more when relevant
Referenced by findDevices(), setVerbose(), and UCamPoolInit().