# Numerical integration of angular velocity

1. Dec 18, 2008

### glycerunnin

OK...this is a really trivial question, but I hope someone can help me here. I am working on building a segway-style robot that balances on two wheels, but I am having some difficulties integrating the data I receive from my gyro sensor. The sensor gives me the angular velocity, and I know that to find the actual tilt angle I need to use something like RK4. However, I have not taken differential equations, just Calculus AB, and I am having trouble understanding exactly what Runge-Kutta integration does. I looked all over the place, from Mathworld to Wikipedia, and I feel that I am close to getting it, but the f(x,y) keeps throwing me off. Could someone please explain in more basic terms what I need to be doing?

I realize that I need to be a bit more specific. If my first 5 seconds of data are represented as ordered pairs (time t, angular velocity at time t) and I know that the angle is 0 at time t, how would I integrate (0,0), (1, 3), (2, 5), (3, 3), (4, 2), (5, 6) using, say, RK4? If you need more information, let me know.

Last edited: Dec 19, 2008
2. Dec 20, 2008

### glycerunnin

Never mind...I figured out how to use Heun's method for what I wanted to do, and it is a lot faster and simpler than RK4 and accurate enough to be useful. I am really glad I found this forum; there is so much information available and I will definitely use it in the future.

3. Jun 13, 2009

### defuseyoursel

Hey, can u explain me how u integrated using the Heuns method. I am also working on a similar robot, with similar data input, i.e of form (time, angular velocity). Can u please help me out?

4. Jun 18, 2009

### matematikawan

Is it about calcilating the area under a given curve?
Just plot the points and estimate the area.
Use trapezoidal rule? Simpson ? etc