Skip to content

Instantly share code, notes, and snippets.

@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 November 1, 2023 15:34
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);