Commit 208dfba8 authored by Kaspar Scharf's avatar Kaspar Scharf

BACKUP

parent 45a0ff97
......@@ -29,19 +29,20 @@ void PostProcessing::computeRelativeAngleYHeadToTorso() {
}
void PostProcessing::computeAndAddAnglesHead() {
void PostProcessing::computeAndAddAnglesHead(float currentGain) {
if (frames > 0 && hasValidHeadTransform && lastHeadTransformValid) {
glm::mat4 relativeHeadTransformFrame = realHeadTransform *
glm::inverse(realHeadTransformLast);
glm::mat4 relativeHeadTransformFrameVirtual = virtualHeadTransform *
glm::inverse(virtualHeadTransformLast);
/* glm::mat4 relativeHeadTransformFrameVirtual = virtualHeadTransform *
glm::inverse(virtualHeadTransformLast);*/
angleYHeadCurrentFrameDeg = glm::degrees(angleAroundGlobalY(glm::mat3(relativeHeadTransformFrame)));
accumulatedAngleYHeadDeg += angleYHeadCurrentFrameDeg;
angleYHeadCurrentFrameVirtualDeg = glm::degrees(angleAroundGlobalY(glm::mat3(relativeHeadTransformFrameVirtual)));
//angleYHeadCurrentFrameVirtualDeg = glm::degrees(angleAroundGlobalY(glm::mat3(relativeHeadTransformFrameVirtual))); //problem for resets because of jumps
angleYHeadCurrentFrameVirtualDeg = currentGain * angleYHeadCurrentFrameDeg;
accumulatedAngleYHeadVirtualDeg += angleYHeadCurrentFrameVirtualDeg;
angleXHeadCurrentFrameDeg = glm::degrees(angleAroundLocalX(glm::mat3(relativeHeadTransformFrame)));
......@@ -49,7 +50,7 @@ void PostProcessing::computeAndAddAnglesHead() {
assert(!isnanf(angleXHeadCurrentFrameDeg));
assert(!isnanf(angleXHeadDeg));
angleXHeadTotalDeg += fabs(angleXHeadCurrentFrameDeg);
absAccumulatedAngleXHeadDeg += fabs(angleXHeadCurrentFrameDeg);
} else {
angleYHeadCurrentFrameDeg = 0.;
angleXHeadCurrentFrameDeg = 0.;
......@@ -70,13 +71,13 @@ void PostProcessing::computeAndAddAngleYTorso() {
}
}
void PostProcessing::computeAndAddAngleYTorsoVirtual() {
if (hasValidTorsoTransform && hasValidHeadTransform) {
accumulatedAngleYTorsoVirtualDeg = accumulatedAngleYHeadVirtualDeg - relativeAngleYHeadTorsoDeg;
}
}
//void PostProcessing::computeAndAddAngleYTorsoVirtual() {
//
// if (hasValidTorsoTransform && hasValidHeadTransform) {
// accumulatedAngleYTorsoVirtualDeg = accumulatedAngleYHeadVirtualDeg - relativeAngleYHeadTorsoDeg;
// }
//
//}
......@@ -108,6 +109,15 @@ void PostProcessing::checkForValidTransforms() {
((hasBodyTorsoBack || hasBodyTorsoFront) && hasValidTorsoOffsets)
);
}
//hasValidHeadTransform = true;
//hasBodyTorsoFront = true;
//hasBodyTorsoBack = true;
//hasValidTorsoTransform = true;
}
std::string PostProcessing::GetCleanedStringFromDataLine(std::string line) {
......@@ -124,6 +134,7 @@ std::string PostProcessing::GetCleanedStringFromDataLine(std::string line) {
std::getline(ssLine, token, ','); //gain
std::string stringGain = token;
float gain = ReadFloat(token);
std::getline(ssLine, token, ','); //matrix (real head)
realHeadTransform = ReadMat4(token);
......@@ -155,7 +166,7 @@ std::string PostProcessing::GetCleanedStringFromDataLine(std::string line) {
computeTorsoTransform();
computeRelativeAngleYHeadToTorso();
computeAndAddAnglesHead();
computeAndAddAnglesHead(gain);
computeAndAddAngleYTorso();
computeAndAddAngleYTorsoVirtual();
......@@ -186,46 +197,48 @@ std::string PostProcessing::GetCleanedStringFromDataLine(std::string line) {
std::string lineOut = "";
std::string torsoTransformString = "UNDEFINED";
std::string relativeAngleYString = "UNDEFINED";
//std::string virtualTorsoAngleYString = "UNDEFINED";
std::string positionHeadRealString = "UNDEFINED";
std::string positionHeadVirtualString = "UNDEFINED";
if (hasValidHeadTransform) {
//Skip (return empty string) if there is no valid head transform.
std::string torsoTransformString = "UNDEFINED";
std::string relativeAngleYString = "UNDEFINED";
std::string virtualTorsoAngleYString = "UNDEFINED";
if(hasValidTorsoTransform) {
torsoTransformString = getMatlabString(realTorsoTransform);
//relativeAngleString = std::to_string(relativeAngleHeadTorso);
if (hasValidHeadTransform) {
relativeAngleYString = R2S(relativeAngleYHeadTorsoDeg);
virtualTorsoAngleYString = R2S(accumulatedAngleYTorsoVirtualDeg);
}
}
positionHeadRealString = getMatlabStringPositionXnegativeZWithOffsetCorrection(realHeadTransform);
positionHeadVirtualString = getMatlabStringPositionXnegativeZWithOffsetCorrection(virtualHeadTransform);
}
if (hasValidTorsoTransform) {
torsoTransformString = getMatlabString(realTorsoTransform);
}
lineOut =
//stringTimestamp + "," + //OK
//stringGain + "," + //OK
if (hasValidTorsoTransform && hasValidHeadTransform) {
relativeAngleYString = R2S(relativeAngleYHeadTorsoDeg);
//virtualTorsoAngleYString = R2S(accumulatedAngleYTorsoVirtualDeg);
}
//getMatlabStringPositionXnegativeZWithOffsetCorrection(realHeadTransform) + "," + //OK
//getMatlabStringPositionXnegativeZWithOffsetCorrection(virtualHeadTransform) + "," + //OK
lineOut =
stringTimestamp + "," + //OK
stringGain + "," + //OK
//R2S(angleXHeadDeg) + "," + //OK
//R2S(angleXHeadTotalDeg) + "," + //OK
positionHeadRealString + "," + //OK
positionHeadVirtualString + "," + //OK
R2S(accumulatedAngleYHeadDeg) + "," +
R2S(accumulatedAngleYTorsoDeg) + "," +
R2S(angleXHeadDeg) + "," +
R2S(absAccumulatedAngleXHeadDeg) + "," +
R2S(accumulatedAngleYHeadVirtualDeg) + "," +
virtualTorsoAngleYString + "," +
R2S(accumulatedAngleYHeadDeg) + "," +
R2S(accumulatedAngleYTorsoDeg) + "," +
relativeAngleYString + "," +
R2S(accumulatedAngleYHeadVirtualDeg) + "," +
//virtualTorsoAngleYString + "," +
stringTotalDistance + "," + // Reihenfolge
stringTotalAngleYReal + "," + // falsch
stringTotalAngleYVirtual // gewesen ist.
;
relativeAngleYString + "," +
}
stringTotalDistance + "," +
stringTotalAngleYReal + "," +
stringTotalAngleYVirtual
;
frames ++;
lastTorsoTransformValid = hasValidTorsoTransform;
......
......@@ -49,17 +49,17 @@ private:
float accumulatedAngleYHeadDeg = 0.0f;
float angleXHeadDeg = 0.0f;
float accumulatedAngleYTorsoDeg = 0.0f;
float angleXHeadTotalDeg = 0.0f;
float absAccumulatedAngleXHeadDeg = 0.0f;
float angleYHeadCurrentFrameVirtualDeg;
float angleYTorsoCurrentFrameVirtualDeg;
//float angleYTorsoCurrentFrameVirtualDeg;
float accumulatedAngleYHeadVirtualDeg = 0.0f;
float accumulatedAngleYTorsoVirtualDeg = 0.0f;
//float accumulatedAngleYTorsoVirtualDeg = 0.0f;
void checkForValidTransforms();
void computeRelativeAngleYHeadToTorso();
void computeAndAddAnglesHead();
void computeAndAddAnglesHead(float currentGain);
void computeAndAddAngleYTorso(); //Call AFTER torso transform is calculated
//void computeAndAddAngleXHead();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment