Skip to content

Instantly share code, notes, and snippets.

@jamesgregson
jamesgregson / kd_tree.h
Last active September 24, 2019 14:29
Simple KDTree (3D)
#ifndef __KD_TREE_HEADER_H
#define __KD_TREE_HEADER_H
#include <set>
#include <list>
#include <tuple>
#include <queue>
#include <vector>
#include <algorithm>
@jamesgregson
jamesgregson / fsm.cpp
Created September 13, 2019 15:41
Fast Sweeping Method in 2D and 3D using PyBind11
/*cppimport
<%
setup_pybind11(cfg)
%>
*/
#include <pybind11/numpy.h>
#include <pybind11/pybind11.h>
namespace py = pybind11;
#include <cmath>
@jamesgregson
jamesgregson / euler.py
Last active September 6, 2019 13:26
Euler angles to rotation matrices and vice versa
"""Euler-angle to matrix and matrix to Euler-angle utility routines
This module provides utility routines to convert between 4x4 homogeneous
transformation matrices and Euler angles (and vice versa). It supports
all six rotation orders ('xyz','xzy','yxz','yzx','zxy','zyx') for rotations
around body axes.
Two primary functions are provided:
- rotation( theta, order='xyz' ): given input rotation angles in radians
@jamesgregson
jamesgregson / NodeMCU_JSON-RPC.ino
Last active January 31, 2025 12:35
JSON-RPC with NodeMCU and ArduinoJSON
#include <ArduinoJson.h>
#include <ESP8266WiFi.h> //ESP8266 Core WiFi Library (you most likely already have this in your sketch)
#include <DNSServer.h> //Local DNS Server used for redirecting all requests to the configuration portal
#include <ESP8266WebServer.h> //Local WebServer used to serve the configuration portal
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager WiFi Configuration Magic
// change the IP address in the following line, should return "hello world" wrapped in JSON-RPC boilerplate
// curl -d '{"jsonrpc": "2.0", "method": "concatenate", "params": ["hello", "world"], "id": 5}' -H "Content-Type: application/json" -X POST http://192.168.0.24/api
ESP8266WebServer http_server(80);