Here’s a collection of quaternion formulas. Quaternions are very useful for orientation sensing, game programming and augmented reality applications. Magnitude Normal Quaternion Conjugate Axis Angle To Quaternion Where the axis is v and the angle is theta Quaternion To Axis Angle Where theta is the angle and v is the… Continue Reading Quaternion Formulas

Integrating Gyroscopes If you are not familiar with integration, read this first. Gyroscopes measure angular velocity. Angular velocity is the rate of change of angular displacement. You know that distance = speed * time. Well, angular displacement = angular velocity * time Gyroscopes can’t measure orientation with reference to the… Continue Reading Integrating Gyroscopes – Calculating Orientation pt2

Quaternions are often used in attitude and heading systems to represent orientation. This post describes quaternions and how to use them in orientation and navigation systems. Quaternions If you type ‘quaternion’ into google, it’ll tell you something like this a complex number of the form w + xi + yj… Continue Reading Quaternions And How to Really Use Them

IMUs contain sensors that measure acceleration, magnetic fields and rotation. This post is about the maths used to get orientation (pitch, roll, yaw) from these sensors. Getting The IMU Maths Library I made a maths library for Arduino and it has been used in quite a few cool projects (… Continue Reading IMU Maths – How To Calculate Orientation

PWM Using Timers The STM32F103C8T6 has four hardware timers that can be used to generate PWM signals to drive servos. Ninjaskit has two classes (Pulse1 and Pulse2) that wrap two of the hardware timers to produce PWM on up to four digital pins each. For Pulse1 these pins are PA0,… Continue Reading Driving Servos With STM32F103C8T6

Ninjaskit – A STM32F103C8T6 Library Ninjaskit is a high level C++ API for STM32F103C8T6 micro-controllers. GitHub Page The STM32F103C8T6 micro-controller has 64K of FLASH, 20K of RAM and ticks at up to 72Mhz. It’s quite small ( 7x7mm ), comes with a built in boot loader and is very easy… Continue Reading Ninjaskit – STM32F103C8T6 Library

When confronted by large, repetitive and tedious coding tasks it’s often better to actually write code generators. I’ve written several Python scripts for code generation for different projects and every time it has been totally worthwhile. The entire communications system used by Firetail UAV is automatically generated. Every single piece… Continue Reading Python Code Generators

The StaticString library is pretty easy to use, however there’s a couple of little gotchas and interesting points. The first is copying! Copying StaticStrings C-strings are just pointers to character arrays. Creating a new char pointer to the string, of course, will only ‘shallow-copy’.

Modifying c_s2 will also modify… Continue Reading StaticString – Beyond Basics