Search This Blog

Tuesday, June 7, 2011

Update on Simulation for May and June

I was stuck for a long time on figuring out how to teach a computer how to not drive like a mindless noddle. Last time I'd posted, the computer would simply continue to turn the wheel more if it was unable to make the turn, with no regard for the loss in friction at higher slip angles. Well the computer is still stupid as can be. It'll drive a line like crazy, but if it enters a corner too fast, or tries to turn too hard, it is still clueless what to do.

This problem enters into the realm of non-linear control theory. I'll be honest, I'm lost at this point. I tried some clever schemes. I implemented what is known as the 'returning moment' into the calculations done in each of the tire blocks and attempted to use this.

For those that don't know what 'returning moment' is. When you turn the wheel on the car you'll notice that usually if you let go, it'll recenter itself. This is not your car being clever, it is simply because you are deforming the tire to make the turn happen, it turns out that the 'centroid' of all this deformation is behind the axis of where your tire rotates (the vertical axis that is). Since it is behind the axis, the system will attempt to correct itself when left alone. As anyone knows who has ever lost control of a car (whether accidental or intentional) will know that this force gets really small when the tires are sliding. This decrease in returning moment is something every driver knows as an important part of 'feeling the car'. This drop off in returning moment occurs just before the peak grip on a tire's alpha angle.

By attempting to inform the computer that if it is trying to turn the wheel more, but the returning torque is decreasing, that the car is starting to slide. At this point the computer needs to ease off the wheel to maintain the maximum turning power. This will be the first step in educating the computer, later on I would like to rewrite this entire control algorithm in favor of a 'balancing-act' method with the kart. This would involve feathering the throttle and brakes to maintain maximum grip in addition to just how he turns the steering wheel. Allow the computer to determine which combination of x and y forces can put as much weight on as many useful tires as possible.

This worked just fine as far as the results, but made the computations take forever! Not because the additional calculations were difficult, but because the ODE solver had to take such small steps to resolve a stable solution that it was impractical. This is where my limited non-linear control's experience showed. I will have to spend a while studying up in this area to formulate an efficient method. Once this is done, then I see little reason why rapid convergence isn't possible.

Some have asked why I don't just limit the turning angle to the maximum grip angle. First, this isn't realistic, especially for when I add variable conditions. Second, the max angle alpha isn't a known function of the turn angle of the wheel. In short, I can't do this anyways.

Since I want to keep the project going forward, I elected to come back to this problem later and did something that 'imitates' the driver being very good at holding the peak traction, I simply made the curve flatten out at the peak value and have it stay there all the way out to large values of alpha. This obviously isn't a suitable final solution. While the traction calculation is 'correct' the direction of the total force vector is in error. So eventually I'll come back to this.

The changes completed today involved migrating the code towards an optimization-friendly setup. Rather than going through all of the blocks I've shown pictures of, I can now specify any parameter before calling the simulation. This means that I can have the computer mess around with how the kart is setup, then take it out for a test drive, and tell me how it did.

Additionally, I have added greater fidelity to my tire model. I now take into account the effects of camber on the pressure distribution and resulting traction forces on the tire. This is huge for optimization, since the majority of the parameters one can change for the suspension on a kart effect how the tire meets the road. I also added the needed calculations to determine the camber angle at each tire for every time step.

I am going to setup and run a handful of case studies to confirm the effects of various camber setups. But those results will have to wait until next post.

No comments: