Skip to content

Instantly share code, notes, and snippets.

View quantumxt's full-sized avatar

Photon quantumxt

View GitHub Profile
@quantumxt
quantumxt / detect_star.py
Created April 7, 2026 09:20
Star detection utility
import cv2
import numpy as np
import os
TARGET_WIDTH = 2048
TARGET_HEIGHT = 1536
FOV_WIDTH = 3.54
FOV_HEIGHT = 2.62
DPP_HORIZONTAL = FOV_WIDTH/TARGET_WIDTH # Degree/px
DPP_VERTICAL = FOV_HEIGHT/TARGET_HEIGHT # Degree/px
@quantumxt
quantumxt / gpio_test.py
Created February 19, 2026 09:03
GPIO test, ensure that gpiod is installed: pip install gpiod --break-system-packages
import gpiod
import time
from gpiod.line import Direction, Value
PINS = [17, 18, 19, 20, 21]
CHIP = "/dev/gpiochip4" # Path is required in v2
# Request all pins at once
with gpiod.request_lines(
CHIP,
@quantumxt
quantumxt / alt_ball.py
Created January 29, 2026 04:50
Altitude indicator with NiceGUI
from nicegui import ui
import math
ALT = 0.0
SVG_SIZE = 200
CENTER = SVG_SIZE // 2
RADIUS = SVG_SIZE // 4 # 120
svg_container = None
@quantumxt
quantumxt / dashboard.json
Last active December 22, 2025 06:20
Receive Ambient Weather Hub data from custom server, and publish under `/latest` & `/history` endpoints.
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
@quantumxt
quantumxt / cloud_maker.py
Last active November 11, 2025 10:14
Satellite imagery stitcher
import requests
from datetime import datetime, timedelta
from PIL import Image
import os
# Starting time
start_time = datetime.strptime("20251101_0000", "%Y%m%d_%H%M")
# 20251101_0000
# Furthest is approximately 89 days from current date
import numpy as np
import matplotlib.pyplot as plt
# Parameters for the simulation
max_acceleration = 2
max_velocity = 4 # max velocity in degrees per second
remaining_angle = 5 # target angle to reach in degrees
time_step = 0.02 # time step for simulation in seconds
acc_ratio = 0.05 # Front and back, (0.01 - 0.99)
@quantumxt
quantumxt / sdf2stl.py
Last active January 31, 2025 07:57
Convert Gazebo SDF to STL
import xml.etree.ElementTree as ET
import numpy as np
import trimesh
def parse_sdf_to_stl(sdf_path, output_stl):
tree = ET.parse(sdf_path)
root = tree.getroot()
all_meshes = []
@quantumxt
quantumxt / euler_from_quaternion.py
Created September 5, 2024 06:09 — forked from salmagro/euler_from_quaternion.py
ROS2 euler to quaternion transformation.
def euler_from_quaternion(quaternion):
"""
Converts quaternion (w in last place) to euler roll, pitch, yaw
quaternion = [x, y, z, w]
Bellow should be replaced when porting for ROS 2 Python tf_conversions is done.
"""
x = quaternion.x
y = quaternion.y
z = quaternion.z
w = quaternion.w
@quantumxt
quantumxt / benchmark_cpu.sh
Created June 18, 2024 09:53
Benchmark CPU
#!/bin/bash
# Set the monitoring duration in seconds
DURATION=300
# Set the interval between samples in seconds
INTERVAL=1
# Get the current date and time
CURRENT_DATE=$(date +%Y-%m-%d)
@quantumxt
quantumxt / topic_info_extract.sh
Created March 12, 2024 07:22
Extract topic info from current list of ROS2 topic.
#!/bin/bash
TOPIC_LIST="list.txt"
echo ""
echo "=== Topic Info Extractor ==="
echo ""
echo "Topic list file: $TOPIC_LIST"
ros2 topic list > $TOPIC_LIST
TOPIC_COUNT=$(cat $TOPIC_LIST | wc -l)