From 34de1def3e21f3a97e6faa9c1fc993c1b94a1c2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Caruso?= <niccolo.caruso@skywarder.eu> Date: Thu, 6 Mar 2025 15:10:52 +0100 Subject: [PATCH] [ARP] logdecoder changes fot the logAnglesData struct --- src/shared/logger/LogTypes.h | 1 + src/shared/sensors/logAnglesData.h | 26 ++++++++++++++++++++++++++ src/tests/sensors/logAnglesData.h | 6 +++++- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/shared/sensors/logAnglesData.h diff --git a/src/shared/logger/LogTypes.h b/src/shared/logger/LogTypes.h index 40ced4260..64d7423c7 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 000000000..5632f109e --- /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 bed3a055b..90667e0b7 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 -- GitLab