Skip to content
Snippets Groups Projects
Commit 1c40ea91 authored by crides's avatar crides
Browse files

experiment: simulation error

parent 2044fb85
No related branches found
No related tags found
No related merge requests found
...@@ -89,9 +89,9 @@ if __name__ == "__main__": ...@@ -89,9 +89,9 @@ if __name__ == "__main__":
scenario.set_sensor(FakeSensor2()) scenario.set_sensor(FakeSensor2())
scenario.set_init( scenario.set_init(
[ [
[[10, 0, 0, 0.5],[10, 0, 0, 0.5]], [10, 0, 0, 0.5],
[[-0.2, -0.2, 0, 1.0],[0.2, 0.2, 0, 1.0]], [-0.2, -0.2, 0, 1.0],
[[20, 3, 0, 0], [20, 3, 0, 0]], [20, 3, 0, 0],
], ],
[ [
(VehicleMode.Normal, LaneMode.Lane1), (VehicleMode.Normal, LaneMode.Lane1),
...@@ -100,8 +100,8 @@ if __name__ == "__main__": ...@@ -100,8 +100,8 @@ if __name__ == "__main__":
] ]
) )
# simulator = Simulator() # simulator = Simulator()
# traces = scenario.simulate(40) traces = scenario.simulate(40)
traces = scenario.verify(40) # traces = scenario.verify(40)
fig = plt.figure() fig = plt.figure()
fig = plot_tree(traces, 'car1', 1, [2], 'b', fig) fig = plot_tree(traces, 'car1', 1, [2], 'b', fig)
......
...@@ -31,6 +31,7 @@ class CarAgent(BaseAgent): ...@@ -31,6 +31,7 @@ class CarAgent(BaseAgent):
lane_parameter = lane_map.lane_geometry(vehicle_lane) lane_parameter = lane_map.lane_geometry(vehicle_lane)
if vehicle_mode == "Normal": if vehicle_mode == "Normal":
for i in range(len(t)): for i in range(len(t)):
print(init)
x,y,theta,v = init x,y,theta,v = init
d = -y+lane_parameter d = -y+lane_parameter
psi = -theta psi = -theta
...@@ -68,4 +69,4 @@ class CarAgent(BaseAgent): ...@@ -68,4 +69,4 @@ class CarAgent(BaseAgent):
res:np.ndarray = r.integrate(r.t + time_step) res:np.ndarray = r.integrate(r.t + time_step)
init = res.flatten().tolist() init = res.flatten().tolist()
trace.append([t[i] + time_step] + init) trace.append([t[i] + time_step] + init)
return np.array(trace) return np.array(trace)
\ No newline at end of file
...@@ -10,4 +10,4 @@ class SignAgent(BaseAgent): ...@@ -10,4 +10,4 @@ class SignAgent(BaseAgent):
number_points = int(np.ceil(float(time_horizon)/time_step)) number_points = int(np.ceil(float(time_horizon)/time_step))
t = [i*time_step for i in range(0,number_points)] t = [i*time_step for i in range(0,number_points)]
trace = [[0] + init] + [[i + time_step] + init for i in t] trace = [[0] + init] + [[i + time_step] + init for i in t]
return trace return np.array(trace)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment