#Vehicle Models
#Dynamics and the Bicycle Model
To explain the vehicle bicycle model, I'll be relying heavily on a fantastic online course by Mario Theers and Mankaran Singh: https://thomasfermi.github.io/Algorithms-for-Automated-Driving/Control/BicycleModel.html
Often in vehicle operation, it is desirable to understand a vehicle's trajectory before it has traveled. This allows autonomous systems to make adjustments to avoid colliding with pedestrians or hitting a curb.
#Derivations
To understand vehicle motion, it is essential to understand its Instantaneous Center of Rotation (ICR). This is what we'll be calculating and using to visualize trajectory. For simplicity, we will use a kinematic bicycle model:
For the kinematic four-wheel model the slip angles of all four tires are assumed to be zero. Let us think about what this means for the ICR. Since the slip angles are zero, the wheel orientations are equal to the wheel velocities. For each wheel we can mentally draw a dashed line perpendicular to the wheel orientation and hence wheel velocity like in Fig. 22. Since the motion is planar, there needs to be an ICR, and hence all these dashed lines need to intersect in that ICR.

In conclusion, we can obtain the ICR by utilizing the facts provided by this diagram:

Through basic geometry, we can derive:
By observing the diagram, we notice that the only parameter required for finding ICR (which is a point in space) is R, as we know that it is R away from the perpendicular of the rear wheel. This can be calculated using the steering angle and the length of the wheelbase of the vehicle (0.3302).
Finally, use this knowledge to 1 calculate the ICR and 2. draw a circle of radius R around the ICR. At a constant steering angle, this circle will represent your vehicle's (approximate) trajectory.
#Applications
This knowledge can be applied extensively to the field of autonomous robotics. Although the calculation is trivial, it provides insightful information for a vehicle to calculate its TTC (time to collision) or plan trajectories to avoid obstacles in RRT (see image below).

Additionally, perhaps without realizing it at first, it is fundamental for pure pursuit, an algorithm for smooth trajectory planning in robust waypoint navigation.

#Enhancements
It is crucial to note that this system describes idealistic conditions and the calculation of vehicle trajectories for real-world vehicles is much more involved. This image reflects the inaccuracies that arise from the use of using the kinematic bicycle model and assuming perfect conditions:

In fact, by browsing the f1tenth_gym
source code, one will find that the simulation state's dynamics derivatives are described by:

The latter two parameters are the yaw rate and body slip angle, respectively. It reflects a single-track dynamic bicycle model. The problem becomes significantly more complex as our desired precision increases. However, for our vehicle, a single-track kinematic bicycle model will suffice. An exercise for those who daunt it is to perfectly model the car's instantaneous trajectory. This will involve knowledge of utilizing RK4 integration, the simulation's parameters (https://f1tenth-gym.readthedocs.io/en/latest/customized_usage.html), and a profound understanding of the simulation.
Lastly, MPC (Model Predictive Control) depends upon a vehicle's model and is a concept used to improve competition vehicles professionally.