mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-peak.git
synced 2025-08-06 13:27:34 +00:00
Updated quaternion class, added attitude from tilt, started madgwick filter
This commit is contained in:
48
include/sta/math/algorithms/attitude/madgwick.hpp
Normal file
48
include/sta/math/algorithms/attitude/madgwick.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* madgwick.hpp
|
||||
*
|
||||
* Created on: Jun 20, 2024
|
||||
* Author: Dario
|
||||
*/
|
||||
|
||||
#ifndef STA_MATHS_ATTITUDE_INTEGRATE_HPP
|
||||
#define STA_MATHS_ATTITUDE_INTEGRATE_HPP
|
||||
|
||||
#include <sta/math/quaternion.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
class MadgwickFilter {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Madgwick Filter object
|
||||
*
|
||||
* @param n
|
||||
* @param alpha
|
||||
*/
|
||||
MadgwickFilter(Quaternion state, uint32_t n, float alpha);
|
||||
|
||||
/**
|
||||
* @brief Predicts the next step using rotation rate ingegration.
|
||||
*
|
||||
* @param dt The time that passed since the last predict.
|
||||
* @param ox Rotation rate around the x axis in rad/s.
|
||||
* @param oy Rotation rate around the y axis in rad/s.
|
||||
* @param oz Rotation rate around the z axis in rad/s.
|
||||
*/
|
||||
void predict(float dt, float ox, float oy, float oz);
|
||||
|
||||
void correct(float dx, float dy, float dz);
|
||||
private:
|
||||
Quaternion state_;
|
||||
uint32_t n_;
|
||||
float alpha_;
|
||||
};
|
||||
} // namespace math
|
||||
} // namespace sta
|
||||
|
||||
|
||||
|
||||
#endif /* STA_MATHS_ATTITUDE_INTEGRATE_HPP */
|
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* slerp.hpp
|
||||
*
|
||||
* Created on: Jun 19, 2024
|
||||
* Author: Dario
|
||||
*/
|
||||
|
||||
#ifndef STA_MATHS_ATTITUDE_SLERP_HPP
|
||||
#define STA_MATHS_ATTITUDE_SLERP_HPP
|
||||
|
||||
#include <sta/math/quaternion.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
|
||||
Quaternion slerp(Quaternion q1, Quaternion q2, float beta);
|
||||
|
||||
} // namespace math
|
||||
} // namespace sta
|
||||
|
||||
#endif /* STA_MATHS_ATTITUDE_SLERP_HPP*/
|
22
include/sta/math/algorithms/attitude/tilt.hpp
Normal file
22
include/sta/math/algorithms/attitude/tilt.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* tilt.hpp
|
||||
*
|
||||
* Created on: Jun 20, 2024
|
||||
* Author: Dario
|
||||
*/
|
||||
|
||||
#ifndef STA_MATHS_ATTITUDE_TILT_HPP
|
||||
#define STA_MATHS_ATTITUDE_TILT_HPP
|
||||
|
||||
#include <sta/math/quaternion.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
Quaternion getTiltFromAcceleration(float ax, float ay, float az);
|
||||
|
||||
} // namespace math
|
||||
} // namespace sta
|
||||
|
||||
#endif /* STA_MATHS_ATTITUDE_TILT_HPP */
|
Reference in New Issue
Block a user