9 #include "witmotion/types.h"
27 witmotion_typed_bytecounts();
46 uint8_t witmotion_baud_rate(
const QSerialPort::BaudRate rate);
48 bool id_registered(
const size_t id);
51 float decode_acceleration(
const int16_t* value);
52 float decode_angular_velocity(
const int16_t* value);
53 float decode_angle(
const int16_t* value);
54 float decode_temperature(
const int16_t* value);
55 float decode_orientation(
const int16_t* value);
56 void decode_gps_coord(
const int32_t* value,
68 uint16_t& millisecond);
93 double& longitude_deg,
94 double& longitude_min,
96 double& latitude_min);
99 float& angular_velocity,
100 double& ground_speed);
108 float& local_accuracy,
109 float& horizontal_accuracy,
110 float& vertical_accuracy);
113 template<
typename T> T variance(
const std::vector<T>& array)
115 T sum = std::accumulate(array.begin(), array.end(), 0.f);
116 T mean = sum /
static_cast<T>(array.size());
118 for(
auto i = array.begin(); i != array.end(); i++)
119 sq_dif += std::pow((*i) - mean, 2);
120 sq_dif /= (array.size() > 1) ?
static_cast<T>(array.size() - 1) : 1.f;
121 return std::sqrt(sq_dif);