Trajectories
Author: Bernhard Wymann
Keywords: torcs, berniw, bernhard wymann, robot, steer, path, trajectories

# 4.6 Trajectories ### The Optimal Trajectory? In case you know how to compute the optimal trajectory very fast (optimal means minimal lap time) please let me know... I skimmed quite a lot of papers about that subject (the robotics community deals with similiar problems) but from there I didn't get much useful information. If I remember right there has been proved that finding the optimal trajectory in three dimensions is in NP. But because our tracks are quite flat a two dimensional approximation would be sufficient. There have been written some papers about that subject and if I remember right there are also solutions available, but just for a mass point robot (no aerodynamics involved) and quite expensive to compute (or should I say simply "slow"). If you are interested the papers are available in the ACM online library. ### Heuristic Trajectories Like you have seen heuristic means to find a trajectory with some reasonable ideas. So we improve our trajectory with adding this and that, improvement x causes problem y and so forth... The problem with heuristics is that they may work great on some tracks but also horribly fail on some other tracks or dislike certain features. I think you can build quite a good driver with this method, but there will be always problems with some track features. ### Geometric Trajectories I call a trajectory geometric when it just takes the track geometry into account, but doesn't consider the car setup and aerodynamics. A nice implementation is in K1999 from Rémi Coulom. It does linearize the curvature of the path in a quite efficient and clever way. But it doesn't deliver optimal paths especially with high downforce car setups in fast turns. What else did I try so far? My first approach was to find a few initial "good" points on the track and then to put a cubic spline trough it. Now the spline leaves the track on many sections of the track. So I find the place where the spline leaves the track first and insert an additional point on the track. You repeat that till the whole path is on the track. That works quite well (never hit the public). The next try was to wrap clothoids trough the turns. There is still an implementation of that available in berniw, but not very well refined. Another experiment (for that tutorial) was to work with the biggest arcs you can fit into the turns. It is not yet refined enough for public release and too complicated for the tutorial. ### Machine Learning Approaches I think TORCS would also be a nice playground for machine learning techniques. So if you are a professor let your students write some robots for TORCS. ### Feedback Let me know if you read this chapter and your thoughts about it. Please send me also spelling, grammar, math and code corrections. Thank you for the feedback. ### Summary You know about other approaches. You have an almost competitive car.