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

#include <ucammount.h>

Inheritance diagram for UCamMounted:
Inheritance graph

Public Member Functions

virtual void createVars ()
 
bool getMtoPix (UPosition pos3D, bool useRad, float *pixx, float *pixy)
 
UPosition getPos ()
 
UPosition getPosCC ()
 
const char * getPosName ()
 
UPosRot getPosRot ()
 
URotation getRot ()
 
URotation getRotCC ()
 
bool isClientInCharge (int client)
 
bool loadCamSettings (Uconfig *ini, const char *mountkey)
 
virtual bool logImage (UImage *img)
 
bool saveCamSettings (Uconfig *ini, const char *mountkey)
 
void setClientInCharge (int client)
 
void setImageLogging (UImageLog *value)
 
void setMountName (const char *posName)
 
void setPosOnRobot (UPosition *pos, URotation *rot)
 
void setPosOnRobot (UPosRot *pose3d)
 
void setPosOnRobotCC (UPosition *pos, URotation *rot)
 
 UCamMounted (UCamDevBase *device)
 
virtual ~UCamMounted ()
 
- Public Member Functions inherited from UCamRad
UCamPargetCamPar ()
 
int getDefaultColFormat ()
 
bool getDefaultRemRadErr ()
 
bool getImageSnapshot (UImage *image)
 
bool removeRadialError (UImage *source, UImage *destination)
 
void saveRadialCorrectionMatrix (char *filename)
 
bool setCameraParameters (float hx, float hy, float k1, float k2, float focalLng)
 
void setDefaultRemRadErr (bool value)
 
bool setRadialErrorMatrix ()
 
 UCamRad (UCamDevBase *device)
 
void updateLensParams (const int height, const int width)
 
virtual ~UCamRad ()
 
- Public Member Functions inherited from UCamPanTiltDevice
int getPanMaxRange ()
 
int getPanMinRange ()
 
int getPanPos ()
 
int getTiltMaxRange ()
 
int getTiltMinRange ()
 
int getTiltPos ()
 
bool isPantiltSupported ()
 
bool isPantiltValid ()
 
bool pantiltSetPosition (bool relative, int pan, int tilt)
 
bool pantiltToHomePosition ()
 
bool pantiltUpdatePosition ()
 
bool setPantiltStatus ()
 
 UCamPanTiltDevice (UCamDevBase *device)
 
- Public Member Functions inherited from UCamBase
const char * getCamName ()
 
UCamDevBasegetDev ()
 
int getDevNum ()
 
virtual void gotNewImage (UImage *)
 
virtual void imgUpdated ()
 
virtual bool needNewPushData ()
 
void setTypeName (const char *newName)
 
void setVarPool (UVarPool *vpd)
 
 UCamBase (UCamDevBase *device)
 
virtual ~UCamBase ()
 

Protected Attributes

int clientInControl
 
UImageLoglogip
 
UVariablevarCamPose
 
UVariablevarMountName
 
- Protected Attributes inherited from UCamBase
UCamDevBasedev
 
UVarPoolvars
 

Additional Inherited Members

- Public Attributes inherited from UCamRad
UVarPoolvarBaseStruct
 
- Protected Member Functions inherited from UCamRad
bool getRadialU2DOffset (float xu, float yu, float *dxd, float *dyd)
 
UXYoffset getRadialU2DOffsetInt (int x, int y)
 
virtual void imageSizeChanged (double iResFactor)
 
bool lensParChanged ()
 
bool removeRadialErrorOnePlane (unsigned char ps[], unsigned char pd[], unsigned int height, unsigned int width, float pixSize, bool halfRes)
 
bool removeRadialErrorPixels (UPixel ps[], UPixel pd[], unsigned int height, unsigned int width, float pixSize)
 
- Protected Member Functions inherited from UCamPanTiltDevice
bool protPantiltGetPosition ()
 
bool protPantiltGetRange ()
 
bool protPantiltReset (bool resetPan, bool resetTilt)
 

Detailed Description

Holds information of a camera mounted on a robot. This includes 3D position and rotation, and rotation matrices to ease conversion between camera and robot perspective.

Author
Christian Andersen

Constructor & Destructor Documentation

UCamMounted::UCamMounted ( UCamDevBase device)

Constructor

References clientInControl, logip, varCamPose, and varMountName.

UCamMounted::~UCamMounted ( )
virtual

Destructor

Member Function Documentation

void UCamMounted::createVars ( )
virtual

Create locally maintained variables - if any

Reimplemented from UCamRad.

Reimplemented in UCamPush.

References UVarPool::addVarA(), UCamRad::createVars(), varCamPose, varMountName, and UCamBase::vars.

Referenced by UCamPush::createVars(), and setImageLogging().

bool UCamMounted::getMtoPix ( UPosition  pos3D,
bool  useRad,
float *  pixx,
float *  pixy 
)

Convert this 3D robot coordinate to a pixel position. The mounted camera position is used to convert to camera coordinate in 3D, and then to pixel position in a undistorted image. if 'useRad' is true, then the pixel position is converted to a pixel position in the distorted image.

References UPosition::asVector4(), UPosition::copy(), UCamBase::dev, UCamRad::getCamPar(), UCamPar::getCtoPRob(), UCamDevBase::getHeight(), UPosRot::getMtoRMatrix(), getPosRot(), UCamPar::getRadialU2D(), UCamDevBase::getWidth(), URPos::x, and URPos::y.

Referenced by UFuncImgPoly::handleImgPolyCommand(), UFunctionCamPath::handlePathGetCommand(), setClientInCharge(), and test3DtoPix().

UPosition UCamMounted::getPos ( )
inline
UPosition UCamMounted::getPosCC ( )
inline

Get camera position relative to robot in camera coordinate system, i.e. x is right, y is up and z is back. Coordinates are in 'robot' coordinates i.e. x is front, y left, z is up

References UVariable::get6D(), getRot(), getRotCC(), varCamPose, UPosition::x, UPosition::y, and UPosition::z.

Referenced by UCalibrate::findBarcodeChartPosition(), and UCalibrate::findCameraPosition().

const char* UCamMounted::getPosName ( )
inline
UPosRot UCamMounted::getPosRot ( )
inline

Get camera position as URotPos object - in robot coordinate type. If pan-tilt is supported, then the pan-tilted rotation is returned. (NB! if just moved, it may take some time for the camera to get to the returned position).

References getPos(), getRot(), loadCamSettings(), saveCamSettings(), and UPosRot::set().

Referenced by UFuncBallKL::calculateBallPosition(), UFuncBall::calculateBallPosition(), UFuncBall_improved::calculateBallPosition(), UFuncCropRow::findPlants(), UFuncStraightLine::findWoldPoints(), getMtoPix(), UFuncCropRow::handleCommand(), UFuncKinect::makeObj3Dcloud(), UCamPush::print(), UFuncStereo::processImages(), and UFuncKinect::updateCloud().

URotation UCamMounted::getRot ( )

Get camera rotation relative to robot in robot coordinates. i.e. x-axis is front (omega), y-axis is right (Phi), z-axis is up (kappa). Rotation order is first around vertical axis (Z (kappa)), then elevation up-down around Y-axis (Phi), and last rotation around robot axis (x or omega). If pan-tilt is supported, then the pan-tilted rotation is returned. (NB! if just moved, it may take some time for the camera to get to the returned position).

References UVariable::get6D(), UPosRot::rot(), and varCamPose.

Referenced by UFuncImgPoly::findAreaFromSeedRGB(), UFunctionCamPath::findPath(), getPosCC(), getPosRot(), getRotCC(), UFunctionCamGmk::handleGmkGetCommand(), UFuncLinefinder::houghTest(), UImageLog::logImage(), UComCamSml::setCamDevice(), and UComCamSml::setFromCam().

URotation UCamMounted::getRotCC ( )

Get camera rotation relative to robot in camera coordinates. i.e. x-axis is left (omega), y-axis is up (Phi), z-axis is back (kappa). rotation is first Phi around vertical axis (Y), then elevation up-down around X axis, and last rotation around camera axis Z. If pan-tilt is supported, then the pan-tilted rotation is returned. (NB! if just moved, it may take some time for the camera to get to the returned position).

References getRot(), URotation::Kappa, URotation::Omega, and URotation::Phi.

Referenced by UCalibrate::findBarcodeChartPosition(), UCalibrate::findCameraPosition(), and getPosCC().

bool UCamMounted::isClientInCharge ( int  client)

Is this client in charge of camera settings? Returns true if so, if not then the client will be in charge if noone else has requested to be in charge.

References clientInControl.

Referenced by getPosName(), UFunctionCam::handleCamSetCommand(), and UComCamSml::pack().

bool UCamMounted::loadCamSettings ( Uconfig ini,
const char *  mountkey 
)

Load camera settings using this key name. if no key is provided the camera name is used. Returns true if loaded.

Referenced by getPosRot().

bool UCamMounted::logImage ( UImage img)
virtual

Note that this image is captured in logfile as needed

Reimplemented from UCamRad.

References UCamBase::dev, UCamDevBase::isLog(), UImageLog::logImage(), and logip.

Referenced by UFunctionCamBase::getCamAndRawImage(), and setImageLogging().

bool UCamMounted::saveCamSettings ( Uconfig ini,
const char *  mountkey 
)

Save camera settings using this key name. if no key is provided the camera name is used. Returns true if saved.

Referenced by getPosRot().

void UCamMounted::setClientInCharge ( int  client)
inline

Set this client in charge

References clientInControl, and getMtoPix().

Referenced by UFunctionCam::handleCamSetCommand().

void UCamMounted::setImageLogging ( UImageLog value)
inline

Set logfile pointer. if pointer objext is NULL, then no logging is performed.

References createVars(), img, logImage(), and logip.

Referenced by UCamPool::findDevices(), and UCamPool::makeDevice().

void UCamMounted::setMountName ( const char *  posName)
inline

Set the mount name (position indicator) for this camera

References UVariable::setValues(), and varMountName.

Referenced by UCamPool::makeDevice(), UFuncPiCam::run(), UFuncKinect::run(), and UComCamSml::setCamDevice().

void UCamMounted::setPosOnRobot ( UPosition pos,
URotation rot 
)

Take new image snapshot. Returns pointer to image if snapshot succeded. Returns NULL if failed Get snapshot image and remove radial error if it is default to do so. Get pointer to last captured image. Returns pointer to image, but image may be invalid. Set the camera position relative to the robot. It is assumed that the robot position is at floor level and oriented with forward beeing X, right is X and up is Z. Rotation around x is Omega, arounf Y is Phi and around Z is Kappa, positive is as for right hand coordinate systems. Pan-tilt is no longer supported

References UPosRot::set().

Referenced by UCamPool::decodeReplayLine(), UComCamSml::setCamDevice(), and test3DtoPix().

void UCamMounted::setPosOnRobot ( UPosRot pose3d)

Set camera position from 3D pose structure

References UVariable::set6D(), and varCamPose.

void UCamMounted::setPosOnRobotCC ( UPosition pos,
URotation rot 
)
inline

Set the camera position relative to the robot from camera coordinates (x is right, y is up and z is back).

References URotation::Kappa, URotation::Omega, URotation::Phi, UPosRot::set(), UVariable::set6D(), varCamPose, UPosition::x, UPosition::y, and UPosition::z.

Referenced by UCalibrate::findGmk().

Member Data Documentation

int UCamMounted::clientInControl
protected

Rotation of camera relative to robot Position of camera relative to robot Inner orientation (3x3) pixel image to (top-left) pixel inner image plane to pixel image (3x3) Image to pixel mb * mP (3x3) Pixel to image (mb * mP).inverse Client in control of camera

Referenced by isClientInCharge(), setClientInCharge(), and UCamMounted().

UImageLog* UCamMounted::logip
protected

Last snapshot taken Reference to pool of images Camera position name Logfile for saved images (pointer to), the file itself is maintained by the camera pool

Referenced by logImage(), setImageLogging(), and UCamMounted().

UVariable* UCamMounted::varCamPose
protected
UVariable* UCamMounted::varMountName
protected

mount name for camera

Referenced by createVars(), getPosName(), setMountName(), and UCamMounted().


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