Page 1 of 2

Pitch and roll measuring

PostPosted: Fri Feb 22, 2013 1:17 pm
by Gears
Gentlemen,

My name is Ruben. I'm a student in the Netherlands, tasked with the project of creating a sensor that can measure the pitch and roll angle of a driving motorcycle. I know that this forum is for UAV purposes, but I hope that the simularities are sufficient for me to ask my questions here. ;)

From my digging around some interesting websites I've come to understand the basic principle of getting accurate angle measurements out of a gyro + accelero combination (sensors an IMU has). Feed this information into a Kalman filter and voilá! As building your own ABS / wheelie control / etc systems on a motorcycle isn't exactly an often practised 'hobby', which is why I've come to these MAV sites as their goal is much the same.

The problem I'm having is that I have no experience at all at working with PCB's, interfacing with dataloggers and alike, or even actually implementing a Kalman filter. My only (limited) skills are working with Matlab and understanding the 'just' of most programming code. I am however a quick and eager learner.

Now I was wondering if any of you fine folk could perhaps help me on my way by giving me a guide to building a sensor from the point of ordering a Sparklefun 5DOF (or similiar sensor - cheaper is better) to having something working along the lines of this video:

http://www.youtube.com/watch?feature=pl ... WAFFZ7rPDc

I understand that this is a lot to ask, and much can probably be found in snippets of different posts, but finding the correct information is proving to be rather difficult.

A few technical details:
Range = +/- 60 degrees
Accuracy = 2 degrees or better
Functions under up to 2-3g of sideways force

TL;DR:
I'm an absolute noob at nearly everything related to building your own sensor equipment. I want to measure pitch and roll accurately on a driving motorcycle.

Thank you for your time.

Re: Pitch and roll measuring

PostPosted: Fri Feb 22, 2013 7:59 pm
by Tom
Hi,

There are plenty of modules that already do the attitude filtering, see: https://www.sparkfun.com/search/results ... t=products

Keep in mind that for your application, there should also be a GPS input to compensate for the forward speed/centripetal acceleration.

Re: Pitch and roll measuring

PostPosted: Sat Feb 23, 2013 1:19 pm
by Gears
Thank you for the pointer. Will check it out.

I was under the impression that combining a gyro and an accelerometer together would already negate influence of forward speed and centripetal acceleration?

Re: Pitch and roll measuring

PostPosted: Sat Feb 23, 2013 1:23 pm
by Tom
The gyroscopes slowly drifts.... you compensate that drift by using the accelerometer.
Only the accelerometer readings are useless when centripetal forces apply.

So without forward speed measurement your angle will only be correct for several seconds, after that the accelerometer compensation kicks in, and this one will not be accurate.

Re: Pitch and roll measuring

PostPosted: Sun Feb 24, 2013 9:30 am
by Gears
How do things like the Wii controller deal with this then? When swinging that around for an extended periode seems to be fine, and I'm pretty sure the Wii has no GPS.

Either way, is using GPS the only way? I do have access to GPS data on the bike, but I'm afraid of the inaccuracy of the data.

Re: Pitch and roll measuring

PostPosted: Sun Feb 24, 2013 7:40 pm
by Tom
I suppose you'd need to drive around a roundabout in your car and test whether the wii controller still works after a while.

I don't know what you want to do or make so I don't know if the GPS is one-way or not :-)

Re: Pitch and roll measuring

PostPosted: Mon Feb 25, 2013 12:37 pm
by Gears
The idea of the project is to develop a low cost solution to sensing the lean angle of a motorcycle when it is cornering (or straight even). Best would even be to measure the relative angle compared to the surface. I've been thinking about some optical sensor that can look at the square peice of asphalt under the motorcycle and analyse the angle from there - but I guess this sort of thing is not related to UAV's at all.

My problem with GPS is that it's unreliable, as if this were to be inplemented on production bikes, then I'm sure there are certain areas where it would simply not work due to the GPS not being available there.

Re: Pitch and roll measuring

PostPosted: Mon Feb 25, 2013 12:42 pm
by Tom
Indeed, for testing I would propose the GPS solution because it is easy to implement. For production I would use the on-board speed-sensor of the bike and feed this into the algorithm :-)

Optical sensors would work too but I would not use this in production models. Dirt etc can cause problems here.

Re: Pitch and roll measuring

PostPosted: Mon Feb 25, 2013 1:13 pm
by Gears
Giving it some thought, optical would indeed not be any good. Holes and bumps in the road surface would throw the whole thing off.

I'm curious to know how to make use of the speed data though. How can we use vehicle speed to compensate for the centrifugal force? I'm trying to figure it out in my head but I can't peice together how it would work. I would assume you can calculate the g-force and it's direction, and then substract this from the initial data to end up with solely the direction of gravity (which is what we're looking for). Only problem is, how can you seperate the baseline 1g gravity from the additional Xg of acceleration / centrifugal force?

Re: Pitch and roll measuring

PostPosted: Mon Feb 25, 2013 1:30 pm
by Tom
Everything is always easier than it looks :-)

http://en.wikipedia.org/wiki/Centripetal_force

We assume the bike always moves in the forward direction:
You only need to angular velocity (given to us by the gyroscopes) and the forward speed from the wheels or GPS ground speed.

Acceleration = m / s² = v * omega = forward speed (m/s) * angular velocity (rad/s)

(we discard mass because it is a constant it all our calculations, the accelerometers measure accelerations and not a force with mass)