ref #39 #40 moved all stuff left in KLib into Indoor. We are now able to perform localization without the need of KLib. Only K::Gnuplot is needed for drawing, but this will be separated into an own project in the future
This commit is contained in:
@@ -69,7 +69,33 @@ TEST(Distribution, VonMises) {
|
||||
}
|
||||
|
||||
|
||||
TEST(Distribution, normalCDF1) {
|
||||
|
||||
Distribution::NormalCDF<double> nd(0,1);
|
||||
ASSERT_NEAR(0.5, nd.getProbability(0), 0.00001);
|
||||
ASSERT_NEAR(0.5, Distribution::NormalCDF<double>::getProbability(0, 1, 0), 0.00001);
|
||||
|
||||
ASSERT_NEAR(1.0, nd.getProbability(5), 0.00001);
|
||||
ASSERT_NEAR(1.0, Distribution::NormalCDF<double>::getProbability(0, 1, 5), 0.00001);
|
||||
|
||||
ASSERT_NEAR(0.0, nd.getProbability(-5), 0.00001);
|
||||
ASSERT_NEAR(0.0, Distribution::NormalCDF<double>::getProbability(0, 1, -5), 0.00001);
|
||||
|
||||
}
|
||||
|
||||
TEST(Distribution, normalCDF2) {
|
||||
|
||||
Distribution::NormalCDF<double> nd(3,1);
|
||||
ASSERT_NEAR(0.5, nd.getProbability(3), 0.00001);
|
||||
ASSERT_NEAR(0.5, Distribution::NormalCDF<double>::getProbability(3, 1, 3), 0.00001);
|
||||
|
||||
ASSERT_NEAR(1.0, nd.getProbability(3+5), 0.00001);
|
||||
ASSERT_NEAR(1.0, Distribution::NormalCDF<double>::getProbability(3, 1, 3+5), 0.00001);
|
||||
|
||||
ASSERT_NEAR(0.0, nd.getProbability(3-5), 0.00001);
|
||||
ASSERT_NEAR(0.0, Distribution::NormalCDF<double>::getProbability(3, 1, 3-5), 0.00001);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//#include <fstream>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "../../../misc/Time.h"
|
||||
#include "../../../math/Interpolator.h"
|
||||
|
||||
#include"../../../sensors/pressure/ActivityButterPressure.h"
|
||||
#include"../../../sensors/activity/ActivityButterPressure.h"
|
||||
|
||||
#include <KLib/misc/gnuplot/Gnuplot.h>
|
||||
#include <KLib/misc/gnuplot/GnuplotPlot.h>
|
||||
|
||||
@@ -97,7 +97,8 @@ TEST(MotionDetection, motionAxis) {
|
||||
TEST(MotionDetection, motionAngle) {
|
||||
|
||||
MotionDetection md;
|
||||
TurnDetection td;
|
||||
PoseDetection pd;
|
||||
TurnDetection td(&pd);
|
||||
|
||||
//plot.gp << "set arrow 919 from " << tt.pos.x << "," << tt.pos.y << "," << tt.pos.z << " to "<< tt.pos.x << "," << tt.pos.y << "," << tt.pos.z+1 << "lw 3\n";
|
||||
|
||||
@@ -147,7 +148,7 @@ TEST(MotionDetection, motionAngle) {
|
||||
|
||||
} else if (e.type == Offline::Sensor::ACC) {
|
||||
const Offline::TS<AccelerometerData>& _acc = fr.getAccelerometer()[e.idx];
|
||||
td.addAccelerometer(ts, _acc.data);
|
||||
pd.addAccelerometer(ts, _acc.data);
|
||||
|
||||
} else if (e.type == Offline::Sensor::GYRO) {
|
||||
const Offline::TS<GyroscopeData>& _gyr = fr.getGyroscope()[e.idx];
|
||||
|
||||
@@ -6,33 +6,34 @@
|
||||
|
||||
TEST(TurnDetection, rotationMatrix) {
|
||||
|
||||
Eigen::Vector3f dst; dst << 0, 0, 1;
|
||||
Eigen::Vector3f src; src << 1, 1, 0; src.normalize();
|
||||
Vector3 dst(0, 0, 1);
|
||||
Vector3 src(1, 1, 0);
|
||||
src = src.normalized();
|
||||
|
||||
// get a matrix that rotates "src" into "dst"
|
||||
Eigen::Matrix3f rot = TurnDetection::getRotationMatrix(src, dst);
|
||||
Matrix3 rot = PoseDetection::getRotationMatrix(src, dst);
|
||||
|
||||
Eigen::Vector3f res = rot * src;
|
||||
Vector3 res = rot * src;
|
||||
|
||||
ASSERT_NEAR(dst(0), res(0), 0.01);
|
||||
ASSERT_NEAR(dst(1), res(1), 0.01);
|
||||
ASSERT_NEAR(dst(2), res(2), 0.01);
|
||||
ASSERT_NEAR(dst.x, res.x, 0.01);
|
||||
ASSERT_NEAR(dst.y, res.y, 0.01);
|
||||
ASSERT_NEAR(dst.z, res.z, 0.01);
|
||||
|
||||
}
|
||||
|
||||
TEST(TurnDetection, gyroRotate) {
|
||||
|
||||
|
||||
Eigen::Vector3f zAxis; zAxis << 0, 0, 1;
|
||||
Eigen::Vector3f acc; acc << 0, 7.0, 7.0;
|
||||
Vector3 zAxis(0, 0, 1);
|
||||
Vector3 acc(0, 7.0, 7.0);
|
||||
|
||||
Eigen::Matrix3f rot = TurnDetection::getRotationMatrix(acc, zAxis);
|
||||
Matrix3 rot = PoseDetection::getRotationMatrix(acc, zAxis);
|
||||
|
||||
Eigen::Vector3f gyro; gyro << 0, 60, 60;
|
||||
Vector3 gyro(0, 60, 60);
|
||||
|
||||
Eigen::Vector3f gyro2; gyro2 << 0, 0, 84;
|
||||
Vector3 gyro2(0, 0, 84);
|
||||
|
||||
Eigen::Vector3f gyro3 = rot * gyro;
|
||||
Vector3 gyro3 = rot * gyro;
|
||||
|
||||
ASSERT_NEAR(0, (gyro2-gyro3).norm(), 1.0);
|
||||
|
||||
@@ -41,10 +42,11 @@ TEST(TurnDetection, gyroRotate) {
|
||||
|
||||
TEST(TurnDetection, xx) {
|
||||
|
||||
Eigen::Vector3f dst; dst << 0, 0, 1;
|
||||
Eigen::Vector3f src; src << 0.0, 2.9, -10.0; src.normalize(); // sample accelerometer readings
|
||||
Vector3 dst(0, 0, 1);
|
||||
Vector3 src(0.0, 2.9, -10.0);
|
||||
src = src.normalized(); // sample accelerometer readings
|
||||
|
||||
Eigen::Matrix3f rot = TurnDetection::getRotationMatrix(src, dst);
|
||||
Matrix3 rot = PoseDetection::getRotationMatrix(src, dst);
|
||||
|
||||
// Eigen::Vector3f x; x << 1, 0, 0;
|
||||
// Eigen::Vector3f z = src.normalized();
|
||||
@@ -55,14 +57,14 @@ TEST(TurnDetection, xx) {
|
||||
// rot.row(1) = y;
|
||||
// rot.row(2) = z;
|
||||
|
||||
Eigen::Vector3f res = rot * src;
|
||||
Vector3 res = rot * src;
|
||||
// ASSERT_NEAR(dst(0), res(0), 0.01);
|
||||
// ASSERT_NEAR(dst(1), res(1), 0.01);
|
||||
// ASSERT_NEAR(dst(2), res(2), 0.01);
|
||||
|
||||
Eigen::Vector3f gyro; gyro << 0, 10, 30;
|
||||
Vector3 gyro(0, 10, 30);
|
||||
|
||||
Eigen::Vector3f gyro2 = rot * gyro;
|
||||
Vector3 gyro2 = rot * gyro;
|
||||
int i = 0; (void) i;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../../../sensors/pressure/RelativePressure.h"
|
||||
#include "../../../sensors/pressure/PressureTendence.h"
|
||||
#include "../../../sensors/pressure/ActivityButterPressure.h"
|
||||
#include "../../../sensors/pressure/ActivityButterPressurePercent.h"
|
||||
#include "../../../sensors/activity/ActivityButterPressure.h"
|
||||
#include "../../../sensors/activity/ActivityButterPressurePercent.h"
|
||||
|
||||
#include <random>
|
||||
|
||||
@@ -141,9 +141,10 @@ TEST(Barometer, Activity) {
|
||||
double value;
|
||||
|
||||
while (iss >> ts >> value) {
|
||||
ActivityButterPressure::Activity currentAct = act.add(Timestamp::fromMS(ts), BarometerData(value));
|
||||
act.add(Timestamp::fromMS(ts), BarometerData(value));
|
||||
Activity currentAct = act.get();
|
||||
rawHist.push_back(ActivityButterPressure::History(Timestamp::fromMS(ts), BarometerData(value)));
|
||||
actHist.push_back(ActivityButterPressure::History(Timestamp::fromMS(ts), BarometerData(currentAct)));
|
||||
actHist.push_back(ActivityButterPressure::History(Timestamp::fromMS(ts), BarometerData((int)currentAct)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user