Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vehicle gap metric #1971

Merged
merged 40 commits into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3fa2f81
Add driving-smarts-2023
Adaickalavan Apr 10, 2023
83a9a0f
Add scenario attribute.
Adaickalavan Apr 10, 2023
0369996
Merge branch 'master' into driving-smarts-2023
Adaickalavan Apr 10, 2023
4df4c4e
Add changelog.
Adaickalavan Apr 10, 2023
218b035
Modify metrics.
Adaickalavan Apr 10, 2023
dc1951a
Add changelog.
Adaickalavan Apr 10, 2023
9db4070
Merge branch 'master' into new-metrics
Adaickalavan Apr 11, 2023
9dce0be
Merge branch 'master' into new-metrics
Adaickalavan Apr 14, 2023
703db59
Merge branch 'master' into new-metrics
Adaickalavan Apr 17, 2023
aac6333
Update CHANGELOG.md
Adaickalavan Apr 17, 2023
e543157
Remove regexp for actors of interest.
Adaickalavan Apr 17, 2023
00ddc47
Update CHANGELOG.md
Adaickalavan Apr 17, 2023
4881671
Rephrased changelog.
Adaickalavan Apr 17, 2023
011d519
Activate comfort cost.
Adaickalavan Apr 17, 2023
1df89b5
Add comfort metric.
Adaickalavan Apr 18, 2023
46e3a16
Edit comments.
Adaickalavan Apr 18, 2023
9dcd950
Merge branch 'master' into metric-comfort
Adaickalavan Apr 18, 2023
151b66a
Merge branch 'master' into new-metrics
Adaickalavan Apr 18, 2023
7fa5ece
Edit changelog.
Adaickalavan Apr 18, 2023
3af2bf3
Merge branch 'new-metrics' into metric-comfort
Adaickalavan Apr 18, 2023
6c0a384
Merge branch 'master' into new-metrics
Adaickalavan Apr 18, 2023
a15f946
Merge branch 'new-metrics' into metric-comfort
Adaickalavan Apr 18, 2023
e955837
Remove excess whitespace.
Adaickalavan Apr 18, 2023
09ac1c0
Add gap metric.
Adaickalavan Apr 18, 2023
a7d1602
Add gap metric.
Adaickalavan Apr 18, 2023
ebce109
Add gap metric.
Adaickalavan Apr 18, 2023
51e6871
Renamed gap_between_vehicles to vehicle_gap.
Adaickalavan Apr 19, 2023
b695b94
gap metric : midway commit.
Adaickalavan Apr 19, 2023
34196db
Merge branch 'master' into metric-average-gap
Adaickalavan Apr 19, 2023
3fe268b
Draft gap metric.
Adaickalavan Apr 19, 2023
799fdbe
Functional gap metric.
Adaickalavan Apr 19, 2023
88f6788
Remove scenario
Adaickalavan Apr 19, 2023
8659d6e
Add changelog.
Adaickalavan Apr 19, 2023
a5f33b5
Do not compute VehicleGap at last step.
Adaickalavan Apr 19, 2023
ac699f9
Fix pytype.
Adaickalavan Apr 19, 2023
047633b
Merge branch 'master' into new-metrics
Adaickalavan Apr 21, 2023
4fa4892
Merge branch 'new-metrics' into metric-comfort
Adaickalavan Apr 21, 2023
65f86f0
Merge branch 'metric-comfort' into metric-average-gap
Adaickalavan Apr 21, 2023
ce38e92
Merge branch 'master' into metric-average-gap
Adaickalavan Apr 21, 2023
9798688
Merge branch 'master' into metric-average-gap
Adaickalavan Apr 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Copy and pasting the git commit messages is __NOT__ enough.
- Added engine `observation_workers` configuration which can be used to configure the number of parallel sensor workers: 0 runs the sensors on the local thread, >=1 runs using the multiprocessing backing.
- Added engine `sensor_parallelization` configuration of sensor parallelization backing, options ("mp"|"ray"): "mp" python multiprocessing, "ray" ray worker backing.
- Added engine `reset_retries` configuration engine retries before the simulator will raise an error on reset.
- Introduced new comfort metric in metric cost functions.
- Introduced new comfort cost function in metric module.
- Introduced new gap-between-vehicles cost function in metric module.
### Changed
- The trap manager, `TrapManager`, is now a subclass of `ActorCaptureManager`.
- Considering lane-change time ranges between 3s and 6s, assuming a speed of 13.89m/s, the via sensor lane acquisition range was increased from 40m to 80m, for better driving ability.
Expand All @@ -48,6 +49,7 @@ Copy and pasting the git commit messages is __NOT__ enough.
- In the metrics module, the records which is the raw metrics data and the scoring which is the formula to compute the final results are now separated to provided greater flexibility for applying metrics to different environments.
- Benchmark listing may specify specialised metric formula for each benchmark.
- Changed `benchmark_runner_v0.py` to only average records across scenarios that share the same environment. Records are not averaged across different environments, because the scoring formula may differ in different environments.
- Renamed GapBetweenVehicles cost to VehicleGap cost in metric module.
### Deprecated
### Fixed
- Fixed issues related to waypoints in junctions on Argoverse maps. Waypoints will now be generated for all paths leading through the lane(s) the vehicle is on.
Expand Down
4 changes: 2 additions & 2 deletions docs/benchmarks/driving_smarts_2023_3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Train
$ cd <path>/SMARTS/examples/rl/platoon
$ python3.8 -m venv ./.venv
$ source ./.venv/bin/activate
$ pip install --upgrade pip wheel
$ pip install --upgrade pip
$ pip install -e ./../../../.[camera_obs,argoverse]
$ pip install -e ./inference/

Expand Down Expand Up @@ -246,7 +246,7 @@ Evaluate
$ cd <path>/SMARTS
$ python3.8 -m venv ./.venv
$ source ./.venv/bin/activate
$ pip install --upgrade pip wheel
$ pip install --upgrade pip
$ pip install -e .[camera_obs,argoverse]
$ scl zoo install examples/rl/platoon/inference
$ scl benchmark run driving_smarts_2023_3 examples.rl.platoon.inference:contrib-agent-v0 --auto-install
Expand Down
2 changes: 0 additions & 2 deletions examples/rl/platoon/train/reward.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ def step(self, action):
agent_obs["events"]["collisions"] | agent_obs["events"]["off_road"]
):
pass
elif agent_obs["events"]["agents_alive_done"]:
print(f"{agent_id}: Agents alive done triggered.")
elif agent_obs["events"]["actors_alive_done"]:
print(f"{agent_id}: Actors alive done triggered.")
else:
Expand Down
20 changes: 10 additions & 10 deletions smarts/benchmark/driving_smarts/v2023/metric_formula_platoon.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
from smarts.env.gymnasium.wrappers.metric.params import (
Comfort,
DistToObstacles,
GapBetweenVehicles,
Params,
Steps,
VehicleGap,
)
from smarts.env.gymnasium.wrappers.metric.types import Record
from smarts.env.gymnasium.wrappers.metric.utils import (
Expand Down Expand Up @@ -63,10 +63,10 @@ def params(self) -> Params:
dist_to_obstacles=DistToObstacles(
active=False,
),
gap_between_vehicles=GapBetweenVehicles(
active=False,
interest="Leader-007",
), # TODO: Activate after implementing gap_between_vehicles cost function.
vehicle_gap=VehicleGap(
active=True,
actor="Leader-007",
),
steps=Steps(
active=False,
),
Expand All @@ -85,15 +85,15 @@ def score(self, records_sum: Dict[str, Dict[str, Record]]) -> Score:
+-------------------+--------+-----------------------------------------------------------+
| DistToDestination | [0, 1] | Remaining distance to destination. The lower, the better. |
+-------------------+--------+-----------------------------------------------------------+
| GapBetweenVehicles| [0, 1] | Gap between vehicles in a platoon. The higher, the better.|
| VehicleGap | [0, 1] | Gap between vehicles in a convoy. The lower, the better. |
+-------------------+--------+-----------------------------------------------------------+
| Humanness | [0, 1] | Humanness indicator. The higher, the better. |
+-------------------+--------+-----------------------------------------------------------+
| Rules | [0, 1] | Traffic rules compliance. The higher, the better. |
+-------------------+--------+-----------------------------------------------------------+

Returns:
Score: Contains "Overall", "DistToDestination", "GapBetweenVehicles",
Score: Contains "Overall", "DistToDestination", "VehicleGap",
"Humanness", and "Rules" scores.
"""

Expand Down Expand Up @@ -123,10 +123,10 @@ def score(self, records_sum: Dict[str, Dict[str, Record]]) -> Score:
dist_to_destination = costs_final.dist_to_destination
humanness = _humanness(costs=costs_final)
rules = _rules(costs=costs_final)
gap_between_vehicles = costs_final.gap_between_vehicles
vehicle_gap = costs_final.vehicle_gap
overall = (
0.50 * (1 - dist_to_destination)
+ 0.25 * gap_between_vehicles
+ 0.25 * (1 - vehicle_gap)
+ 0.20 * humanness
+ 0.05 * rules
)
Expand All @@ -135,7 +135,7 @@ def score(self, records_sum: Dict[str, Dict[str, Record]]) -> Score:
{
"overall": overall,
"dist_to_destination": dist_to_destination,
"gap_between_vehicles": gap_between_vehicles,
"vehicle_gap": vehicle_gap,
"humanness": humanness,
"rules": rules,
}
Expand Down
2 changes: 1 addition & 1 deletion smarts/env/gymnasium/driving_smarts_2023_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def resolve_agent_interface(agent_interface: AgentInterface):
)
max_episode_steps = 1000
waypoints_lookahead = 80
neighborhood_radius = 50
neighborhood_radius = 80
return AgentInterface(
accelerometer=True,
action=agent_interface.action,
Expand Down
2 changes: 1 addition & 1 deletion smarts/env/gymnasium/platoon_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def resolve_agent_interface(agent_interface: AgentInterface):
)
max_episode_steps = 1000
waypoints_lookahead = 80
neighborhood_radius = 50
neighborhood_radius = 80
return AgentInterface(
accelerometer=True,
action=agent_interface.action,
Expand Down
Loading