Objective
Generate an optimized velocity profile that minimizes energy,
while keeping velocity and time within given constraints
User input data using parser
, distance
, dist_step
, time
, min_velocity
, max_stop_velocity
Pre-determined data
map_data
: //describe data type
stop_profile
:
generated from map_data
elev_profile
:
generated from map_data
max_velocity
distance
: (float) Distance to travel (m) Not used
dist_step
: (float) Distance between elevation profile measurements (m)
time
: (float) Maximum allowable to travel the distance (m/s)
min_velocity
: (float) Minimum allowable velocity (m/s)
max_stop_velocity
: (float) Maximum velocity for stops/turns (m/s)
Required Elevation File
Text File (COTAelevation_var.txt used in optimizer.py)
First row states how many points/sections in a route
Each row after the first represents a section of a course. For each row:
The index of row
change of elevation (starting point of section → end point of section)
length of section
If there is a turn after this section: Indication of turn
These values are separated by comma.
Example (lines after 16 are omitted, there are 185 lines in total):
Code Block |
---|
181 points
1,0.0,30
2,0.0,30
3,0.0,30
4,0.0,30
5,0.0,30
6,0.0,30
7,0.0,30
8,0.0,30, Turn_1
9,0.0,30
10,0.0,30
11,0.0,30
12,0.0,30
13,0.0,30
14,0.6,30
15,0.9,30, Turn_2 |
Code Breakdown
load_course_map()
Parameters: The name of the course we’re trying to load in (course_name)
Returns:
elev_profile
: (2D float list)Each row represents a section of a course
column 0: the pitch/slope/steepness of the section (rad)
column 1: the length of the section (m)
stops
: (float list)Each element is the index of where each turns are (corresponds to row index in elev_profile)
total_dist
: (float) All section lengths added up. Total distance. (m)
generate_initial_profile()
...