Start Madwick filters.

This commit is contained in:
2019-08-06 22:49:20 -07:00
parent 7a932f422a
commit 971f324d7f
9 changed files with 286 additions and 69 deletions

View File

@@ -34,12 +34,12 @@ convertEulerToQuat(char **argv)
static void
convertQuatToEuler(char **argv)
{
double x = stod(string(argv[0]));
double y = stod(string(argv[1]));
double z = stod(string(argv[1]));
double w = stod(string(argv[1]));
double x = stod(string(argv[1]));
double y = stod(string(argv[2]));
double z = stod(string(argv[3]));
double w = stod(string(argv[0]));
geom::Quaterniond quaternion {x, y, z, w};
geom::Quaterniond quaternion {w, x, y, z};
auto euler = quaternion.euler() * (180.0 / M_PI);
cout << "Euler ZYX: " << euler << endl;

28
tools/quaternion.cc Normal file
View File

@@ -0,0 +1,28 @@
#include <cstdlib>
#include <iostream>
#include <string>
#include <wrmath/geom/vector.h>
#include <wrmath/geom/quaternion.h>
using namespace std;
using namespace wr::geom;
int
main(int argc, char **argv)
{
if (argc != 5) {
cerr << "Usage: quaternion w x y z" << endl;
return EXIT_FAILURE;
}
double w = stod(string(argv[1]));
double x = stod(string(argv[2]));
double y = stod(string(argv[3]));
double z = stod(string(argv[4]));
Vector3d frame {x, y, z};
Quaterniond quat = quaternion(frame, w);
cout << quat << endl;
}