AURobotServers  4
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
UFuncKinect Class Reference

#include <ufunckinect.h>

Inheritance diagram for UFuncKinect:
Inheritance graph

Public Member Functions

virtual void callGotNewDataWithObject ()
 
virtual void createResources ()
 
virtual bool decodeReplayLine (char *line)
 
int GetXYZCoordinates (void *pointCloud, int Max, int type, int redFac)
 
virtual bool handleCommand (UServerInMsg *msg, void *extra)
 
bool makeObj3Dcloud ()
 
bool makePCD (const char *name, bool andRowCol)
 
virtual bool methodCall (const char *name, const char *paramOrder, char **strings, const double *pars, double *value, UDataBase **returnStruct, int *returnStructCnt)
 
virtual bool methodCallV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct, int *returnStructCnt)
 
void run ()
 
 UFuncKinect ()
 
void updateCloud (bool color)
 
virtual void updateReplayStatus ()
 
 ~UFuncKinect ()
 
- Public Member Functions inherited from UFuncPlugBasePush
virtual bool setResource (UResBase *resource, bool remove)
 
 UFuncPlugBasePush ()
 
virtual ~UFuncPlugBasePush ()
 
- Public Member Functions inherited from UFunctionBase
bool addResource (UResBase *resource, UFunctionBase *owner)
 
void closeLogfile ()
 
virtual const char * commandList ()
 
const char * getAliasName ()
 
const char * getLoadedFileName ()
 
void * getLoadedModuleRef ()
 
virtual bool gotAllResources (char *missingThese, int missingTheseCnt)
 
bool isMine (const char *cmdName)
 
bool isStatic ()
 is the module loaded as static A module is static if the ldFilename has a length of zero. More...
 
virtual const char * name ()
 
bool newCmd (UServerInMsg *newMsg, UDataBase *extra)
 
bool newCommand (UServerInMsg *newMsg, void *extra)
 
bool openLogfile (const char *name)
 
void print (const char *preString)
 
virtual void resourceUpdated ()
 
bool sendEndTag (UServerInMsg *msg)
 
bool sendEndTag ()
 
bool sendFullTag (const char *attributes)
 
bool sendHelpDone (UServerInMsg *msg)
 
bool sendHelpDone ()
 
bool sendHelpStart (UServerInMsg *msg, const char *subject)
 
bool sendHelpStart (const char *subject)
 
bool sendHelpStart ()
 
bool sendMsg (UServerInMsg *msg, const char *message, int size)
 
bool sendMsg (const char *message)
 
bool sendMsg (UServerInMsg *msg, const char *message)
 
bool sendMsg (int clientIdx, const char *message, int size)
 
bool sendMsgInt (int clientIdx, const char *message)
 
bool sendStartTag (const char *attributes)
 
bool sendText (UServerInMsg *msg, const char *text)
 
bool sendText (const char *text)
 
virtual void setAliasName (const char *name)
 
virtual void setCommand (const char *cmdList, const char *name, const char *note)
 
void setLoadedModuleRef (void *module, const char *moduleFileName)
 
virtual void setLoadTime (UTime)
 
void setName (const char *name)
 
void setVerbose (bool value)
 
 UFunctionBase ()
 
virtual ~UFunctionBase ()
 
- Public Member Functions inherited from UCallBack
bool addOnEvent (UOnEvent *dataObject)
 
virtual bool onEvent (const char *interface, const char *dataType, void *data)
 
 UCallBack ()
 
virtual ~UCallBack ()
 
- 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 const char * print (const char *preString, char *buff, int buffCnt)
 
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)
 
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 saveSettings ()
 
void setCorePointer (UCmdExe *serverCore)
 
void setResFuncIdx (int idx)
 
virtual void setResID (const char *id, const int version)
 
 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 ~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 ()
 

Private Member Functions

bool handleKinect (UServerInMsg *msg)
 
void init ()
 
void initXYTable (int focalLength)
 
void logFileTest ()
 
bool logImageToFile (UImage *imgToLog)
 
bool processDepthImages (UImage *img, int validBits)
 
bool setPointCloudUpdated (const char *name)
 
bool start ()
 start read thread More...
 
void stop (bool andWait)
 

Private Attributes

const char * aliasname
 
UImg3Dpointscloud3d
 
int frameCntDepth
 number of accepter depth frames More...
 
int frameCntRgb
 number of accepted video frames (rgb or ir) More...
 
int frameLogCnt
 frame count for logging More...
 
UTime frameRateDepthTime
 variable for frame rate calculation More...
 
UTime frameRateRgbTime
 variable for frame rate calculation More...
 
UImageimgCbuf
 image buffer for color in 3d cloud More...
 
UTime lastLoopTime
 
ULLogFile logAcc
 
UImagelogDepthImage
 pointer to depth image to log More...
 
ULLogFile logf
 
UImageLog logImage
 
UImagelogVideoImage
 pointer to video (color or IR) image to log More...
 
UImg3Dpointsobj3dcloud
 obj3d data structure More...
 
int oldCamDevC
 
int oldCamDevD
 
int oldFocalLength
 last used focal length for rectified image More...
 
int oldLed
 
double oldTilt
 
uint16_t t_depth [2048]
 
uint16_t t_gamma [2048]
 
float t_posX [640]
 
float t_posY [480]
 
pthread_t threadHandle
 
bool threadRunning
 thread runnung flag More...
 
bool threadStop
 stop thread flag More...
 
UVariablevarAcc
 
UVariablevarAccInterval
 
UVariablevarAccLogN
 
UVariablevarAccRate
 
UVariablevarCamDeviceNum
 
UVariablevarDepthFmt
 
UVariablevarFramerate
 
UVariablevarFramerateDesired
 
UVariablevarImageLogN
 
UVariablevarImagesC3D
 
UVariablevarInitialized
 is kinect initialized More...
 
UVariablevarIsOpen
 
UVariablevarKinectNumber
 
UVariablevarLed
 
UVariablevarMaxUsedDepth
 
UVariablevarOrient
 
UVariablevarReductionFactor
 
UVariablevarReplayLine
 
UVariablevarResolution
 
UVariablevarSilent
 
UVariablevarTiltDeg
 
UVariablevarTiltUse
 
UVariablevarTime
 
UVariablevarUpdateCnt
 
UVariablevarUseColor
 
UVariablevarUseCorrectedDepth
 
UVariablevarUseDepth
 
UVariablevarUseDepthColor
 
UVariablevarVideoFmt
 
char whyString [MWL]
 

Static Private Attributes

static const int MWL = 100
 

Additional Inherited Members

- Static Public Member Functions inherited from UResVarPool
static const char * getResClassID ()
 
- Public Attributes inherited from UFunctionBase
bool silent
 is reply to client and console to be limited More...
 
- Public Attributes inherited from UReplay
bool replayTimeAdvancePending
 
UTime replayTimeNow
 
- Static Public Attributes inherited from UFunctionBase
static const int MAX_ID_LENGTH = 30
 
static const int MAX_RESOURCE_LIST_SIZE = 250
 
- Protected Member Functions inherited from UFuncPlugBasePush
bool handlePush (UServerInMsg *msg)
 
- Protected Member Functions inherited from UFunctionBase
int getCmdIndex ()
 
UResBasegetStaticResource (const char *resName, bool mayCreate, bool staticOnly=true)
 get a pointer to a static resource. More...
 
bool isClientAlive (int clientIdx, double holdOffTime)
 
bool sendDebug (UServerInMsg *msg, const char *debugText)
 
bool sendDebug (const char *debugText)
 
bool sendError (UServerInMsg *msg, const char *errorText)
 
bool sendError (const char *errorText)
 
bool sendHelp (UServerInMsg *msg, const char *infoText)
 
bool sendHelp (const char *infoText)
 
bool sendInfo (UServerInMsg *msg, const char *infoText)
 
bool sendInfo (const char *infoText)
 
bool sendWarning (UServerInMsg *msg, const char *warningText)
 
bool sendWarning (const char *warningText)
 
UResBasesetThisResource (const char *ID, UResBase *resource, bool remove, bool *changed, UResBase *currentResPtr, bool *isLocal)
 
- 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 inherited from UFunctionBase
char aliasName [MAX_ID_LENGTH]
 
UCmdExecmdHandler
 
char * cmdToks [20]
 
int cmdToksCnt
 
char commandsHandled [MAX_RESOURCE_LIST_SIZE]
 
UServerInMsgmsg
 
char pluginName [MAX_RESOURCE_LIST_SIZE]
 
bool verboseMessages
 
- 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
 
- 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

This is functions to handle Kinect camera issues

Constructor & Destructor Documentation

UFuncKinect::UFuncKinect ( )
inline
UFuncKinect::~UFuncKinect ( )

Member Function Documentation

void UFuncKinect::callGotNewDataWithObject ( )
virtual

Called from push implementor to get the push object. should call to 'gotNewData(object)' with the available event object. if no object is available (anymore), then call with a NULL pointer.

Reimplemented from UServerPush.

References UVariable::add(), bool2str(), UImage::camDevice, cloud3d, convert_packed11_to_16bit(), convert_packed_to_16bit(), convert_packed_to_8bit(), data, frameCntDepth, frameCntRgb, frameLogCnt, frameRateDepthTime, frameRateRgbTime, freenect_apply_depth_to_mm(), freenect_apply_registration(), freenect_close_device(), FREENECT_DEPTH_10BIT_PACKED, FREENECT_DEPTH_11BIT_PACKED, freenect_find_depth_mode(), freenect_find_video_mode(), freenect_init(), freenect_init_registration(), freenect_open_device(), FREENECT_RESOLUTION_HIGH, FREENECT_RESOLUTION_MEDIUM, freenect_set_depth_callback(), freenect_set_depth_mode(), freenect_set_led(), freenect_set_tilt_degs(), freenect_set_video_callback(), freenect_set_video_mode(), freenect_shutdown(), freenect_start_depth(), freenect_start_video(), freenect_stop_depth(), freenect_stop_video(), FREENECT_VIDEO_BAYER, FREENECT_VIDEO_IR_8BIT, FREENECT_VIDEO_RGB, FREENECT_VIDEO_YUV_RAW, UVariable::getBool(), UImage::getData(), getDevUse(), UImagePool::getImage(), UVariable::getInt(), UFunctionBase::getStaticResource(), UVariable::getTime(), UTime::getTimePassed(), UImage::getUCharRef(), UServerPush::gotNewData(), UImage::height(), UImage::imageNumber, UImage::imgTime, LED_RED, ULock::lock(), logDepthImage, logf, logVideoImage, makeObj3Dcloud(), UTime::Now(), UTime::now(), oldLed, processDepthImages(), roundi(), UVariable::setBool(), UVariable::setInt(), UImage::setName(), UImage::setSize(), UImage::setSizeOnly(), UTime::SetTime(), UServerPush::setUpdated(), UVariable::setValued(), UImg3Dpoints::time, ULogFile::toLog(), ULock::tryLock(), ULock::unlock(), UImage::updated(), UImage::used, varCamDeviceNum, varDepthFmt, varFramerate, varImagesC3D, varInitialized, varIsOpen, varKinectNumber, varLed, varResolution, varTiltDeg, varTiltUse, varTime, varUpdateCnt, varUseColor, varUseDepth, and varVideoFmt.

Referenced by UFuncKinect().

void UFuncKinect::createResources ( )
virtual
bool UFuncKinect::decodeReplayLine ( char *  line)
virtual

Decode this replay line, that is assumed to be valid - has got a time stamp.

Parameters
lineis a pointer to the line.
Returns
true if the line is valid and used (step is successful).
false if line is not a valid step.

Reimplemented from UReplay.

References UVariable::add(), UImage::camDevice, UImagePool::getImage(), UVariable::getInt(), UFunctionBase::getStaticResource(), UImage::imageNumber, img, UImage::imgTime, UResBase::line, UImage::loadPNG(), ULock::lock(), processDepthImages(), replayPath, UImage::setName(), UVariable::setTime(), UTime::setTimeTod(), UServerPush::setUpdated(), ULock::unlock(), UImage::updated(), varImagesC3D, varReplayLine, and varTime.

Referenced by UFuncKinect().

int UFuncKinect::GetXYZCoordinates ( void *  pointCloud,
int  Max,
int  type,
int  redFac 
)

get the imageset as a point cloud

Parameters
[out]pointCloudthe point cloud to change
Maxis the maximum distance (in mm or depth value) to add
typeis 0 for XYZ and 1 for XYZRGB format
redFacis an optional reduction factor - to reduce number of points. 1= all points, 2=every other, 3=every third ...
Returns
number of points added

References UVariable::getBool(), UCamPool::getCam(), UCamRad::getCamPar(), UVariable::getDouble(), UCamPar::getFocalLength(), UImage::getHeight(), UImagePool::getImage(), UVariable::getInt(), UImage::getLine(), UFunctionBase::getStaticResource(), UImage::getWidth(), initXYTable(), ULock::lock(), oldFocalLength, UPixel::p1, UPixel::p2, UPixel::p3, t_posX, t_posY, UImage::toRGB(), ULock::unlock(), varCamDeviceNum, varImagesC3D, varMaxUsedDepth, varSilent, and UPixel::y.

Referenced by methodCall(), UFuncKinect(), and updateCloud().

bool UFuncKinect::handleCommand ( UServerInMsg msg,
void *  extra 
)
virtual

Handle incomming commands flagged for this module

Parameters
msgpointer to the message and the client issuing the command
Returns
true if the function is handled - otherwise the client will get a 'failed' reply

Reimplemented from UFunctionBase.

References UFunctionBase::getCmdIndex(), handleKinect(), UFuncPlugBasePush::handlePush(), and UFunctionBase::sendDebug().

Referenced by UFuncKinect().

bool UFuncKinect::handleKinect ( UServerInMsg msg)
private
void UFuncKinect::init ( )
private
void UFuncKinect::initXYTable ( int  focalLength)
private

Init table for fast calculation of 3D position from depth image

Parameters
focalLengthis the estimated focal length for the color camera in pixel. This assumes, that the depth image is rectified to match the color image.

References oldFocalLength, t_posX, and t_posY.

Referenced by GetXYZCoordinates(), makeObj3Dcloud(), and UFuncKinect().

void UFuncKinect::logFileTest ( )
private
bool UFuncKinect::logImageToFile ( UImage imgToLog)
private

Save image to imagelog and save the image itself in the imagePath. if camera device do not exist, then a default device is created..

Parameters
imgToLogis the image to be logged.

References UImage::camDevice, UCamPool::getCam(), UVariable::getInt(), UFunctionBase::getStaticResource(), ULock::lock(), UImageLog::logImage(), logImage, UCamPool::makeDevice(), ULock::unlock(), and varImageLogN.

Referenced by run(), and UFuncKinect().

bool UFuncKinect::makeObj3Dcloud ( )
bool UFuncKinect::makePCD ( const char *  name,
bool  andRowCol 
)

Make 3D object, either in PCD format for PCD viewer or in the old 3D format used by obj3d plugin.

Parameters
nameis an optional filename for the generated file (NB same nale for both file formats).
andRowColadds row and column from source image to the file
Returns
true if both a depth and color image is available (in imagesC3D[0] and imagesC3D[1]).

References cloud3d, ULock::lock(), makeObj3Dcloud(), UImg3Dpoints::makePCLFile(), and ULock::unlock().

Referenced by handleKinect(), and UFuncKinect().

bool UFuncKinect::methodCall ( const char *  name,
const char *  paramOrder,
char **  strings,
const double *  pars,
double *  value,
UDataBase **  returnStruct,
int *  returnStructCnt 
)
virtual

Function to implement a var-pool method call.

Parameters
nameis the name of the called function
paramOrderis a string with one char for each parameter in the call - d is double, s is string, c is class object.
stringsis an array of string pointers for the string type parameters (may be NULL if not used)
doublesis an array with double typed parameters (may be NULL if not used)
valueis the (direct) result of the class, either a double value, or 0.0 for false 1.0 for true 2.0 for implicit stop if a controll call.
returnStructis an array of class object pointers that can be used as parameters or return objects (may be NULL)
returnStructCntis the number of objects in the returnStruct buffer
Returns
true if the method is recognised (exists), when false is returned a invalid name or parameter list is detected.

Reimplemented from UResVarPool.

References UVariable::getInt(), GetXYZCoordinates(), roundi(), and varReductionFactor.

Referenced by UFuncKinect().

bool UFuncKinect::methodCallV ( const char *  name,
const char *  paramOrder,
UVariable params[],
UDataBase **  returnStruct,
int *  returnStructCnt 
)
virtual

Function to implement an inter plug-in method call using UVariables as parameter (and return value). Structures of the base type UDatabase (but not UVariables) may be returned in the returnStruct pointer array. The returnStructCnt should be set to returned count, if values are returned.

Parameters
nameis the name of the called function
paramOrderis a string with one char for each parameter in the call - d is double, s is string, c is class object.
paramsis an array of UVariable pointers, one pointer for each character in paramOrder. NB! params are not declared as constant, and may be used to return values.
returnStructis an array of class object pointers that can be used as parameters or return objects (may be NULL)
returnStructCntis the number of objects in the returnStruct buffer
Returns
true if the method is recognised (exists), when false is returned a invalid name or parameter list is detected.

Reimplemented from UVarMethodImplement.

References cloud3d.

Referenced by UFuncKinect().

bool UFuncKinect::processDepthImages ( UImage img,
int  validBits 
)
private

produce fake disparity images - if requested.

Parameters
imgis the true 16-bit depth image to process
validBitsis number of valid bits in img
Returns
true if successful - i.e. source images available

References UImage::copyMeta(), UVariable::getBool(), UImage::getData(), UImage::getDepth(), UImage::getHeight(), UImagePool::getImage(), UVariable::getInt(), UFunctionBase::getStaticResource(), UImage::getWidth(), mini(), UPixel::set(), UImage::setName(), UImage::setSize(), UServerPush::setUpdated(), t_gamma, ULock::tryLock(), ULock::unlock(), UImage::updated(), varImagesC3D, varUseColor, and varUseDepthColor.

Referenced by callGotNewDataWithObject(), decodeReplayLine(), and UFuncKinect().

void UFuncKinect::run ( )

Run receive thread

References freenect_raw_tilt_state::accelerometer_x, freenect_raw_tilt_state::accelerometer_y, freenect_raw_tilt_state::accelerometer_z, UFunctionBase::aliasName, deviceUseInfo::depthFrameTime, deviceUseInfo::depthIdle, devUse, freenect_get_mks_accel(), freenect_get_tilt_degs(), freenect_get_tilt_state(), freenect_process_events(), freenect_set_led(), freenect_set_tilt_degs(), freenect_update_tilt_state(), UVariable::getBool(), UCamPool::getCam(), UCamBase::getDev(), UVariable::getDouble(), ULogFile::getF(), UVariable::getInt(), UTime::GetMicrosec(), UTime::GetSec(), UFunctionBase::getStaticResource(), UTime::getTimePassed(), UTime::getTimeval(), UVariable::getValued(), UImage::imageNumber, ULogFile::isLogOpen(), ULogFile::isOpen(), URotation::Kappa, KINECT_MAX_DEVICE_USE, lastLoopTime, ULock::lock(), logAcc, logDepthImage, logf, logFileTest(), logImage, logImageToFile(), logVideoImage, UCamPool::makeDevice(), maxi(), mini(), UTime::Now(), UTime::now(), oldCamDevC, oldCamDevD, oldLed, oldTilt, URotation::Omega, URotation::Phi, roundi(), UPosition::set(), UVariable::set3D(), UCamDevBase::setDevice(), UCamMounted::setMountName(), UVariable::setRot(), UVariable::setTime(), UCamBase::setTypeName(), UVariable::setValued(), deviceUseInfo::syncVideoFromDepth, threadRunning, threadStop, ULogFile::toLog(), UImageLog::toLog(), ULock::unlock(), deviceUseInfo::useDepthCnt, deviceUseInfo::useDepthFrame, deviceUseInfo::useVideoCnt, deviceUseInfo::useVideoFrame, varAcc, varAccInterval, varAccLogN, varAccRate, varCamDeviceNum, varFramerate, varFramerateDesired, varImageLogN, varIsOpen, varKinectNumber, varLed, varOrient, varResolution, varTiltDeg, varTiltUse, varTime, varUseDepth, deviceUseInfo::videoIdle, Wait(), UPosition::x, UPosition::y, and UPosition::z.

Referenced by startUFuncKinectThread(), and UFuncKinect().

bool UFuncKinect::setPointCloudUpdated ( const char *  name)
private

Tell point cloud pool (PCP) that a point cloud owned by pcp, is updated

Parameters
nameis name of updated point cloud.
Returns
true if call was successful

References UResVarPool::callGlobalV(), and UVariable::setValues().

Referenced by UFuncKinect(), and updateCloud().

bool UFuncKinect::start ( )
private

start read thread

References startUFuncKinectThread(), threadHandle, threadRunning, and threadStop.

Referenced by createResources(), and UFuncKinect().

void UFuncKinect::stop ( bool  andWait)
privatevirtual

stop read thread

Parameters
andWaitwaits until thread is terminated, when false, then the call returns when the stop flag is set (i.e. immidiately).

Reimplemented from UResBase.

References threadHandle, threadRunning, and threadStop.

Referenced by UFuncKinect(), and ~UFuncKinect().

void UFuncKinect::updateCloud ( bool  color)
void UFuncKinect::updateReplayStatus ( )
virtual

is called when it is time to update replay status (after a step in some replay file)

Reimplemented from UResBase.

References UReplay::isReplay(), UVariable::setBool(), and varReplayLine.

Referenced by UFuncKinect().

Member Data Documentation

const char* UFuncKinect::aliasname
private

Referenced by createResources().

UImg3Dpoints* UFuncKinect::cloud3d
private
int UFuncKinect::frameCntDepth
private

number of accepter depth frames

Referenced by callGotNewDataWithObject(), and init().

int UFuncKinect::frameCntRgb
private

number of accepted video frames (rgb or ir)

Referenced by callGotNewDataWithObject(), and init().

int UFuncKinect::frameLogCnt
private

frame count for logging

Referenced by callGotNewDataWithObject().

UTime UFuncKinect::frameRateDepthTime
private

variable for frame rate calculation

Referenced by callGotNewDataWithObject().

UTime UFuncKinect::frameRateRgbTime
private

variable for frame rate calculation

Referenced by callGotNewDataWithObject().

UImage* UFuncKinect::imgCbuf
private

image buffer for color in 3d cloud

Referenced by init(), makeObj3Dcloud(), and ~UFuncKinect().

UTime UFuncKinect::lastLoopTime
private

Kinect loop keep-alive time

Referenced by handleKinect(), and run().

ULLogFile UFuncKinect::logAcc
private

Logfile for acceleration measurement

Referenced by createResources(), handleKinect(), logFileTest(), run(), and ~UFuncKinect().

UImage* UFuncKinect::logDepthImage
private

pointer to depth image to log

Referenced by callGotNewDataWithObject(), init(), and run().

ULLogFile UFuncKinect::logf
private
UImageLog UFuncKinect::logImage
private
UImage* UFuncKinect::logVideoImage
private

pointer to video (color or IR) image to log

Referenced by callGotNewDataWithObject(), init(), and run().

const int UFuncKinect::MWL = 100
staticprivate
UImg3Dpoints* UFuncKinect::obj3dcloud
private

obj3d data structure

Referenced by init().

int UFuncKinect::oldCamDevC
private

Referenced by init(), and run().

int UFuncKinect::oldCamDevD
private

Referenced by init(), and run().

int UFuncKinect::oldFocalLength
private

last used focal length for rectified image

Referenced by GetXYZCoordinates(), init(), initXYTable(), and makeObj3Dcloud().

int UFuncKinect::oldLed
private

Referenced by callGotNewDataWithObject(), init(), and run().

double UFuncKinect::oldTilt
private

Referenced by run().

uint16_t UFuncKinect::t_depth[2048]
private

Depth correction table for kinect

Referenced by init(), and makeObj3Dcloud().

uint16_t UFuncKinect::t_gamma[2048]
private

Gamma correction table from 11-bit depth - for better display

Referenced by init(), and processDepthImages().

float UFuncKinect::t_posX[640]
private

X-Position correction table for kinect

Referenced by GetXYZCoordinates(), initXYTable(), and makeObj3Dcloud().

float UFuncKinect::t_posY[480]
private

Y-Position correction table for kinect

Referenced by GetXYZCoordinates(), initXYTable(), and makeObj3Dcloud().

pthread_t UFuncKinect::threadHandle
private

Thread handle for frame read thread.

Referenced by start(), and stop().

bool UFuncKinect::threadRunning
private

thread runnung flag

Referenced by init(), run(), start(), and stop().

bool UFuncKinect::threadStop
private

stop thread flag

Referenced by init(), run(), start(), and stop().

UVariable* UFuncKinect::varAcc
private

Referenced by createResources(), and run().

UVariable* UFuncKinect::varAccInterval
private

Referenced by createResources(), and run().

UVariable* UFuncKinect::varAccLogN
private
UVariable* UFuncKinect::varAccRate
private

Referenced by createResources(), and run().

UVariable* UFuncKinect::varCamDeviceNum
private
UVariable* UFuncKinect::varDepthFmt
private
UVariable* UFuncKinect::varFramerate
private
UVariable* UFuncKinect::varFramerateDesired
private

Referenced by createResources(), and run().

UVariable* UFuncKinect::varImageLogN
private
UVariable* UFuncKinect::varImagesC3D
private
UVariable* UFuncKinect::varInitialized
private

is kinect initialized

Referenced by callGotNewDataWithObject(), createResources(), and ~UFuncKinect().

UVariable* UFuncKinect::varIsOpen
private
UVariable* UFuncKinect::varKinectNumber
private
UVariable* UFuncKinect::varLed
private
UVariable* UFuncKinect::varMaxUsedDepth
private
UVariable* UFuncKinect::varOrient
private

Referenced by createResources(), and run().

UVariable* UFuncKinect::varReductionFactor
private
UVariable* UFuncKinect::varReplayLine
private
UVariable* UFuncKinect::varResolution
private
UVariable* UFuncKinect::varSilent
private

processing parameters

Referenced by createResources(), GetXYZCoordinates(), and handleKinect().

UVariable* UFuncKinect::varTiltDeg
private
UVariable* UFuncKinect::varTiltUse
private
UVariable* UFuncKinect::varTime
private
UVariable* UFuncKinect::varUpdateCnt
private

Pointers to "own" global variables.

Referenced by callGotNewDataWithObject(), and createResources().

UVariable* UFuncKinect::varUseColor
private
UVariable* UFuncKinect::varUseCorrectedDepth
private

Referenced by createResources().

UVariable* UFuncKinect::varUseDepth
private
UVariable* UFuncKinect::varUseDepthColor
private
UVariable* UFuncKinect::varVideoFmt
private
char UFuncKinect::whyString[MWL]
private

Short explanation to why processing failed


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