Start Madwick filters.
This commit is contained in:
@@ -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
28
tools/quaternion.cc
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user