Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
process_traj_logs Namespace Reference

Classes

class  DataSource
 

Functions

def binarySearch (a, x)
 
def xy_scatter_with_slider (figure_num, data, key, title, xlabel, ylabel)
 
def index_plot_with_slider (figure_num, data, key, title, xlabel, ylabel)
 

Variables

list data = []
 
dictionary core_data
 
 traj_data = csv.reader(csv_file, delimiter='|')
 
int i = 0
 
 start_index = max(binarySearch(core_data["times"], float(sys.argv[2])) - 1, 0)
 
 end_index = min(binarySearch(core_data["times"], float(sys.argv[3])) + 1, len(core_data["times"]))
 
 data_source = DataSource.NONE
 
 point_speed = content.split(':')
 
 point = point_speed[1].split('Speed')
 
 xy = point[0].split(',')
 
 x = float(xy[0])
 
 y = float(xy[1])
 
 split = content.split(':')
 
 c = float(split[1])
 
def plot1
 
def plot2
 
def plot3
 
def plot4
 
def plot5
 
def plot6
 
def plot7
 
def plot8
 
def plot9
 
def plot10
 
def plot11
 
def plot12
 
def plot13
 
def plot14
 
def plot15
 

Function Documentation

◆ binarySearch()

def process_traj_logs.binarySearch (   a,
  x 
)

Definition at line 24 of file process_traj_logs.py.

24def binarySearch(a, x):
25 i = bisect_left(a, x)
26 if i:
27 return (i-1)
28 else:
29 return -1
30# Usage
31# process_traj_logs.py <file name> <start time> <end_time>
32#
33# Read the file until start_time is found.
34# Read the file until end_time is found
35# Grab all lines between start and end time
36# Print layered graphs of all trajectories between those times

◆ index_plot_with_slider()

def process_traj_logs.index_plot_with_slider (   figure_num,
  data,
  key,
  title,
  xlabel,
  ylabel 
)

Definition at line 261 of file process_traj_logs.py.

261def index_plot_with_slider(figure_num, data, key, title, xlabel, ylabel):
262
263 fig = plt.figure(figure_num)
264
265 plt.title(title)
266 plt.xlabel(xlabel)
267 plt.ylabel(ylabel)
268 time_step = data[0]
269 l, = plt.plot(range(len(time_step[key])), time_step[key])
270
271 time_step_ax = plt.axes([0.20, 0.01, 0.65, 0.03])
272 time_step_sldr = Slider(time_step_ax, 'Time Step', 0.0, len(data) - 1.0, valinit=0, valstep=1)
273
274 def update_timestep(val):
275 time_step = data[int(time_step_sldr.val)]
276 l.set_xdata(range(len(time_step[key])))
277 l.set_ydata(time_step[key])
278 fig.canvas.draw_idle()
279
280 time_step_sldr.on_changed(update_timestep)
281
282 return (fig, l, time_step_sldr)
283
def index_plot_with_slider(figure_num, data, key, title, xlabel, ylabel)

◆ xy_scatter_with_slider()

def process_traj_logs.xy_scatter_with_slider (   figure_num,
  data,
  key,
  title,
  xlabel,
  ylabel 
)

Definition at line 237 of file process_traj_logs.py.

237def xy_scatter_with_slider(figure_num, data, key, title, xlabel, ylabel):
238
239 fig = plt.figure(figure_num)
240
241 plt.title(title)
242 plt.xlabel(xlabel)
243 plt.ylabel(ylabel)
244 time_step = data[0]
245 l, = plt.plot([xy[0] for xy in time_step[key]], [xy[1] for xy in time_step[key]], '.')
246
247 time_step_ax = plt.axes([0.20, 0.001, 0.65, 0.03])
248 time_step_sldr = Slider(time_step_ax, 'Time Step', 0.0, len(data) - 1.0, valinit=0, valstep=1)
249
250 def update_timestep(val):
251 time_step = data[int(time_step_sldr.val)]
252 l.set_xdata([xy[0] for xy in time_step[key]])
253 l.set_ydata([xy[1] for xy in time_step[key]])
254 fig.canvas.draw_idle()
255
256 time_step_sldr.on_changed(update_timestep)
257
258 return (fig, l, time_step_sldr)
259
260# Takes list of dictionary
def xy_scatter_with_slider(figure_num, data, key, title, xlabel, ylabel)

Variable Documentation

◆ c

◆ core_data

dictionary process_traj_logs.core_data
Initial value:
1= {
2 "times": [],
3 "content": []
4}

Definition at line 49 of file process_traj_logs.py.

◆ data

◆ data_source

process_traj_logs.data_source = DataSource.NONE

Definition at line 98 of file process_traj_logs.py.

◆ end_index

process_traj_logs.end_index = min(binarySearch(core_data["times"], float(sys.argv[3])) + 1, len(core_data["times"]))

Definition at line 71 of file process_traj_logs.py.

◆ i

int process_traj_logs.i = 0

Definition at line 55 of file process_traj_logs.py.

◆ plot1

def process_traj_logs.plot1
Initial value:
1= xy_scatter_with_slider(1, core_data["time_steps"], DataSource.RAW_POINTS,
2 "Raw Downsampled Points from Lanelet Centerlines", "X (m)", "Y (m)")

Definition at line 284 of file process_traj_logs.py.

◆ plot10

def process_traj_logs.plot10
Initial value:
1= index_plot_with_slider(10, core_data["time_steps"], DataSource.SPEED_OP_REVERSE_STEP,
2 "Speed Optimization Reverse Step", "Index", "Velocity (m/s)")

Definition at line 311 of file process_traj_logs.py.

◆ plot11

def process_traj_logs.plot11
Initial value:
1= index_plot_with_slider(11, core_data["time_steps"], DataSource.SPEED_OP_FORWARD,
2 "Speed Optimization Forward Step", "Index", "Velocity (m/s)")

Definition at line 314 of file process_traj_logs.py.

◆ plot12

def process_traj_logs.plot12
Initial value:
1= index_plot_with_slider(12, core_data["time_steps"], DataSource.AFTER_SPEED_OP,
2 "Speed Optimization Output", "Index", "Velocity (m/s)")

Definition at line 317 of file process_traj_logs.py.

◆ plot13

def process_traj_logs.plot13
Initial value:
1= index_plot_with_slider(13, core_data["time_steps"], DataSource.AFTER_AVERAGE,
2 "Speed after Moving Average", "Index", "Velocity (m/s)")

Definition at line 320 of file process_traj_logs.py.

◆ plot14

def process_traj_logs.plot14
Initial value:
1= index_plot_with_slider(14, core_data["time_steps"], DataSource.AFTER_MIN_SPEED,
2 "Speed after applying minimum speed (FINAL SPEED)", "Index", "Velocity (m/s)")

Definition at line 323 of file process_traj_logs.py.

◆ plot15

def process_traj_logs.plot15
Initial value:
1= index_plot_with_slider(15, core_data["time_steps"], DataSource.FINAL_TIMES,
2 "Final Times", "Index", "Seconds (s)")

Definition at line 326 of file process_traj_logs.py.

◆ plot2

def process_traj_logs.plot2
Initial value:
1= xy_scatter_with_slider(2, core_data["time_steps"], DataSource.TIME_BOUND_POINTS,
2 "Time Bound Points from Lanelet Centerlines", "X (m)", "Y (m)")

Definition at line 287 of file process_traj_logs.py.

◆ plot3

def process_traj_logs.plot3
Initial value:
1= xy_scatter_with_slider(3, core_data["time_steps"], DataSource.BACK_AND_FRONT_POINTS,
2 "Back and front points from Lanelet Centerlines", "X (m)", "Y (m)")

Definition at line 290 of file process_traj_logs.py.

◆ plot4

def process_traj_logs.plot4
Initial value:
1= xy_scatter_with_slider(4, core_data["time_steps"], DataSource.SAMPLED_POINTS,
2 "Sampled points from spline fitting", "X (m)", "Y (m)")

Definition at line 293 of file process_traj_logs.py.

◆ plot5

def process_traj_logs.plot5
Initial value:
1= index_plot_with_slider(5, core_data["time_steps"], DataSource.RAW_CURVATURES,
2 "Raw Curvatures", "Index", "Curvature (1/r) (m)")

Definition at line 296 of file process_traj_logs.py.

◆ plot6

def process_traj_logs.plot6
Initial value:
1= index_plot_with_slider(6, core_data["time_steps"], DataSource.PROCESSED_CURVATURES,
2 "Processed Curvatures", "Index", "Curvature (1/r) (m)")

Definition at line 299 of file process_traj_logs.py.

◆ plot7

def process_traj_logs.plot7
Initial value:
1= index_plot_with_slider(7, core_data["time_steps"], DataSource.CURVATURE_CONSTRAINED_SPEEDS,
2 "Curvature constrained speeds", "Index", "Velocity (m/s)")

Definition at line 302 of file process_traj_logs.py.

◆ plot8

def process_traj_logs.plot8
Initial value:
1= index_plot_with_slider(8, core_data["time_steps"], DataSource.FINAL_YAWS,
2 "Final Yaw values", "Index", "Yaw (rad)")

Definition at line 305 of file process_traj_logs.py.

◆ plot9

def process_traj_logs.plot9
Initial value:
1= index_plot_with_slider(9, core_data["time_steps"], DataSource.SPEED_LIMIT_CONSTRAINED_SPEEDS,
2 "Speed Limit Constrained Speeds", "Index", "Velocity (m/s)")

Definition at line 308 of file process_traj_logs.py.

◆ point

◆ point_speed

process_traj_logs.point_speed = content.split(':')

Definition at line 125 of file process_traj_logs.py.

◆ split

◆ start_index

process_traj_logs.start_index = max(binarySearch(core_data["times"], float(sys.argv[2])) - 1, 0)

◆ traj_data

process_traj_logs.traj_data = csv.reader(csv_file, delimiter='|')

Definition at line 54 of file process_traj_logs.py.

◆ x

◆ xy

process_traj_logs.xy = point[0].split(',')

◆ y