Skip to content

Instantly share code, notes, and snippets.

View mhaberler's full-sized avatar

Michael Haberler mhaberler

View GitHub Profile
@mhaberler
mhaberler / README-machinekit-terasic-de0.md
Last active March 16, 2020 10:28
Installing the Machinekit Altera CycloneV test image

Contents

This SD image is a debian jessie console image with:

  • a 4.1.22-ltsi-rt kernel with RT-PREEMPT patches applied
  • tested on Terasic DE0-Nano-SoC Kit, other SoCKit platforms should work with appropriate dtb
  • machinekit RIP-build under /home/machinekit/machinekit, all build artefacts are in place (no need to run make)
  • machinekit packages are NOT installed and you do not have to!
  • all machinekit build- and runtime required packages ARE installed.
  • /home/machinekit/.bashrc already set up to run machinekit from the RIP build directory.
  • one known-to-work configuration with hostmot2/onboard FPGA support is: machinekit/configs/hm2-soc-stepper/5i25-socfpga.ini
# Intended to convert a typical radar lla and az el to a cesium quaternion orientation for CZML
# Uses numpy, transformations.py (http://www.lfd.uci.edu/~gohlke/code/transformations.py.html),
# and ecef.py (https://code.google.com/p/pysatel/source/browse/trunk/coord.py?r=22)
def azEl2Quaternion(lat, lon, alt, az, el):
rotZ = rotation_matrix(math.radians(180+az), [0,0,1])
rotY = rotation_matrix(math.radians(-(90+el)), [0,1,0])
rotM = np.dot(rotZ, rotY)
origin = geodetic2ecef(lat, lon, alt)
origin = np.multiply(origin, 1000)
@mhaberler
mhaberler / dsdtech.py
Created May 21, 2022 09:26
drive DSD Tech BLE Relay via Python & bleak
"""
Connect by BLEDevice
"""
import asyncio
import platform
import sys
from bleak import BleakClient, BleakScanner
from bleak.exc import BleakError
@mhaberler
mhaberler / ptpd
Last active June 13, 2023 12:29
ptpd (Precision Time Protocol) config files for debian
# /etc/default/ptpd
# Set to "yes" to actually start ptpd automatically
START_DAEMON=yes
# Add command line options for ptpd
PTPD_OPTS="-c /etc/ptpd.conf"