test_madgwick_arhs.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2019,
3  * Olivier Stasse,
4  *
5  * CNRS/AIST
6  *
7  */
8 
9 #include <iostream>
10 #include <sot/core/debug.hh>
11 
12 #ifndef WIN32
13 #include <unistd.h>
14 #endif
15 
16 using namespace std;
17 
18 #include <dynamic-graph/entity.h>
19 #include <dynamic-graph/factory.h>
20 
21 #include <sot/core/madgwickahrs.hh>
22 #include <sstream>
23 
24 using namespace dynamicgraph;
25 using namespace dynamicgraph::sot;
26 
27 #define BOOST_TEST_MODULE test - filter - differentiator
28 
29 #include <boost/test/output_test_stream.hpp>
30 #include <boost/test/unit_test.hpp>
31 
32 using boost::test_tools::output_test_stream;
33 
34 BOOST_AUTO_TEST_CASE(test_filter_differentiator) {
35  sot::MadgwickAHRS *aFilter = new MadgwickAHRS("MadgwickAHRS");
36 
37  double timestep = 0.001, beta = 0.01;
38  aFilter->init(timestep);
39  aFilter->set_beta(beta);
40 
41  srand(0);
43  dynamicgraph::Vector angvel(3);
44  acc(0) = 0.3;
45  acc(1) = 0.2;
46  acc(2) = 0.3;
47  aFilter->m_accelerometerSIN = acc;
48  angvel(0) = 0.1;
49  angvel(1) = -0.1;
50  angvel(2) = 0.3;
51  aFilter->m_gyroscopeSIN = angvel;
52  aFilter->m_imu_quatSOUT.recompute(0);
53  output_test_stream output;
54  ostringstream anoss;
55  aFilter->m_imu_quatSOUT.get(output);
56  aFilter->m_imu_quatSOUT.get(anoss);
57  std::cout << "anoss:" << anoss << std::endl;
58  BOOST_CHECK(
59  output.is_equal("82.5614\n"
60  "86.5403\n"
61  "78.5826\n"
62  "17.9049\n"
63  "96.4874\n"
64  "39.7886\n"
65  "91.5139\n"
66  "98.4769\n"
67  "56.6988\n"
68  "29.8415\n"
69  "71.6195\n"
70  "37.7992\n"
71  "101.461\n"
72  "71.6195\n"
73  "76.5931\n"
74  "40.7834\n"));
75 }
Eigen::VectorXd Vector
acc
void set_beta(const double &beta)
void init(const double &dt)
BOOST_AUTO_TEST_CASE(test_filter_differentiator)


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:26