#ifndef __JDB_JAHRSTOOLKIT__ #define __JDB_JAHRSTOOLKIT__ #include "JDB/JAHRS.hh" #include "JTools/JRange.hh" /** * \author mdejong */ namespace JDATABASE {} namespace JPP { using namespace JDATABASE; } namespace JDATABASE { /** * Auxiliary data structure to check validity of AHRS data. */ struct JAHRSValidity { typedef JTOOLS::JRange range_type; /** * Default constructor. * * This constructor sets default ranges of acceptance of AHRS values. */ JAHRSValidity() { A = range_type(0.5, 1.5); H = range_type(0.1, 0.6); } /** * Check validity of AHRS data. * * \param parameters AHRS data * \return true if valid; else false */ bool operator()(const JAHRS& parameters) const { double A0 = parameters.AHRS_A0; double A1 = parameters.AHRS_A1; double A2 = parameters.AHRS_A2; double H0 = parameters.AHRS_H0; double H1 = parameters.AHRS_H1; double H2 = parameters.AHRS_H2; return (A(sqrt(A0 * A0 + A1 * A1 + A2 * A2)) && H(sqrt(H0 * H0 + H1 * H1 + H2 * H2))); } range_type A; range_type H; }; } #endif