Skip to content

MPC-Berkeley/genesis_path_follower

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

genesis_path_follower

Code to track a GPS-specified set of waypoints using MPC. In the master branch, the nonlinear kinematic module is currently used.

There are three major launch files to use:

  • path_record.launch
    • This is used to record the vehicle state in a demonstrated trajectory.
    • The launch file asks for a matfile of waypoints: this is just to aid in the visualization and isn't used for control.
  • sim_path_follow.launch
    • This uses a dynamic bicycle vehicle model to simulate following the demonstrated trajectory (matfile of waypoints).
    • Initial vehicle pose is required.
  • path_follow.launch
    • This is used to publish commands to the actual vehicle.
  • Common settings:
    • Track path using time (i.e. varying velocity) or with a fixed speed.
    • Reference system is defined based on (lat0, lon0) as the global origin.

The launch files use the following scripts:

  • mpc_cmd_pub.py

    • Subscribes to the state from the vehicle (or vehicle simulator).
    • Queries a reference generator (ref_gps_traj.py) to get the desired open-loop trajectory. A full global trajectory is provided ahead of time in mat format from the launch file.
    • Uses a nonlinear kinematic MPC model with Casadi/IPOPT to generate the optimal acceleration and steering angle (tire) commands.
    • Publishes the commands to the vehicle's (or simulated vehicle) low level controller, along with a message capturing the MPC reference and solution.
  • vehicle_simulator.py

    • This is for sake of tuning algorithms. It uses a dynamic bicycle model with a simplified tire model.
    • Low-level P controller used to simulate the fact that acceleration/steering angle control inputs are tracked with some delay. This P gains can be tuned to simulate timing delays on the real vehicle.
    • The topics used for control match the Genesis Interface exactly. Thus this module can be swapped with the real vehicle interface with no issues.
  • gps_vehicle_plotter..py

    • This is a simple visualizer of the path following behavior.
    • The global trajectory is plotted in black and kept fixed.
    • The vehicle's current state (blue or with a vehicle plotted), target path (open-loop reference, in red), and predicted MPC path (green) are updated via subscriber callbacks.
  • state_publisher.py

    • Used for the real vehicle, in place of vehicle_simulator.py.
    • Subscribes to GPS/IMU topics and provides a roughly synchronized version of the vehicle state for convenience.

Mat Format for Reference Path (used by ref_gps_traj.py):

  • Keys: 't', 'lat', 'lon', 'psi' are required for ref_gps_traj.py, which provides the reference trajectory.
  • Values: each key is associated with a N-long array, where N is the number of state samples recorded
  • There is also a 'mode' entry (Real, Sim, or Follow) to aid with plotting/analysis and keeping track of data.
  • See the the parse_bag.py script in analysis for details.

Other notable branches and collaborators:


Contact Vijay Govindarajan (govvijay@berkeley.edu, https://github.com/govvijaycal) with any questions or comments.