This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' Mavlink telemetry (.tlog) file parser. | |
Operates as a generator. Allows csv output or listing useful types/fields. | |
''' | |
import json | |
from pathlib import Path | |
from fnmatch import fnmatch | |
from pymavlink import mavutil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% MATLAB Code for Offset-Free MPC Control of Heated Swimming Pool System | |
% Clear workspace and command window | |
clear; close all; clc; | |
% System Parameters | |
A = 0.7788; | |
B = 0.0442; | |
C = 1; % Output matrix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% MATLAB Code for Offset-Free MPC Control of Heated Swimming Pool System | |
% Clear workspace and command window | |
clear; close all; clc; | |
% System Parameters | |
A = 0.7788; | |
B = 0.0442; | |
C = 1; % Output matrix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import cv2 | |
import gi | |
import numpy as np | |
import json | |
gi.require_version('Gst', '1.0') | |
from gi.repository import Gst | |
class Video(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% MATLAB Script for Simulating PFC Controller from Example 4.4 | |
% Clear workspace and command window | |
clear; | |
close all; | |
clc; | |
% Sampling time | |
Ts = 3; % seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Script to set target depth in Ardusub 3.6 beta | |
# requires this commit: https://github.com/williangalvani/ardupilot/commit/85a41d5771ba9d64e594dcc0856b6a3906767c3f | |
from pymavlink import mavutil | |
# There is very likely a builtin in pymavlink for this, but I didn't find it | |
ALT_HOLD_MODE = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import mavutil | |
from pymavlink import mavutil | |
from pymavlink.quaternion import QuaternionBase | |
import math | |
import time | |
import sys | |
ALT_HOLD_MODE = 2 | |
def is_armed(): | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Example of how to set target speed in guided mode with pymavlink | |
""" | |
import time | |
import math | |
# Import mavutil | |
from pymavlink import mavutil | |
# Imports for attitude | |
from pymavlink.quaternion import QuaternionBase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
from casadi import * | |
import numpy as np | |
def qr_eigen(A, iterations=100): | |
pQ = SX.eye(A.size1()) | |
X = copy.deepcopy(A) | |
for _ in range(iterations): | |
Q, R = qr(X) # QR decomposition in CasADi | |
pQ = pQ @ Q # Update eigenvector matrix for next iteration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Inverted Pendulum LQG control | |
author: Edward Morgan | |
""" | |
import casadi as cs | |
import math | |
import time | |
from numpy.linalg import inv, eig | |
import matplotlib.pyplot as plt |