Skip to content
Snippets Groups Projects
Commit 1beab6c5 authored by li213's avatar li213
Browse files

tweaking scenarios

parent 17a44c36
No related branches found
No related tags found
1 merge request!9Tutorial
......@@ -5,7 +5,8 @@ from verse.plotter.plotter3D import *
from verse.map.example_map.simple_map_3d import SimpleMap6
import pyvista as pv
from enum import Enum, auto
import warnings
warnings.filterwarnings("ignore")
class CraftMode(Enum):
Normal = auto()
......@@ -40,7 +41,7 @@ if __name__ == "__main__":
scenario.add_agent(quadrotor1)
quadrotor2 = QuadrotorAgent(
'test2', file_name=input_code_name2, t_v_pair=(1, 0.3), box_side=[0.4]*3)
'test2', file_name=input_code_name, t_v_pair=(1, 0.3), box_side=[0.4]*3)
init_l_2 = [3, 9, -0.35, 0, 0, 0]
init_u_2 = [3.7, 9.7, 0.35, 0, 0, 0]
quadrotor2.set_initial(
......@@ -57,12 +58,21 @@ if __name__ == "__main__":
# traces.dump("./output1.json")
# traces = AnalysisTree.load('./output1.json')
traces = scenario.verify(40, time_step)
# traces.dump('demo/tacas2023/exp1/output1.json')
fig = pv.Plotter()
fig = plot3dMap(tmp_map, ax=fig, width=0.05)
fig = plot3dReachtube(traces, 'test1',1,2,3,'r',fig, edge = True)
fig = plot3dReachtube(traces, 'test2',1,2,3,'g',fig, edge = True)
fig = plot3dReachtube(traces, 'test2',1,2,3,'b',fig, edge = True)
fig.set_background('#e0e0e0')
fig.show()
# fig = go.Figure()
# fig = draw_map_3d(tmp_map, fig, fill_type = 'center')
# fig = simulation_tree_3d(traces, tmp_map, fig, 1, 2, 3, [1, 2, 3])
# fig.update_layout(
# scene=dict(
# # xaxis = dict(nticks=4, range=xrange,),
# # yaxis = dict(nticks=4, range=yrange,),
# zaxis = dict(nticks=4, range=[-12,12],)
# )
# )
# fig.show()
This diff is collapsed.
......@@ -7,7 +7,8 @@ from verse.map.example_map.simple_map_3d import SimpleMap7
import pyvista as pv
from enum import Enum, auto
import polytope as pc
import warnings
warnings.filterwarnings("ignore")
class CraftMode(Enum):
Normal = auto()
......@@ -71,8 +72,22 @@ if __name__ == "__main__":
# fig = simulation_tree_3d(traces, tmp_map, fig, 1, 2, 3, [1, 2, 3])
# fig.show()
traces = scenario.verify(90, time_step)
traces.dump('./demo/tacas2023/exp10/output10.json')
# traces = scenario.verify(90, time_step)
# traces.dump('./demo/tacas2023/exp10/output10.json')
# traces = scenario.verify(90, time_step,
# reachability_method='NeuReach',
# params={
# "N_X0": 1,
# "N_x0": 50,
# "N_t": 50,
# "epochs": 50,
# "_lambda": 10,
# "use_cuda": True,
# 'r': 0,
# }
# )
# traces.dump('./demo/tacas2023/exp10/output10_NeuReach.json')
# fig = go.Figure()
# fig = reachtube_tree(traces, None, fig, 0, 1, [0,1])
# fig.show()
......@@ -82,20 +97,22 @@ if __name__ == "__main__":
# fig = go.Figure()
# fig = reachtube_tree(traces, None, fig, 0, 3, [0,1])
# fig.show()
# fig = pv.Plotter()
# fig = plot3dMap(tmp_map, ax=fig)
# fig = plot3dReachtube(traces, 'test1', 1, 2, 3, color = 'r', ax=fig)
# fig = plot3dReachtube(traces, 'test2', 1, 2, 3, color = 'b', ax=fig)
# fig = plot3dReachtube(traces, 'test3', 1, 2, 3, color = 'g', ax=fig)
# fig = plot_line_3d([0,0,0],[10,0,0],fig,'r',line_width = 5)
# fig = plot_line_3d([0,0,0],[0,10,0],fig,'g',line_width = 5)
# fig = plot_line_3d([0,0,0],[0,0,10],fig,'b',line_width = 5)
# fig.set_background('#e0e0e0')
# box = np.array([[40, -5, -10], [50,5,-6]]).T
# poly = pc.box2poly(box)
# fig = plot_polytope_3d(poly.A, poly.b, fig, trans=0.1)
# fig.show()
traces = AnalysisTree.load('demo/tacas2023/exp10/output10.json')
fig = pv.Plotter()
fig = plot3dMap(tmp_map, ax=fig)
fig = plot3dReachtube(traces, 'test1', 1, 2, 3, color = 'r', ax=fig)
fig = plot3dReachtube(traces, 'test2', 1, 2, 3, color = 'b', ax=fig)
fig = plot3dReachtube(traces, 'test3', 1, 2, 3, color = 'g', ax=fig)
fig = plot_line_3d([0,0,0],[10,0,0],fig,'r',line_width = 5)
fig = plot_line_3d([0,0,0],[0,10,0],fig,'g',line_width = 5)
fig = plot_line_3d([0,0,0],[0,0,10],fig,'b',line_width = 5)
fig.set_background('#e0e0e0')
box = np.array([[40, -5, -10], [50,5,-6]]).T
poly = pc.box2poly(box)
fig = plot_polytope_3d(poly.A, poly.b, fig, trans=0.1, color='yellow')
fig.show()
# fig = go.Figure()
# fig = reachtube_tree_3d(
......
......@@ -74,9 +74,9 @@ if __name__ == "__main__":
scenario.init_seg_length = 5
traces = scenario.verify(40, 0.1, params={"bloating_method": 'GLOBAL'})
fig = go.Figure()
fig = reachtube_tree(traces, tmp_map, fig, 1, 2, [1, 2], 'lines', 'trace')
fig.show()
# fig = go.Figure()
# fig = reachtube_tree(traces, tmp_map, fig, 1, 2, [1, 2], 'lines', 'trace')
# fig.show()
# fig = go.Figure()
# fig = reachtube_anime(traces, tmp_map, fig, 1,
......
......@@ -57,11 +57,10 @@ if __name__ == "__main__":
)
traces.dump("./demo/tacas2023/exp6/output6_neureach.json")
# traces = scenario.verify(40, 0.05,)
traces = scenario.verify(40, 0.05,)
# traces.dump("./demo/tacas2023/exp6/output6_dryvr.json")
# traces = AnalysisTree.load('./output6.json')
traces = scenario.verify(50, 0.05)
fig = go.Figure()
fig = reachtube_tree(traces, tmp_map, fig, 1,
2, [1, 2], 'lines', 'trace')
fig.show()
# fig = go.Figure()
# fig = reachtube_tree(traces, tmp_map, fig, 1,
# 2, [1, 2], 'lines', 'trace')
# fig.show()
This diff is collapsed.
......@@ -6,7 +6,8 @@ from verse.plotter.plotter3D import *
from verse.map.example_map.simple_map_3d import SimpleMap7
import pyvista as pv
from enum import Enum, auto
import warnings
warnings.filterwarnings("ignore")
class CraftMode(Enum):
Normal = auto()
......@@ -59,8 +60,21 @@ if __name__ == "__main__":
# fig = simulation_tree_3d(traces, tmp_map, fig, 1, 2, 3, [1, 2, 3])
# fig.show()
traces = scenario.verify(60, time_step)
traces.dump('./demo/tacas2023/exp9/output9.json')
# traces = scenario.verify(60, time_step)
# traces.dump('./demo/tacas2023/exp9/output9_DryVR.json')
# traces = scenario.verify(60, time_step,
# reachability_method='NeuReach',
# params={
# "N_X0": 1,
# "N_x0": 50,
# "N_t": 50,
# "epochs": 50,
# "_lambda": 10,
# "use_cuda": True,
# 'r': 0,
# }
# )
# traces.dump('./demo/tacas2023/exp9/output9_NeuReach.json')
# fig = go.Figure()
# fig = reachtube_tree(traces, None, fig, 0, 1, [0,1])
# fig.show()
......@@ -70,15 +84,16 @@ if __name__ == "__main__":
# fig = go.Figure()
# fig = reachtube_tree(traces, None, fig, 0, 3, [0,1])
# fig.show()
# fig = pv.Plotter()
# fig = plot3dMap(tmp_map, ax=fig)
# fig = plot3dReachtube(traces, 'test1', 1, 2, 3, color = 'r', ax=fig)
# fig = plot3dReachtube(traces, 'test2', 1, 2, 3, color = 'b', ax=fig)
# fig = plot_line_3d([0,0,0],[10,0,0],fig,'r',line_width = 5)
# fig = plot_line_3d([0,0,0],[0,10,0],fig,'g',line_width = 5)
# fig = plot_line_3d([0,0,0],[0,0,10],fig,'b',line_width = 5)
# fig.set_background('#e0e0e0')
# fig.show()
traces = AnalysisTree.load('./demo/tacas2023/exp9/output9.json')
fig = pv.Plotter()
fig = plot3dMap(tmp_map, ax=fig)
fig = plot3dReachtube(traces, 'test1', 1, 2, 3, color = 'r', ax=fig)
fig = plot3dReachtube(traces, 'test2', 1, 2, 3, color = 'b', ax=fig)
fig = plot_line_3d([0,0,0],[10,0,0],fig,'r',line_width = 5)
fig = plot_line_3d([0,0,0],[0,10,0],fig,'g',line_width = 5)
fig = plot_line_3d([0,0,0],[0,0,10],fig,'b',line_width = 5)
fig.set_background('#e0e0e0')
fig.show()
# fig = go.Figure()
# fig = reachtube_tree_3d(
......@@ -87,8 +102,5 @@ if __name__ == "__main__":
# fig, 1, 2, 3,
# [1, 2, 3],
# map_type='center',
# xrange = [0,40],
# yrange = [0,40],
# zrange = [-10,10]
# )
# fig.show()
......@@ -78,7 +78,7 @@ def plot_polytope_3d(A, b, ax = None, color = 'red', trans = 0.2, edge = True):
ax.add_mesh(shell, opacity=trans, color=color)
if edge:
edges = shell.extract_feature_edges(20)
ax.add_mesh(edges, color="k", line_width=1)
ax.add_mesh(edges, color="k", line_width=0.1,opacity=0.5)
return ax
def plot_line_3d(start, end, ax = None, color = 'blue', line_width = 1):
......
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