Skip to content
Snippets Groups Projects
Commit 19778f5f authored by li213's avatar li213
Browse files

small changes on folder structure

parent 386ee2c3
No related branches found
No related tags found
No related merge requests found
......@@ -4,4 +4,5 @@ __pycache__/
.idea/
venv/
.DS_Store
**.egg-info/
\ No newline at end of file
**.egg-info/
.VSCodeCounter/
\ No newline at end of file
File moved
......@@ -34,11 +34,11 @@ if __name__ == "__main__":
input_code_name = 'example_controller2.py'
scenario = Scenario()
car = NPCAgent('car1', file_name=input_code_name)
car = NPCAgent('car1')
scenario.add_agent(car)
car = CarAgent('car2', file_name=input_code_name)
scenario.add_agent(car)
tmp_map = SimpleMap3()
tmp_map = SimpleMap6()
scenario.set_map(tmp_map)
scenario.set_sensor(FakeSensor2())
scenario.set_init(
......@@ -51,17 +51,17 @@ if __name__ == "__main__":
(VehicleMode.Normal, LaneMode.Lane1),
]
)
# res_list = scenario.simulate_multi(10,10)
traces = scenario.verify(10)
res_list = scenario.simulate_multi(10,10)
# traces = scenario.verify(10)
fig = plt.figure(2)
# fig = plot_map(tmp_map, 'g', fig)
fig = plot_reachtube_tree(traces, 'car1', 0, [1], 'b', fig, (1000,-1000), (1000,-1000))
fig = plot_reachtube_tree(traces, 'car2', 0, [1], 'r', fig)
# for traces in res_list:
# fig = plot_simulation_tree(traces, 'car1', 0, [1], 'b', fig, (1000,-1000), (1000,-1000))
# fig = plot_simulation_tree(traces, 'car2', 0, [1], 'r', fig)
# # generate_simulation_anime(traces, tmp_map)
# fig = plot_reachtube_tree(traces, 'car1', 0, [1], 'b', fig, (1000,-1000), (1000,-1000))
# fig = plot_reachtube_tree(traces, 'car2', 0, [1], 'r', fig)
for traces in res_list:
fig = plot_simulation_tree(traces, 'car1', 0, [1], 'b', fig, (1000,-1000), (1000,-1000))
fig = plot_simulation_tree(traces, 'car2', 0, [1], 'r', fig)
# generate_simulation_anime(traces, tmp_map)
......
from enum import Enum, auto
import copy
from dryvr_plus_plus.scene_verifier.map.lane_map import LaneMap
class LaneObjectMode(Enum):
Vehicle = auto()
......@@ -29,9 +28,9 @@ class State:
lane_mode: LaneMode = LaneMode.Lane0
def __init__(self, x, y, theta, v, vehicle_mode: VehicleMode, lane_mode: LaneMode):
self.data = []
pass
def controller(ego:State, other:State, lane_map:LaneMap):
def controller(ego:State, other:State, lane_map):
output = copy.deepcopy(ego)
if ego.vehicle_mode == VehicleMode.Normal:
if lane_map.get_longitudinal_position(other.lane_mode, [other.x,other.y]) - lane_map.get_longitudinal_position(ego.lane_mode, [ego.x,ego.y]) > 3 \
......
from enum import Enum, auto
import copy
from dryvr_plus_plus.scene_verifier.map.lane_map import LaneMap
class VehicleMode(Enum):
Normal = auto()
......@@ -24,7 +23,7 @@ class State:
def __init__(self, x, y, theta, v, vehicle_mode: VehicleMode, lane_mode: LaneMode):
self.data = []
def controller(ego:State, other:State, lane_map:LaneMap):
def controller(ego:State, other:State, lane_map):
output = copy.deepcopy(ego)
if ego.vehicle_mode == VehicleMode.Normal:
if lane_map.get_longitudinal_position(other.lane_mode, [other.x,other.y]) - lane_map.get_longitudinal_position(ego.lane_mode, [ego.x,ego.y]) > 0 \
......
......@@ -27,9 +27,9 @@ class State:
v = 0.0
vehicle_mode: VehicleMode = VehicleMode.Normal
lane_mode: LaneMode = LaneMode.Lane0
obj_mode: LaneObjectMode
type: LaneObjectMode
def __init__(self, x, y, theta, v, vehicle_mode: VehicleMode, lane_mode: LaneMode):
def __init__(self, x, y, theta, v, vehicle_mode: VehicleMode, lane_mode: LaneMode, type: LaneObjectMode):
self.data = []
def controller(ego:State, other:State, sign:State, lane_map:LaneMap):
......
......@@ -27,7 +27,7 @@ class State:
v: float
vehicle_mode: VehicleMode
lane_mode: LaneMode
obj_mode: LaneObjectMode
type: LaneObjectMode
def __init__(self, x: float = 0, y: float = 0, theta: float = 0, v: float = 0, vehicle_mode: VehicleMode = VehicleMode.Normal, lane_mode: LaneMode = LaneMode.Lane0, type: LaneObjectMode = LaneObjectMode.Vehicle):
pass
......@@ -91,12 +91,12 @@ if __name__ == "__main__":
scenario.set_sensor(FakeSensor2())
scenario.set_init(
[
[[10, 0, 0, 0.5],[10, 0, 0, 0.5]],
[[0, -0.2, 0, 1.0],[0.2, 0.2, 0, 1.0]],
[[10, 0, 0, 0.5],[10, 0, 0, 0.5]],
[[20, 0, 0, 0],[20, 0, 0, 0]],
],
[
(VehicleMode.Normal, LaneMode.Lane2, LaneObjectMode.Vehicle),
(VehicleMode.Normal, LaneMode.Lane1, LaneObjectMode.Vehicle),
(VehicleMode.Normal, LaneMode.Lane1, LaneObjectMode.Vehicle),
(VehicleMode.Normal, LaneMode.Lane1, LaneObjectMode.Obstacle),
]
......@@ -111,23 +111,3 @@ if __name__ == "__main__":
plt.show()
# plt.plot([0, 40], [3, 3], 'g')
# plt.plot([0, 40], [0, 0], 'g')
# plt.plot([0, 40], [-3, -3], 'g')
# queue = [traces]
# while queue != []:
# node = queue.pop(0)
# traces = node.trace
# # for agent_id in traces:
# agent_id = 'car2'
# trace = np.array(traces[agent_id])
# plt.plot(trace[:, 1], trace[:, 2], 'r')
# agent_id = 'car1'
# trace = np.array(traces[agent_id])
# plt.plot(trace[:, 1], trace[:, 2], 'b')
# # if node.child != []:
# queue += node.child
# plt.show()
......@@ -8,7 +8,7 @@ from dryvr_plus_plus.scene_verifier.map.lane_map import LaneMap
from dryvr_plus_plus.scene_verifier.code_parser.pythonparser import EmptyAst
class NPCAgent(BaseAgent):
def __init__(self, id, code = None, file_name = None):
def __init__(self, id):
self.id = id
self.controller = EmptyAst()
......
......@@ -5,12 +5,12 @@ setup(
name='dryvr_plus_plus',
version='0.1',
description='DryVR++',
author='MaybeShewill-CV',
maintainer='Chiao Hsieh',
maintainer_email='chsieh16@illinois.edu',
author='Yangge Li, Katherine Braught, Haoqing Zhu',
maintainer='Yangge Li, Katherine Braught, Haoqing Zhu',
maintainer_email='{li213, braught2, haoqing3}@illinois.edu',
license='Apache-2.0',
packages=["dryvr_plus_plus"],
python_requires='>=3.6',
packages=setuptools.find_packages(exclude=["tests", "demo"]),
python_requires='>=3.8',
install_requires=[
"numpy~=1.22.1",
"scipy~=1.8.0",
......
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