Skip to content

Commit 992706c

Browse files
multi env scenario
1 parent 658df56 commit 992706c

22 files changed

+749
-10
lines changed

config_runner/configs/1_31_23/door/sacadrl.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"num_agents": [[0, 3], [35, 4], [70, 5]],
2+
"num_agents": 2,
33
"eval_num_agents": [3, 4, 5, 7, 10, 20],
44
"train_length": 250000,
55
"ending_eval_trials": 25,
@@ -11,7 +11,7 @@
1111
"policy_algo_kwargs": {"n_steps": 4096},
1212
"monitor": true,
1313

14-
"experiment_names": ["envs_door"],
14+
"experiment_names": ["envs_multi"],
1515

1616
"run_name": "1_31_23/door/sacadrl_1",
1717
"run_type": "SACADRL",
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
{
2+
"edges": [
3+
{
4+
"has_automated_door": false,
5+
"has_door": false,
6+
"has_elevator": false,
7+
"has_stairs": false,
8+
"max_clearance": 1.0,
9+
"max_speed": 2.0,
10+
"s0_id": 0,
11+
"s1_id": 1
12+
},
13+
{
14+
"has_automated_door": false,
15+
"has_door": false,
16+
"has_elevator": false,
17+
"has_stairs": false,
18+
"max_clearance": 1.0,
19+
"max_speed": 2.0,
20+
"s0_id": 1,
21+
"s1_id": 2
22+
},
23+
{
24+
"has_automated_door": false,
25+
"has_door": false,
26+
"has_elevator": false,
27+
"has_stairs": false,
28+
"max_clearance": 1.0,
29+
"max_speed": 2.0,
30+
"s0_id": 2,
31+
"s1_id": 3
32+
},
33+
{
34+
"has_automated_door": false,
35+
"has_door": false,
36+
"has_elevator": false,
37+
"has_stairs": false,
38+
"max_clearance": 1.0,
39+
"max_speed": 2.0,
40+
"s0_id": 3,
41+
"s1_id": 4
42+
},
43+
{
44+
"has_automated_door": false,
45+
"has_door": false,
46+
"has_elevator": false,
47+
"has_stairs": false,
48+
"max_clearance": 1.0,
49+
"max_speed": 2.0,
50+
"s0_id": 4,
51+
"s1_id": 5
52+
},
53+
{
54+
"has_automated_door": false,
55+
"has_door": false,
56+
"has_elevator": false,
57+
"has_stairs": false,
58+
"max_clearance": 1.0,
59+
"max_speed": 2.0,
60+
"s0_id": 5,
61+
"s1_id": 6
62+
},
63+
{
64+
"has_automated_door": false,
65+
"has_door": false,
66+
"has_elevator": false,
67+
"has_stairs": false,
68+
"max_clearance": 1.0,
69+
"max_speed": 2.0,
70+
"s0_id": 7,
71+
"s1_id": 8
72+
},
73+
{
74+
"has_automated_door": false,
75+
"has_door": false,
76+
"has_elevator": false,
77+
"has_stairs": false,
78+
"max_clearance": 1.0,
79+
"max_speed": 2.0,
80+
"s0_id": 8,
81+
"s1_id": 9
82+
},
83+
{
84+
"has_automated_door": false,
85+
"has_door": false,
86+
"has_elevator": false,
87+
"has_stairs": false,
88+
"max_clearance": 1.0,
89+
"max_speed": 2.0,
90+
"s0_id": 9,
91+
"s1_id": 10
92+
}
93+
],
94+
"nodes": [
95+
{
96+
"id": 0,
97+
"loc": {
98+
"x": -84.42088317871094,
99+
"y": 36.796165466308594
100+
}
101+
},
102+
{
103+
"id": 1,
104+
"loc": {
105+
"x": -65.49714660644531,
106+
"y": 35.95743942260742
107+
}
108+
},
109+
{
110+
"id": 2,
111+
"loc": {
112+
"x": -64.39631652832031,
113+
"y": 13.678800582885742
114+
}
115+
},
116+
{
117+
"id": 3,
118+
"loc": {
119+
"x": -70.1101303100586,
120+
"y": 13.573960304260254
121+
}
122+
},
123+
{
124+
"id": 4,
125+
"loc": {
126+
"x": -70.16255187988281,
127+
"y": 7.860144138336182
128+
}
129+
},
130+
{
131+
"id": 5,
132+
"loc": {
133+
"x": -57.47683334350586,
134+
"y": 8.01740550994873
135+
}
136+
},
137+
{
138+
"id": 6,
139+
"loc": {
140+
"x": -57.73893737792969,
141+
"y": 37.844573974609375
142+
}
143+
},
144+
{
145+
"id": 7,
146+
"loc": {
147+
"x": -85.10234069824219,
148+
"y": 6.602056503295898
149+
}
150+
},
151+
{
152+
"id": 8,
153+
"loc": {
154+
"x": -70.1101303100586,
155+
"y": 6.287534236907959
156+
}
157+
},
158+
{
159+
"id": 9,
160+
"loc": {
161+
"x": -55.43243408203125,
162+
"y": 6.339954853057861
163+
}
164+
},
165+
{
166+
"id": 10,
167+
"loc": {
168+
"x": -56.06148147583008,
169+
"y": 38.001834869384766
170+
}
171+
}
172+
]
173+
}

docker/vectordisplay/maps/tmp/multi-scenario/multi-scenario.navigation.txt

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-87.844826, 40.172413, -88.017242, -13.965517
2+
-19.000624, 26.448141, -19.000624, 26.448141
3+
-20.026054, 26.319963, -20.026054, 26.319963
4+
-87.704407, 30.549860, -68.605782, 30.549860
5+
-60.658703, 39.906906, -60.530525, 9.913089
6+
-68.477600, 30.678040, -68.093063, 18.501062
7+
-68.033943, 18.292671, -79.927086, 18.129751
8+
-79.927086, 18.129751, -79.764160, 10.309603
9+
-79.764160, 10.146683, -73.573212, 10.146683
10+
-60.621090, 10.146683, -66.893501, 10.228143
11+
-88.073074, 5.014711, -73.654671, 4.933251
12+
-73.654671, 4.933251, -73.736130, -13.476682
13+
-66.730583, 4.770331, -66.486206, -13.639602
14+
-66.730583, 4.444491, -53.126781, 4.444491
15+
-53.126781, 4.281572, -54.104301, 40.042458
16+
-88.073074, -13.721062, -66.404739, -13.558142
17+
-87.828690, 40.205379, -60.702553, 39.716621

scripts/create_env_template.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ def create_new_env(name: str, template: str = None):
6767
open(str(vectormap_file), 'w').close()
6868
if not navigation_file.exists():
6969
open(str(navigation_file), 'w').close()
70-
if not navigation_json_file.exists():
71-
open(str(navigation_json_file), 'w').close()
7270

7371
# Build vectormap (geometry of the env)
7472
cmd = [str(VECTOR_DISPLAY_FOLDER / 'vd.sh'), str(environment_map_path.parent), environment_map_path.name, "--edit_localization"]

src/config_run.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
from src.environment.scenarios.common_scenarios import envs_door, envs_hallway, envs_intersection, envs_round_about, \
3636
envs_open
37-
from src.environment.scenarios import CycleScenario
37+
from src.environment.scenarios import CycleScenario, GraphNavScenario
3838
from src.environment.utils.utils import DATA_FOLDER
3939
from src.environment.utils.evaluate_policy import evaluate_policy
4040
import datetime
@@ -319,6 +319,10 @@ def run(
319319
all_config=monitor and not local)
320320
scenarios.append(scenario)
321321
zones.append(conflict_zone)
322+
if 'envs_multi' in experiment_names:
323+
scenario = GraphNavScenario("tmp/multi-scenario")
324+
scenarios.append(scenario)
325+
322326

323327
observations = []
324328

@@ -387,7 +391,7 @@ def run(
387391
ENV_CLASS = partial(ManualZoneEnv, zones)
388392
else:
389393
ENV_CLASS = partial(RosSocialEnv)
390-
394+
391395
# nav_map_vis = NavMapViz(scenario.nav_map, scenario.nav_lines)
392396
env = ENV_CLASS(observer=observer, rewarder=rewarder, scenarios=scenarios, num_humans=0, num_agents=num_agents if isinstance(num_agents, int) else max(num_agents[-1][1], eval_num_agents[-1]), debug=debug)
393397

src/environment/scenarios/scenario.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def __init__(
2929

3030
self.config_scene_path = Path(f'{ROOT_FOLDER}/src/templates/{env_name}/')
3131
self.config_nav_path = self.config_scene_path / f'{self.config_scene_path.name}.navigation.json'
32-
3332
assert Path(self.config_nav_path).is_file(), \
3433
f'The env_name ({env_name}) does not have a navigation file at {self.config_nav_path}.'
3534
assert Path(self.config_scene_path).is_dir(), \

src/environment/scenarios/types/graph_nav.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from pathlib import Path
2222
from typing import Union, Tuple, List
2323

24-
2524
from src.environment.scenarios import Scenario
2625

2726
robot_positions = [
@@ -178,7 +177,8 @@ def generate_scenario(
178177
if self.allowed_agent_goal_positions:
179178
robot_ends = [random.sample(list(set(self.allowed_human_goal_positions) - {x}), 1) for x in enumerate(robot_starts)]
180179
else:
181-
robot_ends = [random.sample(list(set(list(range(0, len(self.robot_positions)))) - {x}), 1) for x in enumerate(robot_starts)]
180+
# robot_ends = [random.sample(list(set(list(range(0, len(self.robot_positions)))) - {x}), 1) for x in enumerate(robot_starts)]
181+
robot_ends = [random.sample(list(set(list(range(0, len(self.robot_positions)))) - {x}), 1)[0] for x in enumerate(robot_starts)]
182182

183183
human_positions = []
184184

@@ -224,6 +224,7 @@ def generate_scenario(
224224
'dev': human_dev,
225225
'positions': self.robot_positions,
226226
'human_positions': human_positions,
227-
'nav_map': self.nav_map
227+
'nav_map': self.nav_map,
228+
'robot_count': num_agents
228229
}
229230
self.make_scenario(config)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
<launch>
3+
<arg name="outfile" default="screen" />
4+
5+
<node pkg="ut_multirobot_sim" type="simulator_link" name="simulator" cwd="node"
6+
output="screen"
7+
args="-sim_config $(find social_gym)/config/gym_gen/sim_config.lua -scene_config $(find social_gym)/config/gym_gen/scene.xml -speedup_factor 1.0 --localize --use_pedsim" />
8+
9+
<group unless="$(optenv DOCKER false)">
10+
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find ut_multirobot_sim)/visualization.rviz" />
11+
</group>
12+
13+
<group ns="camera1">
14+
<node pkg="tf" type="static_transform_publisher" name="camera_broadcaster"
15+
args="-1 7 12 15 0 0 1 map camera1 10" />
16+
<node name="camera_info" pkg="rostopic" type="rostopic"
17+
args="pub camera_info sensor_msgs/CameraInfo
18+
'{header: {seq: 0, stamp: {secs: 0, nsecs: 0}, frame_id: 'camera1'},
19+
height: 480, width: 640, distortion_model: 'plumb_bob',
20+
D: [0],
21+
K: [500.0, 0.0, 320, 0.0, 500.0, 240.0, 0.0, 0.0, 1.0],
22+
R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0],
23+
P: [500.0, 0.0, 320, 0.0, 0.0, 500, 240, 0.0, 0.0, 0.0, 1.0, 0.0],
24+
binning_x: 0, binning_y: 0,
25+
roi: {x_offset: 0, y_offset: 0, height: 480, width: 640, do_rectify: false}}' -r 2"
26+
output="screen"/>
27+
</group>
28+
29+
<group ns="rviz1/camera1/image">
30+
<rosparam param="disable_pub_plugins">
31+
- 'image_transport/compressed'
32+
- 'image_transport/compressedDepth'
33+
- 'image_transport/theora'
34+
</rosparam>
35+
</group>
36+
37+
<node pkg="graph_navigation" type="social_nav" name="graph_navigation" output="screen" args="-service_mode=true -map=tmp/multi-scenario" /><include file="$(find social_gym)/config/gym_gen/pedsim_launch.launch" />
38+
39+
<param name="enable_statistics" value="true" />
40+
</launch>
41+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<launch>
2+
<arg name="outfile" default="screen" />
3+
4+
<node pkg="ut_multirobot_sim" type="simulator_link" name="simulator" cwd="node"
5+
output="screen"
6+
args="-sim_config $(find social_gym)/config/gym_gen/sim_config.lua -scene_config $(find social_gym)/config/gym_gen/scene.xml -speedup_factor 1.0 --localize --use_pedsim" />
7+
8+
<node pkg="graph_navigation" type="social_nav" name="graph_navigation" output="screen" args="-service_mode=true -map=tmp/multi-scenario" /><include file="$(find social_gym)/config/gym_gen/pedsim_launch.launch" />
9+
10+
<param name="enable_statistics" value="true" />
11+
</launch>
12+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<launch>
2+
<arg name="outfile" default="screen" />
3+
4+
<node pkg="ut_multirobot_sim" type="simulator_link" name="simulator" cwd="node"
5+
output="screen"
6+
args="-sim_config $(find ut_multirobot_sim)/config/gym_gen/sim_config.lua -scene_config $(find ut_multirobot_sim)/config/gym_gen/scene.xml -speedup_factor 1.0 --localize --use_pedsim" />
7+
8+
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find ut_multirobot_sim)/visualization.rviz" />
9+
10+
<node pkg="cpp-pips" type="social_greed" name="social_greed" output="screen" />
11+
12+
<node pkg="graph_navigation" type="social_nav" name="graph_navigation" output="screen"
13+
args="-service_mode=true -social_mode=true -map=tmp/multi-scenario" />
14+
15+
<include file="$(find ut_multirobot_sim)/config/gym_gen/pedsim_launch.launch" />
16+
17+
<param name="enable_statistics" value="true" />
18+
</launch>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
function Vector2(x, y)
2+
return {x = x, y = y}
3+
end
4+
5+
-- Human shape information
6+
hu_radius = 0.2
7+
hu_num_segments = 20
8+
9+
-- Human speed information
10+
hu_max_speed = 0.8 --
11+
hu_avg_speed = 0.8 --
12+
hu_max_omega = 0.2
13+
hu_avg_omega = 0.
14+
hu_reach_goal_threshold = 0.1
15+
16+
-- Human walking mode
17+
local HumanMode = {
18+
Singleshot=0,
19+
Repeat=1,
20+
Controlled=2,
21+
Cycle=3,
22+
}
23+
24+
hu_mode = HumanMode.Controlled
25+
hu_control_topic = "/command"
26+
27+
{% for i in range(human_count) %}
28+
hu{{ i }}_waypoints = {
29+
{ {{ human_positions[i][0] }}, {{ human_positions[i][1] }}, {{ human_positions[i][2] }} }
30+
}
31+
{% endfor %}

0 commit comments

Comments
 (0)