Integrating Gyroscopes – Calculating Orientation pt2

Integrating Gyroscopes Gyroscopes measure angular velocity. As with regular velocity, by multiplying by time you get change in position (a distance). By adding these distances up as you go, you can estimate position. Naturally, every little error will also get added up and eventually you’ll end up with large errors. This is called drift and… Read More »

Quaternions And How to Really Use Them

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 + zk, where w, x,… Read More »

IMU Maths – How To Calculate Orientation

IMUs typically contain 9DOF sensors and are used to calculate orientation. Let’s talk about the maths required to get orientation (pitch, roll, yaw) from these sensors. Getting The IMU Maths Library There once was an IMU maths library that I made and it’s been incorporated into quite a few cool projects ( such as this… Read More »

Ninjaskit Keypad Library

I’ve just finished making a groovy little library for button matrix keypads. GitHub Page Matrix keypads are fairly simple to use. They’ve got rows and columns, and each button connects a particular row to a given column. To check if a switch is pressed – let’s say SW1 – you could put a digital high… Read More »

Driving Servos With STM32F103C8T6

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, PA1, PA2 and PA3. For… Read More »

Ninjaskit – STM32F103C8T6 Library

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 to incorporate in home-made PCBs.… Read More »

Python Code Generators

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 of information that is transferred… Read More »

StaticString – Beyond Basics

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 c_s1 because they are both… Read More »

StaticString Performance Tests

There’s a lot of seasoned coders out there who are so stuck in the mindset that C is the fastest language, that they are willing to use antiquated and sometimes dangerous coding practices. I came across this on the Arduino forums recently . . . I’m using String because its easier to operate, concatenate etc… Read More »