diff --git a/src/shared/logger/LogTypes.h b/src/shared/logger/LogTypes.h index 40ced42603e4e63b13363f9558612866753c578b..64d7423c7d957bd0548a46cf642a7a01128ecd95 100644 --- a/src/shared/logger/LogTypes.h +++ b/src/shared/logger/LogTypes.h @@ -79,6 +79,7 @@ #include <sensors/analog/pressure/nxp/MPXH6115AData.h> #include <sensors/analog/pressure/nxp/MPXH6400AData.h> #include <sensors/analog/pressure/nxp/MPXHZ6130AData.h> +#include <sensors/logAnglesData.h> #include <fstream> #include <iostream> diff --git a/src/shared/sensors/logAnglesData.h b/src/shared/sensors/logAnglesData.h new file mode 100644 index 0000000000000000000000000000000000000000..5632f109e2aeb60338bfadcd94f6119c1e44f824 --- /dev/null +++ b/src/shared/sensors/logAnglesData.h @@ -0,0 +1,26 @@ +#include <iostream> + +struct LogAngles +{ + float roll, pitch, yaw; + + LogAngles() : roll{0}, pitch{0}, yaw(0) {} + LogAngles(float Roll, float Pitch, float Yaw) + : roll{Roll}, pitch{Pitch}, yaw(Yaw) + { + } + + void getAngles(float x, float y, float z) + { + this->roll = x * (180 / M_PI); + this->pitch = y * (180 / M_PI); + this->yaw = z * (180 / M_PI); + } + + static std::string header() { return "Roll,Pitch,Yaw,quaternionZ\n"; } + + void print(std::ostream& os) const + { + os << roll << "," << pitch << "," << yaw << "\n"; + } +}; diff --git a/src/tests/sensors/logAnglesData.h b/src/tests/sensors/logAnglesData.h index bed3a055b178bdeafeb16474ca5902508325eade..90667e0b7276f7d1c14d7f729eac6420df5741b2 100644 --- a/src/tests/sensors/logAnglesData.h +++ b/src/tests/sensors/logAnglesData.h @@ -1,3 +1,6 @@ +#include <iostream> + +namespace Boardcore{ struct LogAngles { float roll, pitch, yaw; @@ -21,4 +24,5 @@ struct LogAngles { os << roll << "," << pitch << "," << yaw << "\n"; } -}; \ No newline at end of file +}; +} \ No newline at end of file