rec.autos.simulators

My Sim: Turning probs (Part II)

Alex Smit

My Sim: Turning probs (Part II)

by Alex Smit » Tue, 30 Apr 2002 02:45:52

I've modified my slip angle calculation and now it calculates the slip angle
by getting the change in world position each cycle (the velocity vector,
which includes the car's rotation) and subtracting the steering angle.

However, now it steers like it is on rails, and doesn't slide or anything
funky like that. I have modelled weight transfer but it does not seem to be
having much of an effect. I am doing vector capping of the friction circle
(maybe not properly tho?), and the car yaws by calculating the torque around
the c of g of the car, using the wheels' FYs.

Anyone help!!? Thanks!

J. Todd Wass

My Sim: Turning probs (Part II)

by J. Todd Wass » Thu, 02 May 2002 13:33:51

I haven't tried that approach so can't say this will work for certain in your
sim, but since there was such a big change in performance when switching from
one slip angle calculation to the other, perhaps you might want to try
calculating slip ratio a different way.  

For a top down, 2-D calculation, something like this might work better:

First, you could calculate the angle between the center of mass (CM) and each
wheel in the vehicle's coordinate system:

d[wheel] is the distance from a line drawn connecting the front and rear axle
(or axle lines) going through the center of mass.  Basically 1/2 the track
width, but would change a little based on left/right load distribution if not
50/50.

dist_cm_to_front/rear_axle --is the distance from the center of mass to
whichever axle you're looking at.  Again, this would be perpendicular to both
axles (not looking at the diagonals to the wheels yet).

Angle_To_Wheel[FrontRightWheel] = atn(d[FrontRightWheel]/dist_cm_to_front_axle

Angle_To_Wheel[RearRightWheel] = Pi -
atn(d[RearRightWheel]/dist_cm_to_rear_axle

Angle_To_Wheel[RearLeftWheel] = Pi + atn(d[RearLeftWheel]/dist_cm_to_rear_axle

Angle_To_Wheel[FrontLeftWheel] = 2 * Pi -
atn(d[FrontLeftWheel]/dist_cm_to_front_axle

That is just the interior angle from the center of mass to each respective
wheel with straight ahead being 0 degrees/radians, and increasing in the
clockwise (top down view) direction.

Then, you could calculate the circumference of the circle traced out by each
wheel as if the car was sitting still and was spun through a 360 degree
rotation.  This would use the distance from the CM to each wheel respectively,
and is used below as Circum[wheel].  (Calc not shown here)

Next, the direction of the velocity vector due to rotation is simply
perpendicular to this Angle_To_Wheel.  Just add 90 degrees (or .5 * pi) to it
and add the vehicle's yaw angle:

yaw_90=YAW + .5 * PI
Direction_Vel[wheel] = (Angle_To_Wheel[1] + yaw_90) MOD 2 * PI

(MOD is a modulus operation, not sure how to do that in C though, a simple IF
ELSE block will do it.  This is simply keeping the angle between 0 and 2 * PI)

Now multiply the rotational velocity of the car to get the linear velocity at
each wheel due to rotational motion:

Instant_Linear_Velocity_From_Rotation = Circum[wheel] * yaw_rotational_vel / (2
* PI)

Now split that into the x/y (or whatever your ground plane coords are)
velocities:

term1 = Direction_vel[wheel]

x_component = sin(term1) * Instant_Linear_Velocity_From_Rotation

y_component = cos(term1) * Instant_Linear_Velocity_From_Rotation

What you have now is the x and y components of the velocity due solely to
vehicle rotation (the velocity vector on the 2-D ground plane, if I'm doing
this right ;-))  This is what indirectly causes the low speed yaw dampening
effect vehicle dynamicists (new term?) talk about.

Now, you can simply add the x and y component of the car velocity to these and
you should have the true velocity vector at each wheel.

This will flip around as different quadrants are hit, so:
Total_x_vel = x_component + car_x_vel
Total_y_vel = y_component + car_y_vel

IF Total_y_vel < 0 THEN Wheel_Travel_Direction[wheel] = (Pi + ATN(Total_x_vel /
Total_y_vel)) MOD 2 * Pi

IF Total_y_vel > 0 THEN Wheel_Travel_Direction[wheel] = (2 * Pi +
ATN(Total_x_vel / Total_y_vel)) MOD 2 * Pi

IF Total_y_vel = 0 THEN Wheel_Travel_Direction[wheel] = .25 * Pi * 2 *
SGN(Total_X_Vel) //Where SGN is the algebraic sign.  

--
Slip_Angle = Car_Heading - Wheel_Travel_Direction[wheel] +
Steering_Angle[wheel] + ToeAngle[wheel] //Might as well get the toe angle in
there too while you're at it ;-)

----
----
If that's too ugly and messy looking, just draw a nice picture of the car from
the top down view.  Draw a line from the center of mass to a wheel, then draw a
perpendicular line to that which would show what direction the wheel would be
moving if the car was rotating around its center of mass, but not moving
forwards/backwards/sideways at all.  Then find the actual velocity at each
wheel from rotation, split it into the x/y components (which IS the velocity
vector, it's just two variables that store the x/y velocity) and add it to the
car's velocity vector.  Then get the angle between that and the direction the
tire is pointing, and viola, there's the slip angle in 2-D :-D

Todd Wasson
---
Performance Simulations
Drag Racing and Top Speed Prediction
Software
http://PerformanceSimulations.Com

My little car sim screenshots:
http://performancesimulations.com/scnshot4.htm

Alex Smit

My Sim: Turning probs (Part II)

by Alex Smit » Thu, 02 May 2002 22:21:51

Wow thanks for such a thorough response!

However I'm afraid my problem turned out to be rather simpler than that and
it was a rather silly thing that was stopping it from sliding. Basically I
did not have a velocity vector for the car, it just had velLat and velLong
velocities which were applied to the car longitudinally and laterally at the
car's current heading, and had no effect!

Now it does and all is well!! Although the wheels don't seem to be spinning
correctly now during a spin. They don't like going in reverse angular
rotation otherwise crazy things start happening :( must be some sign issues
somewhere.

J. Todd Wass

My Sim: Turning probs (Part II)

by J. Todd Wass » Fri, 03 May 2002 07:03:00

 Doh!  :-)  Good detective work.

 I'd start by checking the slip ratio formula.  Brian Beckman's site has a
formula that works for all combinations of forward/backward translation and
spinning.  Works great, and it took a big, ugly, slow chunk of IF/ELSE blocks
out of my stuff :-)

Todd Wasson
---
Performance Simulations
Drag Racing and Top Speed Prediction
Software
http://PerformanceSimulations.Com

My little car sim screenshots:
http://performancesimulations.com/scnshot4.htm

Alex Smit

My Sim: Turning probs (Part II)

by Alex Smit » Sat, 04 May 2002 04:01:43

Yes it was the slip ratio formula, works okay now!

I think it was the Brian Beckman formula that was causing the problems
though, although thats probably due to my implementation. When a car
accelerates in reverse, that becomes a negative slip ratio that can go < -1
(right?) but my implementation used a calculation that produced a +ve result
(somehow!)

J. Todd Wass

My Sim: Turning probs (Part II)

by J. Todd Wass » Sat, 04 May 2002 07:30:38

 Great!  It's fun when it works, isn't it? :-P

 Yes, the slip ratio can go beyond -1 in reverse, so the problem might have
been in your implementation of it.  Sign selection is a real hit or miss thing
early on.  My stuff still has quite a bit of apparantly random - signs
throughout to make things work the way they should :-)

 Brian Beckman's formula just happened to plug straight in with my
implementation.  I slapped myself on the forehead when I first saw it and
thought, "why didn't I think of that??"  lol

 Think I spent quite a few hours sitting down with paper drawing pictures of
wheels spinning and moving in different directions in order to figure out how
to get the slip ratio to work right in all cases.  Funny how complicated it can
be, and funny how a good physicist or mathematician can just look at it and
throw out a tiny little formula that takes care of all of it...  <sigh>  lol

Oh well, live and learn ;-)

Todd Wasson
---
Performance Simulations
Drag Racing and Top Speed Prediction
Software
http://PerformanceSimulations.Com

My little car sim screenshots:
http://performancesimulations.com/scnshot4.htm


rec.autos.simulators is a usenet newsgroup formed in December, 1993. As this group was always unmoderated there may be some spam or off topic articles included. Some links do point back to racesimcentral.net as we could not validate the original address. Please report any pages that you believe warrant deletion from this archive (include the link in your email). RaceSimCentral.net is in no way responsible and does not endorse any of the content herein.