Skip to content

Instantly share code, notes, and snippets.

View MalcolmMielle's full-sized avatar
🦝
Having fun

Malcolm Mielle MalcolmMielle

🦝
Having fun
View GitHub Profile
@MalcolmMielle
MalcolmMielle / pr.prompt
Created November 21, 2024 10:48
A prompt file for continue.dev to review a PR exported to a patch file
temperature: 0.5
maxTokens: 4096
---
<system>
You will be acting as a senior software engineer explaining and reviewing a PR with a colleague.
</system>
Start by greeting your collegue.
@MalcolmMielle
MalcolmMielle / graph.py
Created January 17, 2024 17:05
Set up matlplotlib to get the same beautiful graph that I had in gnuplot
# This script will create a graph with a light grey grid to see the spacing between values
# The axis will be visible only on the bottom and left, and both the axis and labels will
# be light blue/green
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use("pgf")
matplotlib.rcParams.update(
{
@MalcolmMielle
MalcolmMielle / IMURPYKalmanFilter.py
Last active July 3, 2024 09:18
Kalman filter to calculate roll pitch yaw. Based on the BaseKalman in KalmanFilter.py
def convert_acc(acc):
"""Convert raw accelerometer measurements in roll pitch yaw
https://stackoverflow.com/questions/3755059/3d-accelerometer-calculate-the-orientation
The yaw equation comes from here https://robotics.stackexchange.com/questions/14305/yaw-from-accelerometer-no-so-what-do-these-equations-actually-mean
If you have a magnetometer check out https://habr.com/en/post/499190/
Args:
acc (np.array): Array containing the three raw measurements on the accelerometer along
x, y, z
Returns:
@MalcolmMielle
MalcolmMielle / KalmanFilter.py
Created December 31, 2020 11:38
A base class for (Extended) Kalman Filter
from typing import Tuple
import numpy as np
class BaseKF:
"""This class can hold either a Kalman filter or an extended kalman filter depending on
the way f and h are implemented.
"""
def __init__(self, z0: np.array, r: np.array, q: np.array, pval=0.1) -> None:
self.x_sk = z0
self.n = q.shape[0] # number of state