API Question What the api to get vessel aceleration ?

Woodylepic

New member
Joined
Dec 29, 2009
Messages
71
Reaction score
0
Points
0
Hi all
What is the api to get the acceleration of a vessel ?
thank.
 
No API per se :( Use two successive velocity readings and divide the difference vector by the time delta.
 
Get the force vector and divide by the mass of the vessel.
 
Or you can get acceleration from GetForceVector() divided by GetMass().

EDIT: Ninja'ed.
 
Get the force vector and divide by the mass of the vessel.

Can you use this to get separate vertical and horizontal acceleration?. By that I mean calculate them from the direction of the vector?
 
Can you use this to get separate vertical and horizontal acceleration?. By that I mean calculate them from the direction of the vector?
Yes. The force vector is in vessel local frame, so you can get the y component for vertical and x,z for horizontal.


Edit: But I think you meant relative to the gbody, and not to vessel, so additionally you'd need to rotate that vector.
 
Last edited:
Can you use this to get separate vertical and horizontal acceleration?. By that I mean calculate them from the direction of the vector?
Yes, you can convert the force vector to any frame of reference you want and use the individual elements. Edit: Counter-:ninja:ed by orb!

If you're looking to calculate something like what's shown on the SurfaceMFD, see the article I wrote a couple years ago:
http://www.orbiter-forum.com/showthread.php?t=5072
 
Thanks a 1E6 :thumbup:

EDIT: Actually I was mostly interested in the Horizontal Acc. SurfaceMFD lists Total and Vert. Acc.
I'm trying to figure out the easiest way to display the horizontal acceleration towards a landing target(base). I guess dDist/dt is the way to go in this case.

PS: I can't code myself out of a torn paper bag, but I intend to do something about that. :lol:
 
Last edited:
Acceleration towards a base - in that case you may even have to switch to spherical geometry which will approach "flat" acceleration across small distances
 
Thanks a 1E6 :thumbup:

EDIT: Actually I was mostly interested in the Horizontal Acc. SurfaceMFD lists Total and Vert. Acc.
I'm trying to figure out the easiest way to display the horizontal acceleration towards a landing target(base). I guess dDist/dt is the way to go in this case.

PS: I can't code myself out of a torn paper bag, but I intend to do something about that. :lol:
If you just want the horizontal acceleration in the direction of a base, drop out the vertical component of the acceleration in the horizon frame and take the dot product of the resulting (two dimensional) vector with the (two dimensional) unit vector in the direction of the base. This is similar to my calculation for total acceleration in the article I linked, but with the additional step of converting both vectors to the horizon frame and dropping their vertical components.

Edit: As TJohns hinted at above, for longer distances you will need to take into account the curvature of the earth when you're calculating the direction vector to the base.
 
Last edited:
Edit: As TJohns hinted at above, for longer distances you will need to take into account the curvature of the earth when you're calculating the direction vector to the base.

I'm thinking GetFocusEquPos() and GetBaseEquPos() and calculating the distance/CourseToSteer (spherical). This way planet rotation doesn't get involved.

Clarification: I'm getting GetFocusEquPos() every time step, so I can get HorizVel From the ΔDistance. If I then divide the ΔHorizVel by time step length I should get a useful horizontal acceleration. If the base is within a few degrees of the actual course, this method should be close enough.
 
Last edited:
That dommage that Orbiter have not api to get the acceleration (g) aniway ! thank all for the good answer :hailprobe:and quick reply ! :thumbup: and good win !:rofl:
 
Last edited:
I'm thinking GetFocusEquPos() and GetBaseEquPos() and calculating the distance/CourseToSteer (spherical). This way planet rotation doesn't get involved.

Clarification: I'm getting GetFocusEquPos() every time step, so I can get HorizVel From the ÄDistance. If I then divide the ÄHorizVel by time step length I should get a useful horizontal acceleration. If the base is within a few degrees of the actual course, this method should be close enough.
Yeah, if a stepwise method works for you, go for it, it's definitely simpler than calculating it fully. For my purposes, I couldn't use the stepwise method due to the distributed nature of the system, so I had to come up with the calculations.
 
Back
Top