Skip to content

Commit

Permalink
In safe Env, out_of_road = out_of_route (#527)
Browse files Browse the repository at this point in the history
* safeenv:out_of_road = out_of_route

* fix env
  • Loading branch information
QuanyiLi committed Aug 22, 2021
1 parent d03b305 commit be692ee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pgdrive/envs/safe_pgdrive_env.py
Expand Up @@ -22,7 +22,7 @@ def default_config(self) -> Config:

# ===== cost scheme =====
"crash_vehicle_cost": 1,
"crash_object_cost": 1,
"crash_object_cost": 0.5,
"out_of_road_cost": 1., # only give penalty for out_of_road
"use_lateral": False
},
Expand Down Expand Up @@ -52,6 +52,9 @@ def setup_engine(self):
super(SafePGDriveEnv, self).setup_engine()
self.engine.register_manager("object_manager", TrafficObjectManager())

def _is_out_of_road(self, vehicle):
return vehicle.out_of_route


if __name__ == "__main__":
env = SafePGDriveEnv(
Expand All @@ -67,7 +70,7 @@ def setup_engine(self):
# # "start_seed": 187,
# "out_of_road_cost": 1,
# "debug": True,
# "map": "CCC",
"map": "X",
# # "cull_scene": True,
"vehicle_config": {
"spawn_lane_index": (FirstPGBlock.NODE_2, FirstPGBlock.NODE_3, 2)
Expand Down

0 comments on commit be692ee

Please sign in to comment.