-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMEKF.cpp
More file actions
36 lines (27 loc) · 730 Bytes
/
MEKF.cpp
File metadata and controls
36 lines (27 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <./Eigen/Dense>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/asio.hpp>
struct Packet {
uint32_t t;
float ax, ay, az;
float gx, gy, gz;
};
int main() {
boost::asio::io_service io;
boost::asio::serial_port port(io, "COM3");
port.set_option(boost::asio::serial_port_base::baud_rate(115200));
Packet p;
while (true) {
boost::asio::read(port, boost::asio::buffer(&p, sizeof(Packet)));
std::cout << p.t << " "
<< p.ax << " "
<< p.ay << " "
<< p.az << " "
<< p.gx << " "
<< p.gy << " "
<< p.gz << "\n";
// EKF update here (Eigen)
}
}