Tuesday, February 24, 2009

Part 2.5: A formula for floating.

I tried to challenge myself by designing a formula for perfectly continuous airtime, as discussed a little bit over in part 2. I used a program called 'Elementary' which designed to help make elements for nolimits rides. The program runs a 512 iteration loop and can plot formulas directly to nolimits track elements. Oddly enough, I did most of the work on the formulas 3 days ago and thought it wouldn't have much relevancy to our dynamics stuff, as it was all physics energy balance stuff. I was very surprised when we covered almost the exact same formulas the next day (actually, it was kinda creepy). Anyway, here's an overview of the velocity update.

Here's a reference pic for angles, axes, and various values.


For starters, we need to get a few differential values established.
Distance traveled: dS=V*dt
Vertical Movement: dY=V*sin(Theta)
Horizontal Movement: dX=V*cos(Theta)

Ok, let's move on to the energy balance parts. As always:
T(1)+V(1)+U(1-2)=T(2)+V(2)

This form works well for final locations, but isn't
as helpful for an iterative program like mine. I'll update it accordingly.
0=dT+dV-dU

Unfortunately, I can't use our convention for potential and kinetic terms as V is taken as velocity and T is taken as a global time constant. I'll use P for potential and K for kinetic. So:
0=dP+dK-dU

Let's get our energy updates now. Note that we've divided each term by mass (nice how that works out all the time):
Change in potential: dP= (dY * g)
Change in non-conservative forces: dU= -(s*g*N)
We'll talk about what the value of the normal force actually is in a little bit here.

Right, now for the velocity term. Integrating dK=dU-dP, we get K=U-P. Taking K from this and knowing K=1/2*V^2, we get
V=Sqrt(2*K)

This is essentially the energy balance I did for the program, with a little reworking to better work with Elementary.

Whoo, now we just need to calculate our rho for desired g force. To simplify things, I assumed a constant g force (although it would be possible to update my formulas with a changing value of g over time, I didn't really want to go that far into things). Here's the calculation for rho:
Photobucket
Finally, we need to update our theta. We know the arc length struck is r*alpha. Alpha is the angle struck by ds (the change in angle from movement along the path, not our theta from before. Luckily, however dAlpha turns out to be dTheta. So, knowing our differential arc distance (dS from before):
dTheta= -(dS/rho)

Alright, now our math's all set and we're good to play around. Here's the final elementary formula file, and here's a direct file link to download Elementary itself, if anyone feels like playing along. To open the formula, install and run Elementary and press ctrl-f. Open my formula and set the divisions box to 256 or 512 (more divisions=longer element). Finally, click the 'Force number of Segments' box and choose 8 or above. Unfortunately to actually ride the elements generated you must have the full version of Nolimits, but you can at least see shapes. I'm pretty satisfied with my work on this formula, and the resultant elements work well.

Anyway, to conclude here's a pretty airtime hill generated by the program.
Photobucket

Update-5/1/09
After speaking with Rhoads and Krousgrill we finally got the formula to accurately work. Turns out it's more accurate to consolidate the code to 4 lines. Here's the new iterative code, if anyone's interested:

;Theta updater
theta= theta - (v*dt/(v * v / (cos[theta]*EG - gwant*EG)))
;Velocity Updater
v = SQRT[2*(Energy - (v*dt * Abs[gwant*EG] * 0.0275)- ( Y * EG))]

;Y position updater
Y= Y + v * sin[theta] * dt

;X position updater
X= X + v * cos[theta] * dt

;We hate Z
Z= 0

I also added a switch so the gforce can be varied over time, meaning complete hills can be generated. If anyone's interested I can send you the new formula and show you how to use it, just send me an email. Anyway, thanks for reading!

No comments:

Post a Comment