that is for longtitudial accelration... the tricky part is the lateral... we discussed it on czech forum and Chaos had an idea to use three points from cars trajectory (in times t-1, t and t+1) , make a triangle from them, and then make a circle that intersects all three vertexes... and then use radius of that circle in equation i wrote above...
no the idea is if you have a velocity vector (like you do using outsim data) in the xyz system you can poject that vector along the rfu (right forward up) axes of the cars system
then youll have longitudinal lateral and normal velocities which you can then derivate to work out the respective accel components
trouble is raf doesnt give you the velocity as a vector
yup, but assuming that car is in turn and accelerating at the same time, there are two forces acting on it, one has the direction of velocity vector (tangent to the trajectory), and is a derivative of speed (let's call it aLON), the other one points into center of turn, and it is described by equation aLAT = v^2 / r
the force which i have to project to F and R vectors is then a = aLON + aLAT
Car's accelaration is second time derivative of (X, Y, Z) vector. You can normalize right-vector and forward-vector (their length should be 1). You can also construct up-vector as their cross product. Then lateral accelaration is dot product of accelaration vector and normalized right-vector etc.
if youre driving around an ideal circle your scalar velocity wont change but the direction of the velocity will change a lot ... if you derive the velocity vectir youll get the cetripetal aceel as the radial component of the derivative in an (r \theta \phi) system
Can someone please provide me with some code to use to calculate pitch and roll from a RAF file?
That is, I'm looking for something similar to this from the RAF file documentation.
To work out heading from the forward-vector ------------------------------------------- float b = FX / 32767.0f; // convert FX to a float from -1 to 1 float e = FY / 32767.0f; // convert FY to a float from -1 to 1 float heading = atan2(-b, e); // heading (anti-clockwise from above)
I haven't done this type of mathematics for years and it's doing my head in!
OMG, this is the Grail...I have been searching so long for this information:
" to work out a car's orientation matrix, the calculation order is : roll,
to work out the acceleration or velocity in the car's coordinate system, a
programmer should create horizontal (x) forward (y) and up (z) vectors
(using the heading, pitch and roll) and take the dot product (scalar
product) of these with the acceleration or velocity vectors supplied in the
Maybe it could be somewhere in documentation (maybe it is?), because rotation order has to be known to properly convert world coordinates into car coordinates. I suppose most 3D gurus know about this order...but at least for me it was not so obvious (and angles come in the opposite order in OutSim packets!)
Here is the rotation matrix with this rotation order: http://planning.cs.uiuc.edu/node102.html
edit: in the formula above you have to switch pitch and roll angles. Apply this matrix with alpha=LFS heading, beta=LFS roll, and gamma=LFS pitch and it seems to work fine.