mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-peak.git
synced 2025-09-29 06:37:33 +00:00
Continued Madgwick filter implementation
This commit is contained in:
@@ -6,13 +6,15 @@
|
||||
*/
|
||||
|
||||
#include <sta/math/algorithms/attitude/madgwick.hpp>
|
||||
#include <sta/math/linalg/matrix.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
MadgwickFilter::MadgwickFilter(Quaternion state, uint32_t n, float alpha)
|
||||
: state_{state.normalized()},
|
||||
MadgwickFilter::MadgwickFilter(Quaternion state, Quaternion direction, uint32_t n, float alpha)
|
||||
: state_{state},
|
||||
direction_{direction},
|
||||
n_{n},
|
||||
alpha_{alpha}
|
||||
{
|
||||
@@ -24,9 +26,20 @@ namespace sta
|
||||
state_ = state_ + 0.5f * (state_ * Quaternion(0, ox, oy, oz)) * dt;
|
||||
}
|
||||
|
||||
Quaternion MadgwickFilter::objective(Quaternion q, Quaternion s)
|
||||
{
|
||||
return q.conjugate() * direction_ * q - s;
|
||||
}
|
||||
|
||||
|
||||
void MadgwickFilter::correct(float dx, float dy, float dz)
|
||||
{
|
||||
|
||||
Quaternion q;
|
||||
|
||||
for (uint32_t i = 0; i < n_; i++)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user