Skip to content

Instantly share code, notes, and snippets.

@Hypnotriod
Hypnotriod / 2-wheel-vehicle.js
Last active February 15, 2024 10:07
2 wheel vehicle trajectory calculation
// --------------------------------
// vehicle is faced towards y axis
// start angle
const A = -Math.PI*0.5
// start x position
const X = 2
// start y position
const Y = 0
// wheels distance
const L = 1
@Hypnotriod
Hypnotriod / foreach.c
Last active April 30, 2023 16:28
C99 foreach macro for fixed size array
// Declaration:
#define foreach(item, array) \
for (item = &array[0]; item != &array[sizeof(array) / sizeof(array[0])]; item++)
#define foreach_i(item, index, array) \
for (item = &array[0], index = 0; item != &array[sizeof(array) / sizeof(array[0])]; item++, index++)
#define foreach_l(item, array, length) \
for (item = &array[0]; item != &array[length]; item++)
@Hypnotriod
Hypnotriod / stereo-camera-mjpeg-stream.py
Last active November 17, 2023 21:43
Waveshare IMX219-83 CSI Stereo Camera MJPEG streaming example with python and GStreamer for Beagle Bone AI-64
#!/usr/bin/python
# BeagleBone AI-64 MJPEG stream of Waveshare IMX219-83 Stereo Camera with GStreamer example
# Based on https://gist.github.com/misaelnieto/2409785
# Waveshare IMX219-83 CSI Stereo Camera: https://www.waveshare.com/wiki/IMX219-83_Stereo_Camera
# To add cameras overlays modyfy 'fdtoverlays' property of '/boot/firmware/extlinux/extlinux.conf' with:
# fdtoverlays /overlays/BBAI64-CSI0-imx219.dtbo /overlays/BBAI64-CSI1-imx219.dtbo
# and reboot
# Get TI Image Signal Processing GStreamer drivers:
# wget https://github.com/Hypnotriod/bbai64/raw/master/imaging.zip
# sudo unzip imaging.zip -d /opt/