Race Sim Central
Rec.Autos.Simulators Archive

My Sim: Turning probs (Part II)

6 posts by 2 people · 28 Apr 2002 17:45 UTC - 02 May 2002 22:30 UTC

Alex Smith 28 Apr 2002 17:45 UTC#123221
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!
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
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.
Quoted text (7 lines)>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!
Doh! :-) Good detective work. >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. 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
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!)
>Yes it was the slip ratio formula, works okay now! Great! It's fun when it works, isn't it? :-P >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!) 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

Sponsors

Affiliate Links

Sim Gaming Expo MOZA Racing Sim-Lab Fanatec TrakRacer Asetek Internet Privacy From NordVPN Dreamhost Capital One Credit Card Application Fanatical CDKeys Amazon Amazon UK Project Motor Racing iRacing Get your racing gloves, boots and more from Demon Tweeks. Enlist at Roberts Space Industries, developers of Star Citizen and Squadron 42


Back from the ashes since July, 2019. First created in 2001 with the merger of Legends Central (founded 1999) and simracing.dk.

A site by a sort of sim racer, for sim racers, about racing sims. News and information on both modern and historic sim racing software titles.

All products and licenses property of their respective owners.


Facebook Threads Bluesky Twitter Mastodon Instagram YouTube Tiktok Twitch Reddit Google News Apple News Subscribe via WordPress Flipboard eBay

Race Sim Central © 1999-2026 | Some links pay RSC a commission. Advertising does not equal endorsement.Cookie Policy