AURobotServers
4
|
#include <u3d.h>
Public Member Functions | |
void | add (URotation *rot) |
void | add (URotation rot) |
void | add (double iOmega, double iPhi, double iKappa) |
URotation | added (URotation *rot) |
UMatrix4 | asMatrix3x3CtoW () |
UMatrix4 | asMatrix3x3K () |
UMatrix4 | asMatrix3x3Kt () |
UMatrix4 | asMatrix3x3MtoR () |
UMatrix4 | asMatrix3x3O () |
UMatrix4 | asMatrix3x3Ot () |
UMatrix4 | asMatrix3x3P () |
UMatrix4 | asMatrix3x3Pt () |
UMatrix4 | asMatrix3x3RtoM () |
UMatrix4 | asMatrix3x3WtoC () |
UMatrix4 | asMatrix4x4CtoW () |
UMatrix4 | asMatrix4x4CtoW (UPosition *pos) |
UMatrix4 | asMatrix4x4MtoR () |
UMatrix4 | asMatrix4x4MtoR (UPosition *pos) |
UMatrix4 | asMatrix4x4MtoR (UPosition pos) |
UMatrix4 | asMatrix4x4RtoM () |
UMatrix4 | asMatrix4x4RtoM (UPosition *pos) |
UMatrix4 | asMatrix4x4RtoM (UPosition pos) |
UMatrix4 | asMatrix4x4WtoC () |
UMatrix4 | asMatrix4x4WtoC (UPosition *pos) |
UMatrix4 | asUnitZVector3CtoW () |
UMatrix4 | asUnitZVector4CtoW () |
UMatrix4 | asVector3 () |
UMatrix4 | asVector4 () |
void | clear (void) |
virtual const char * | codeXml (char *buff, const int buffCnt, const char *extra) |
virtual const char * | codeXml (const char *name, char *buff, const int buffCnt, const char *extra) |
int | copy (UMatrix4 *rot) |
int | copy (UPosition *pos) |
URotation * | getRot () |
void | LimitToPi () |
void | limitToPi () |
bool | load (const char *valueString) |
int | LoadFromReg (Uconfig *ini, const char *subject, const char *key) |
URotation | operator* (double val) |
void | operator*= (double val) |
URotation | operator+ (URotation rot) |
void | operator+= (URotation rot) |
URotation | operator- (URotation rot) |
void | operator-= (URotation rot) |
URotation | operator= (UMatrix4 vec) |
URotation | operator= (UPosition pos) |
void | print (const char *leadString) |
bool | save (FILE *fmap, const char *key) |
int | SaveToReg (Uconfig *ini, const char *subject, const char *key) |
void | scale (double val) |
URotation | scaled (double val) |
void | set (double iOmega, double iPhi, double iKappa) |
void | setFromYZ (UPosition posY, UPosition posZ) |
void | setRot (URotation rot) |
void | show (const char *leadString) |
void | snprint (const char *leadString, bool inDegree, char *s, const int bufferLength) |
void | sprint (char *s, const char *leadString, bool inDegree=true) |
void | subtract (URotation *rot) |
URotation | subtracted (URotation *rot) |
URotation () | |
URotation (double iOmega, double iPhi, double iKappa) | |
virtual | ~URotation () |
Public Attributes | |
double | Kappa |
double | Omega |
double | Phi |
General class to hold rotation around x,y,z axiz Omega is rotation around x axis Phi is rotation around y axis Kappa is rotation around z axis (unit is radians - right hand rotation)
Normal rotation order is Phi then Omega then Kappa just like a crane with a camera at the top This order is assumed in all camera conversion functions.
URotation::URotation | ( | ) |
Constructor with default initialization.
|
virtual |
destructor
URotation::URotation | ( | double | iOmega, |
double | iPhi, | ||
double | iKappa | ||
) |
Constructor with specific initialization
void URotation::add | ( | URotation * | rot | ) |
Just add parameter rotation to this and adjust result to within +/- PI.
References Kappa, LimitToPi(), Omega, and Phi.
Referenced by operator+=().
void URotation::add | ( | URotation | rot | ) |
Just as above, but parameter is not a pointer
References Kappa, LimitToPi(), Omega, and Phi.
void URotation::add | ( | double | iOmega, |
double | iPhi, | ||
double | iKappa | ||
) |
Add values directly, and adjust result to +/- PI;
References Kappa, LimitToPi(), Omega, and Phi.
Return a value, that is the sum of this and the parameter. This value is unchanged.
References Kappa, LimitToPi(), Omega, and Phi.
Referenced by operator+().
UMatrix4 URotation::asMatrix3x3CtoW | ( | ) |
Get transformation matrix to convert a 3D position [x,y,z] from camera to world perspective using both camera rotation only. Matrix is calculated as: P' * O' * K'
usage: Xw = asMatrix4x4CtoW(&pos) * Xc
where Xc is 3D coordinates in camera perspective and Xw is the same in world perspective.
References UMatrix::get(), Kappa, Omega, Phi, and UMatrix::setRC().
Referenced by asMatrix4x4CtoW(), asUnitZVector3CtoW(), and testMatrix().
UMatrix4 URotation::asMatrix3x3K | ( | ) |
Get rotation matrix around Z axis only
References UMatrix::get(), Kappa, and UMatrix::setRC().
Referenced by asMatrix3x3MtoR().
UMatrix4 URotation::asMatrix3x3Kt | ( | ) |
Get rotation matrix around Z axis only and transposed
References UMatrix::get(), Kappa, and UMatrix::setRC().
Referenced by asMatrix3x3RtoM().
UMatrix4 URotation::asMatrix3x3MtoR | ( | ) |
Get rotation matrix to rotate a position from map coordinates to robot coordinates
References asMatrix3x3K(), asMatrix3x3O(), and asMatrix3x3P().
Referenced by asMatrix4x4MtoR().
UMatrix4 URotation::asMatrix3x3O | ( | ) |
Get rotation matrix around X axis only
References UMatrix::get(), Omega, and UMatrix::setRC().
Referenced by asMatrix3x3MtoR().
UMatrix4 URotation::asMatrix3x3Ot | ( | ) |
Get rotation matrix around X axis only and transposed
References UMatrix::get(), Omega, and UMatrix::setRC().
Referenced by asMatrix3x3RtoM().
UMatrix4 URotation::asMatrix3x3P | ( | ) |
Get rotation matrix around Y axis only
References UMatrix::get(), Phi, and UMatrix::setRC().
Referenced by asMatrix3x3MtoR().
UMatrix4 URotation::asMatrix3x3Pt | ( | ) |
Get rotation matrix around Y axis only and transposed
References UMatrix::get(), Phi, and UMatrix::setRC().
Referenced by asMatrix3x3RtoM().
UMatrix4 URotation::asMatrix3x3RtoM | ( | ) |
Get rotation matrix to rotate a position from robot coordinates to map coordinates
References asMatrix3x3Kt(), asMatrix3x3Ot(), and asMatrix3x3Pt().
Referenced by asMatrix4x4RtoM().
UMatrix4 URotation::asMatrix3x3WtoC | ( | ) |
Gets rotation and conversion matrix:
Camera to World (CtoW) and World to Camera (WtoC)
all based on rotation seen in world coordinate perspective
with first turn around Y axis (up) left is positiove
then elevate around x axis (right) up is positive
then rotate around z axis (back) ccv is positive
translation position (pos) is camera position in world coordinates.
References UMatrix::get(), Kappa, Omega, Phi, and UMatrix::setRC().
Referenced by asMatrix4x4WtoC(), and testMatrix().
UMatrix4 URotation::asMatrix4x4CtoW | ( | ) |
Get transformation matrix to convert a 3D position [x,y,z,1] from camera to world perspective using both camera rotation only. Matrix is calculated as: P' * O' * K'
usage: Xw = asMatrix4x4CtoW(&pos) * Xc
where Xc is 3D coordinates in camera perspective and Xw is the same in world perspective.
References asMatrix3x3CtoW(), and UMatrix::expand().
Referenced by asMatrix4x4CtoW(), and UCalibrationMarkSet::geterrorInPixels().
Get transformation matrix to convert a 3D position [x,y,z,1] from camera to world perspective using both camera rotation and position. Matrix is calculated as: T(-pos) * P' * O' * K'
usage: Xw = asMatrix4x4CtoW(&pos) * Xc
where Xc is 3D coordinates in camera perspective and Xw is the same in world perspective.
References UPosition::asMatrix4x4(), asMatrix4x4CtoW(), and UPosition::scale().
UMatrix4 URotation::asMatrix4x4MtoR | ( | ) |
Get rotation matrix to rotate a position from map coordinates to robot coordinates.
Returns 4x4 matrix.
References asMatrix3x3MtoR(), and UMatrix::expand().
Referenced by asMatrix4x4MtoR(), UClientFuncLaserGui::doImage(), UPosRot::getMtoRMatrix(), UImgPolyProj::getRobToCam(), UImgProj::getRobToCam(), setFromYZ(), and testUPosRot().
Makes rotation translation matrix from map coordiantes to robot coordinates,with the following robot coordinates X is forward, Y is left, Z is Up.
(Right hand coordinates)
Phi (P) is y-axis (robot nose up or down down is positive)
Omega (O) is x-axis (tilt robot left or right, right is positive)
Kappa (K) is z axis (turn robot left or right, left is positive)
pos (T) is is position of robot in world coordinates (meter). Returns a 4x4 matrix.
References UPosition::asMatrix4x4(), and asMatrix4x4MtoR().
Same as above, but full position as parameter
References asMatrix4x4MtoR().
Referenced by asMatrix4x4MtoR().
UMatrix4 URotation::asMatrix4x4RtoM | ( | ) |
Get rotation matrix to rotate a position from robot coordinates to map coordinates.
Returns 4x4 matrix.
References asMatrix3x3RtoM(), and UMatrix::expand().
Referenced by asMatrix4x4RtoM(), UClientFuncLaserGui::doImage(), UImgProj::getCamToRob(), UImgPolyProj::getCamToRob(), UClientFuncLaserGui::getPixToRobFloor(), UPosRot::getRtoMMatrix(), UOriPlane::set(), and testUPosRot().
Makes rotation translation matrix from robot coordiantes to map coordinates,with the following robot coordinates.
X is forward, Y is left, Z is Up. (Right hand coordinates)
Phi (P) is y-axis (robot nose up or down down is positive)
Omega (O) is x-axis (tilt robot left or right, right is positive)
Kappa (K) is z axis (turn robot left or right, left is positive)
pos (T) is is position of robot in world coordinates (meter). Returns a 4x4 matrix.
References UPosition::asMatrix4x4(), asMatrix4x4RtoM(), and UPosition::scale().
Same as above, but full position as parameter
References asMatrix4x4RtoM().
Referenced by asMatrix4x4RtoM().
UMatrix4 URotation::asMatrix4x4WtoC | ( | ) |
Phi (P) is y-axis (turn camera to the left is positive)
Omega (O) is x-axis (tilt camera up towards cealing is positive)
Kappa (K) is z axis (rotate camera ccv is positive)
usage: matrix from world to camera oriented coordinates is K * O * P (* T).
References asMatrix3x3WtoC(), and UMatrix::expand().
Referenced by asMatrix4x4WtoC(), and UCalibrationMarkSet::geterrorInPixels().
Phi (P) is y-axis (turn camera to the left is positive)
Omega (O) is x-axis (tilt camera up towards cealing is positive)
Kappa (K) is z axis (rotate camera ccv is positive)
Matrix from world to camera oriented coordinates is K * O * P * pos).
Usage: Xc = asMatrix4x4WtoC(&pos) * Xw,
where Xc is 3D coordinates in camera perspective and Xw is the same in world perspective.
References UPosition::asMatrix4x4(), and asMatrix4x4WtoC().
UMatrix4 URotation::asUnitZVector3CtoW | ( | ) |
Returns a unit vector in z-direction in camera coordinates rotated by this rotation, assuming this is the camera rotation: returns R * (0, 0, -1).
References asMatrix3x3CtoW(), and UMatrix::setAt().
Referenced by asUnitZVector4CtoW().
UMatrix4 URotation::asUnitZVector4CtoW | ( | ) |
Returns a unit vector in z-direction in camera coordinates rotated by this rotation, assuming this is the camera rotation: returns R * (0, 0, -1, 1).
References asUnitZVector3CtoW(), UMatrix::init(), and UMatrix::setAt().
UMatrix4 URotation::asVector3 | ( | ) |
Converts parameters to vector format. Returns (Omega, Phi, Kappa).
References UPosition::asVector3(), and UPosition::copy().
UMatrix4 URotation::asVector4 | ( | ) |
Converts parameters to vector format. Returns (Omega, Phi, Kappa, 1).
References UPosition::asVector4(), and UPosition::copy().
void URotation::clear | ( | void | ) |
Set all values to zero.
Referenced by UPosRot::clear(), UImage::GetNewNonCameraImage(), UOriPlane::set(), UImage::UImage(), and UOriPlane::UOriPlane().
|
virtual |
Code this structure in XML format. The open tag includes any additional XML attributes from the codeXmlAttributes function call
buff | is the character buffer where the attributes are stored |
buffCnt | is the amount of buffer space allocated |
extra | is an extra attribute string that is added to the tag |
References Kappa, Omega, and Phi.
Referenced by codeXml(), and UFunctionLaser::handleSetCommand().
|
virtual |
Code this structure in XML format. The open tag includes any additional XML attributes from the codeXmlAttributes function call
optional | name value for a name attribute (if NULL, no name attribute. |
buff | is the character buffer where the attributes are stored |
buffCnt | is the amount of buffer space allocated |
extra | is an extra attribute string that is added to the tag |
References codeXml().
int URotation::copy | ( | UMatrix4 * | rot | ) |
Copy rotation data from vector , assuming that first element is Omega, second is Phi and third is Kappa. If size 4 vector then fourth value is assumed scale.
References UPosition::copy(), Kappa, Omega, Phi, UPosition::x, UPosition::y, and UPosition::z.
Referenced by LoadFromReg(), and operator=().
int URotation::copy | ( | UPosition * | pos | ) |
Copy values from a position, transferring Omega = x, Phi = y, Kappa = z.
References Kappa, Omega, Phi, UPosition::x, UPosition::y, and UPosition::z.
|
inline |
Get a pointer to this URotation value (for decendent classes)
References add.
Referenced by UPosRot::getRot(), and UPosRot::rot().
void URotation::LimitToPi | ( | ) |
Limit Omega, Phi and Kappa to within the -Pi to -Pi limit.
References Kappa, Omega, and Phi.
Referenced by add(), added(), UCalibrate::findBarcodeChartPosition(), set(), subtract(), and subtracted().
|
inline |
lower initial letter version. Limit Omega, Phi and Kappa to within the -Pi to -Pi limit.
bool URotation::load | ( | const char * | valueString | ) |
int URotation::LoadFromReg | ( | Uconfig * | ini, |
const char * | subject, | ||
const char * | key | ||
) |
Load rotation values from configuration structure 'ini' as found under the provided subject and key. If subject or key do not exist, then rotation is cleared.
References copy(), Kappa, UPosition::LoadFromReg(), Omega, and Phi.
URotation URotation::operator* | ( | double | val | ) |
Make scaled version of a rotation set
References scaled().
void URotation::operator*= | ( | double | val | ) |
Scale this rotation set with a factor
References scale().
Make diffrence of two rotation sets
References subtracted().
void URotation::operator-= | ( | URotation | rot | ) |
Subtract an angle set to this value
References subtract().
Function as copy described above. Copy a vector to a rotation type, from vector [Omega, Phi, Kappa], or from vector [w * Omega, w * Phi, w * Kappa, w].
References copy().
Copy a 3D position as a rotation type.
References add.
void URotation::print | ( | const char * | leadString | ) |
Print the values of the rotation to the console directly, with the provided string as lead in string.
References Kappa, Omega, and Phi.
Referenced by testUPosRot().
bool URotation::save | ( | FILE * | fmap, |
const char * | key | ||
) |
int URotation::SaveToReg | ( | Uconfig * | ini, |
const char * | subject, | ||
const char * | key | ||
) |
Save rotation values to configuration structure under the provided subject and key. If subject or key do not exist then it is created.
References UPosition::copy(), and UPosition::SaveToReg().
void URotation::scale | ( | double | val | ) |
Scale this rotation with provided factor.
References Kappa, Omega, and Phi.
Referenced by UCalibrationMarkSet::evaluateChartPosRot(), and operator*=().
URotation URotation::scaled | ( | double | val | ) |
Return a scaled verion of this rotation, caled with this factor.
References Kappa, Omega, and Phi.
Referenced by UCamParEst::adjustParameters35(), and operator*().
void URotation::set | ( | double | iOmega, |
double | iPhi, | ||
double | iKappa | ||
) |
Set value directly
References Kappa, LimitToPi(), Omega, and Phi.
Referenced by UCamParEst::adjustParameters35(), UClientFuncLaserGui::doImage(), UCalibrationMarkSet::evaluateChartPosRot(), UCalibrationMarkSet::evaluatePosRot(), UCalibrate::findGmk(), UVariable::getRot(), UPosRot::set(), UPosRot::setFromPose(), testImageHandling(), testImageLoadSave(), testMatrixVecBig(), testOriPlane(), testPlane(), testUPosRot(), UImgPolyProj::UImgPolyProj(), and UImgProj::UImgProj().
Set rotation from these 2 vectors pointing in Y and Z direction (robot coordinate type). Rotation is set as azimult first - a rotation arounf Z axis (positive CCV) (kappa). then as elevation +/- PI/2 around the Y axis (Phi) positive down. And finally rotation around the x axis (+/- Pi) - positive to the right (Omega)
References asMatrix4x4MtoR(), UPosition::clear(), UPosition::cross(), Kappa, Omega, Phi, UPosition::toUnitVector(), UPosition::x, UPosition::y, and UPosition::z.
Referenced by UPosRot::setCtoR(), UPosRot::setRtoC(), and testUPosRot().
|
inline |
Set value directly
Referenced by UPosRot::set(), and UPosRot::setRot().
|
inline |
Print the values of the rotation to the console directly, with the provided string as lead in string.
References DoFindPeak().
void URotation::snprint | ( | const char * | leadString, |
bool | inDegree, | ||
char * | s, | ||
const int | bufferLength | ||
) |
As above function, but with limit on buffer length.
References Kappa, Omega, and Phi.
Referenced by UCamPush::print(), and UClientCamData::snprint().
void URotation::sprint | ( | char * | s, |
const char * | leadString, | ||
bool | inDegree = true |
||
) |
Print values to string 's' with 'leadString' in front. Values are in degrees if 'inDegree' is true, else in radians.
References Kappa, Omega, and Phi.
Referenced by UCalibrationMarkSet::evaluateChartPosRot(), and UCalibrationMarkSet::evaluatePosRot().
void URotation::subtract | ( | URotation * | rot | ) |
Subtract parameter rotation from this, and adjust the result to within +/- PI.
References Kappa, LimitToPi(), Omega, and Phi.
Referenced by UCalibrationMarkSet::evaluateChartPosRot(), UCalibrationMarkSet::evaluatePosRot(), and operator-=().
Returns a value where the referenced is subtracted. This value is unchanged.
References Kappa, LimitToPi(), Omega, and Phi.
Referenced by operator-().
double URotation::Kappa |
Kappa is rotation around the z axis (rotate ccv is positive)
Referenced by add(), added(), asMatrix3x3CtoW(), asMatrix3x3K(), asMatrix3x3Kt(), asMatrix3x3WtoC(), clientCmdLine(), USmlTag::codeRotation(), UPcpItem::codeXML(), codeXml(), UPosition::copy(), copy(), UCamPool::decodeReplayLine(), UCalibrationMarkSet::evaluateChartPosRot(), UCalibrationMarkSet::evaluatePosRot(), UCalibrate::findBarcodeChartPosition(), UCalibrationMarkSet::geterrorInPixels(), UPosRot::getKappa(), USmlTag::getRotation(), UCamMounted::getRotCC(), UPosRot::getTheta(), UResCamIfCam::gotNewData(), UClientCamData::handleCamGet(), UFunctionCamGmk::handleGmkGetCommand(), UFuncLocalize::handleLocalizeMHF(), UFuncLocalize::handleLocalizeUKF(), UResPcp::handleNewData(), UFunctionLaser::handleSetCommand(), LimitToPi(), load(), LoadFromReg(), UImageLog::logImage(), UResLobst::makeObst(), UComCamSml::pack(), UPosRot::print(), print(), UFuncLocalize::projectToLaser(), UFuncLoca2::projectToLaser(), UFuncKinect::run(), save(), scale(), scaled(), UPosRot::set(), UPose::set(), set(), UVariable::set6D(), UCalibrationMarkSet::setBarcodePosRowSet(), UComCamSml::setCamDevice(), UCalibrationMarkSet::setCameraPosRowSet(), UImgPolyProj::setCamPos(), UImgProj::setCamPos(), UCamParEst::setEstMatrix(), UCamParEst::setEstMatrix35(), setFromYZ(), UPosRot::setKappa(), UCamMounted::setPosOnRobotCC(), UVariable::setRot(), UPosRot::setTheta(), snprint(), sprint(), subtract(), subtracted(), UResV360::update(), and UPose::UPose().
double URotation::Omega |
Omega is rotation around the x-axis (tilt up towards cealing is positive)
Referenced by add(), added(), asMatrix3x3CtoW(), asMatrix3x3O(), asMatrix3x3Ot(), asMatrix3x3WtoC(), clientCmdLine(), USmlTag::codeRotation(), UPcpItem::codeXML(), codeXml(), UPosition::copy(), copy(), UCamPool::decodeReplayLine(), UCalibrationMarkSet::evaluateChartPosRot(), UCalibrationMarkSet::evaluatePosRot(), UCalibrationMarkSet::geterrorInPixels(), UPosRot::getOmega(), USmlTag::getRotation(), UCamMounted::getRotCC(), UResCamIfCam::gotNewData(), UClientCamData::handleCamGet(), UFunctionCamGmk::handleGmkGetCommand(), UResPcp::handleNewData(), UFunctionLaser::handleSetCommand(), LimitToPi(), load(), LoadFromReg(), UImageLog::logImage(), UComCamSml::pack(), UPosRot::print(), print(), UFuncKinect::run(), save(), scale(), scaled(), set(), UVariable::set6D(), UCalibrationMarkSet::setBarcodePosRowSet(), UComCamSml::setCamDevice(), UCalibrationMarkSet::setCameraPosRowSet(), UImgProj::setCamPos(), UImgPolyProj::setCamPos(), UCamParEst::setEstMatrix(), UCamParEst::setEstMatrix35(), setFromYZ(), UCamMounted::setPosOnRobotCC(), UVariable::setRot(), snprint(), sprint(), subtract(), and subtracted().
double URotation::Phi |
Phi is rotation around the y-axis (rotate to the left is positive)
Referenced by add(), added(), asMatrix3x3CtoW(), asMatrix3x3P(), asMatrix3x3Pt(), asMatrix3x3WtoC(), clientCmdLine(), USmlTag::codeRotation(), UPcpItem::codeXML(), codeXml(), UPosition::copy(), copy(), UCamPool::decodeReplayLine(), UCalibrationMarkSet::evaluateChartPosRot(), UCalibrationMarkSet::evaluatePosRot(), UCalibrationMarkSet::geterrorInPixels(), UPosRot::getPhi(), USmlTag::getRotation(), UCamMounted::getRotCC(), UResCamIfCam::gotNewData(), UClientCamData::handleCamGet(), UFunctionCamGmk::handleGmkGetCommand(), UResPcp::handleNewData(), UFunctionLaser::handleSetCommand(), LimitToPi(), load(), LoadFromReg(), UImageLog::logImage(), UResLobst::makeObst(), UComCamSml::pack(), UPosRot::print(), print(), UFuncKinect::run(), save(), scale(), scaled(), set(), UVariable::set6D(), UCalibrationMarkSet::setBarcodePosRowSet(), UComCamSml::setCamDevice(), UCalibrationMarkSet::setCameraPosRowSet(), UImgPolyProj::setCamPos(), UImgProj::setCamPos(), UCamParEst::setEstMatrix(), UCamParEst::setEstMatrix35(), setFromYZ(), UCamMounted::setPosOnRobotCC(), UVariable::setRot(), snprint(), sprint(), subtract(), and subtracted().