Skip to content

Instantly share code, notes, and snippets.

View goromal's full-sized avatar

Andrew Torgesen goromal

View GitHub Profile
@goromal
goromal / traffic.py
Last active December 10, 2022 17:32
Simple traffic simulator on a circular road. Cars have two control objectives: maintain a consistent distance between cars and maintain a consistent car speed.
# Simple traffic simulator on a circular road. Cars have two
# control objectives:
# - Maintain a consistent distance between cars.
# - Maintain a consistent car speed.
import argparse
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from geometry import SO2
from pysignals import (
@goromal
goromal / makepyshell.py
Last active August 2, 2023 05:53
Generate a nix-shell file for Python development.
import argparse
def main():
argparser = argparse.ArgumentParser(
description = "Generate a nix-shell file (shell.nix) for Python 3.9 development.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
argparser.add_argument("--nix-path", type=str, default="nixpkgs", help="Nix source path.")
argparser.add_argument("--modules", nargs="+", default=[], help="Python modules for development.")
args = argparser.parse_args()
@goromal
goromal / find_rotational_conventions.py
Created December 24, 2022 04:27
Deduce rotation conventions used in a software library (Python)
import numpy as np
from typing import Callable, Tuple
import functools
class EulerAnglesOrder:
NONE = 0
@staticmethod
def toStr(v):
if v != EulerAnglesOrder.NONE:
return f"R = R({v[0]})R({v[1]})R({v[2]})"