Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Waypoint Following Simulation

Berk Cagilci edited this page Sep 9, 2018 · 1 revision

Waypoint Following Simulation

This is a simulation that imitates the car's behavior. It is used to train the PID controller parameters before running the waypoint follower on the physical car itself.

To run: python simulator.py

Notes:

  1. If you're trying to run the simulation using ssh, make sure you've ssh'd in using an X server (ssh -X ...)
  2. Make sure you have pygame installed.
  3. When the waypoints and obstacles are assigned at random, the simulator tries to assign them to random locations with at least "epsilon radius" in between them. So it may be impossible for the simulator to generate a map with too many waypoints and obstacles. If the simulator runs but it fails to spawn the pygame window, try running it with a lower number of waypoints and/or obstacles.
  4. It is also possible to have predetermined locations for waypoints and obstacles. The main function in simulator.py simply generates a list of tuples of (X,Y) coordinates for each of waypoints and obstacles. If you define a list of (X,Y) tuples for either waypoints or obstacles, the simulator will use that instead.
  5. The main waypoiont following logic happens in waypoint.py. This is where the PID parameters for the car can be tweaked. The PID parameters are defined in functions get_pid_distance and get_pid_angle.
  6. track_waypoint function in waypoint.py can be modified to change the logic of the car's behavior. However, it is important that the steering and acceleration parameters provided by the car stays within the interval [-1,1], otherwise the simulation will not reflect the real car behavior. (e.g. if you give a steering parameter 2, the simulation will work fine, but the car would not be able to make that turn in real life)