<jupyter_start><jupyter_text>Madgwick bias analysisThe goal of this experiment is to estimate how much drift we will suffer from using Madgwick's algorithm. The gain was set to 0.1 and the setup was hold still on a table using a light weight. Before the experiment start, the setup was left to stabilize for ~10 minutes. The temperature, as reported by the IMU was about 40°C.<jupyter_code>import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
df = pd.read_csv('madgwick_bias.csv')
df.head()
for axis in 'XYZ':
    coeff = np.polyfit(df['ts'], df[axis], 1)
    drift = np.degrees(coeff[1]/1e6)
    plt.figure()
    plt.ylabel('Orientation (°)')
    plt.xlabel('Time (s)')
    plt.plot(df['ts']*1e-6, np.degrees(df[axis]))
    plt.plot(df['ts']*1e-6, np.degrees(np.polyval(coeff, df['ts'])), 'r')
    plt.title('Drift on {} axis ({:.2e} deg/s)'.format(axis, drift))
    plt.tight_layout()

    plt.gcf().savefig('madgwick_drift_{}.pdf'.format(axis))
    plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14480077745383868, 'fraction_numerical': 0.014577259475218658, 'mean_word_length': 4.449735449735449, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '205473', 'license': 'MIT', 'n_tokens_mistral': 376, 'n_tokens_neox': 366, 'n_words': 108, 'path': 'uwb-beacon-firmware/doc/report/experiments/Madgwick drift.ipynb', 'repo_name': 'greck2908/robot-software', 'size': '1029'}