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

Performance metrics #1753

Merged
merged 737 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
737 commits
Select commit Hold shift + click to select a range
38095f2
Add comments.
Adaickalavan Jul 18, 2022
6e577a5
Update competition phase.
Adaickalavan Jul 18, 2022
542c89c
Update todo.
Adaickalavan Jul 18, 2022
db76d77
Update data.html.
Adaickalavan Jul 18, 2022
ca71f74
Change text.
Adaickalavan Jul 18, 2022
76ff466
Change text.
Adaickalavan Jul 18, 2022
5d746c9
Support scenario paths.
Adaickalavan Jul 19, 2022
c2415f3
Proper yaml integers.
Adaickalavan Jul 19, 2022
2db7a0c
Add evaluation scenario paths.
Adaickalavan Jul 20, 2022
11e14d3
Make Format.
Adaickalavan Jul 20, 2022
c3aa0dc
Modify regexp.
Adaickalavan Jul 20, 2022
f456cab
Update making of track1_evaluation.zip
Adaickalavan Jul 20, 2022
07d5a88
Update evaluation config.
Adaickalavan Jul 20, 2022
26d9d91
Remove file.
Adaickalavan Jul 20, 2022
9736787
Merge branch 'develop' into comp-4
Adaickalavan Jul 20, 2022
c98c30c
Change done criteria.
Adaickalavan Jul 20, 2022
964da50
Fix validation submission output.
Adaickalavan Jul 21, 2022
8acb850
Fix score output for different stages.
Adaickalavan Jul 21, 2022
9fcc5af
add in offline baseline code (#1515)
cz0204 Jul 21, 2022
6a4ac27
Add waymo commands to scl
saulfield Jul 21, 2022
7f96df1
Merge branch 'develop' into saul/waymo-utils
saulfield Jul 21, 2022
73bb1eb
Implement preview and add remaining commands
saulfield Jul 22, 2022
8f06601
Merge branch 'develop' into comp-4
Adaickalavan Jul 25, 2022
64a205e
Update done criteria.
Adaickalavan Jul 25, 2022
13d17db
Add Track-2 instructions.
Adaickalavan Jul 26, 2022
392a65a
Merge branch 'comp-4' into comp-1
Adaickalavan Jul 26, 2022
09f2022
Remove util file.
Adaickalavan Jul 26, 2022
9c966ed
Update dates.
Adaickalavan Jul 26, 2022
354fe0d
Merge branch 'comp-4' into comp-1
Adaickalavan Jul 26, 2022
8e6c291
Changed metrics.
Adaickalavan Jul 27, 2022
1ec375d
Rectify speed_limit cost function.
Adaickalavan Jul 27, 2022
875a793
Change dist to obstacle calc.
Adaickalavan Jul 27, 2022
fa6b6ec
Make Format.
Adaickalavan Jul 27, 2022
093af4a
Fix pytype.
Adaickalavan Jul 27, 2022
08f0531
Reorder code.
Adaickalavan Jul 27, 2022
48adac4
Merge branch 'comp-4' into comp-1
Adaickalavan Jul 27, 2022
9d0dca6
Minor corrections.
Adaickalavan Jul 27, 2022
eb0ab5d
Reduce eval episodes.
Adaickalavan Jul 27, 2022
cdc857e
update terms and conditions and rules
Gamenot Jul 28, 2022
1f3f819
Dockerfile for Track2.
Adaickalavan Jul 28, 2022
2b3a851
Add Dockerfile instructions for Track2.
Adaickalavan Jul 28, 2022
bf473d9
Update Track-2 instructions.
Adaickalavan Jul 28, 2022
68fb0c2
Minor correction.
Adaickalavan Jul 28, 2022
7bd0e9e
Change to instructions.
Adaickalavan Jul 28, 2022
a49d6d1
Change to instructions [midway].
Adaickalavan Jul 28, 2022
3fc97d1
Update t&c.
Adaickalavan Jul 29, 2022
166a6cc
Hold code.
Adaickalavan Jul 29, 2022
055c213
Update agent interface resolution for multi-scenario env.
Gamenot Jul 29, 2022
ec95beb
Automate Docker.
Adaickalavan Jul 29, 2022
9b8ae6c
Minor phrase change.
Adaickalavan Jul 29, 2022
75bd394
Add link to dataset.
Adaickalavan Jul 29, 2022
bdbfb5b
Update objectives.
Adaickalavan Jul 29, 2022
5f1b245
Merge branch 'develop' into comp-x
Adaickalavan Jul 29, 2022
ab023bf
Update objectives.
Adaickalavan Jul 29, 2022
ebc361c
Fix docstring.
Adaickalavan Jul 29, 2022
0b18223
Merge branch 'comp-1' into comp-x
Adaickalavan Jul 29, 2022
742cc47
Merge branch 'develop' into comp-x
Adaickalavan Jul 29, 2022
705d498
Update from develop branch.
Adaickalavan Jul 29, 2022
b665746
Plot vehicle positions with labels for their IDs
saulfield Jul 29, 2022
1885207
Merge branch 'comp-1' into comp-x
Adaickalavan Jul 29, 2022
4fa306b
Animate trajectories
saulfield Jul 29, 2022
903465e
Zip output files.
Adaickalavan Jul 29, 2022
40f3c7f
Zip output files.
Adaickalavan Jul 29, 2022
f3c0f04
Fix resolving agent interface.
Gamenot Jul 30, 2022
72a33ea
Merge branch 'develop' into comp-x
Adaickalavan Jul 30, 2022
73dd666
Maintain same directory path in repo and docker.
Adaickalavan Jul 30, 2022
2f15ad1
Maintain same directory path in repo and docker.
Adaickalavan Jul 30, 2022
f5f8385
Offline baseline 2 (#1533)
cz0204 Jul 31, 2022
c600a6e
Revert "Offline baseline 2 (#1533)" (#1539)
Gamenot Jul 31, 2022
f66a247
Merge branch 'develop' into comp-1
Gamenot Jul 31, 2022
e3cad14
revamp of traffic_histories_to_observations.py script (not fully tested)
sah-huawei Aug 1, 2022
bd04631
pytype fixes (all but one)
sah-huawei Aug 1, 2022
8634273
pytype fix
sah-huawei Aug 1, 2022
26b6086
Add `bubble_env` contribution (#1537)
Gamenot Aug 1, 2022
c679add
Update readme for competition branch
Gamenot Aug 1, 2022
9c7a4c5
Merge develop into comp-1.
Adaickalavan Aug 2, 2022
5bac496
Merge branch 'develop' into comp-1
Adaickalavan Aug 2, 2022
2d6addb
Merge branch 'offlne_script' into saul/waymo-utils
saulfield Aug 2, 2022
410bc5c
Fixes to traffic histories script
saulfield Aug 2, 2022
58fbba9
Fix incoming lane bug
saulfield Aug 2, 2022
b6602fc
Refactor and create waymo_utils.py
saulfield Aug 2, 2022
65f4b11
Make waymo_utils a conditional import
saulfield Aug 2, 2022
c6c67ad
Type fixes
saulfield Aug 2, 2022
eba7015
Remove traffic histories vehicle replacement example and fix types
saulfield Aug 3, 2022
a419965
Remove reference to bonus track
Gamenot Aug 3, 2022
a24d965
Restore and update traffic histories vehicle replacement script. Fix …
saulfield Aug 3, 2022
d403d31
Revert incoming lanes change, since it's fixed on another PR
saulfield Aug 3, 2022
ba328e8
Merge branch 'develop' into comp-1
Gamenot Aug 3, 2022
6d869a9
Update README.md
Gamenot Aug 4, 2022
6709b1b
Remove print statement
saulfield Aug 4, 2022
bafcd63
Review suggestion
saulfield Aug 8, 2022
2fa0b4c
Clean up the instructions.
Adaickalavan Aug 9, 2022
dfb844f
Merge branch 'comp-1' into waymo-utils-1
Adaickalavan Aug 9, 2022
35b2895
Changes based on PR review
saulfield Aug 9, 2022
48c2be5
Merge branch 'saul/waymo-utils' into waymo-utils-1
Adaickalavan Aug 9, 2022
f2354be
Waymo tools and offline dataset extraction (#1545)
saulfield Aug 9, 2022
b61735d
Clean up the instructions.
Adaickalavan Aug 9, 2022
460bc27
Merge branch 'comp-1' into waymo-utils-1
Adaickalavan Aug 9, 2022
efa2203
Fix imports.
Adaickalavan Aug 9, 2022
eb8ece2
Fix bug when labelling vehicles (#1550)
saulfield Aug 9, 2022
95d77a1
Fix text.
Adaickalavan Aug 9, 2022
0ee7016
Merge branch 'comp-1' into waymo-utils-1
Adaickalavan Aug 9, 2022
bc02028
Fix waymo instructions.
Adaickalavan Aug 10, 2022
3f26774
Merge branch 'waymo-utils-1' into comp-x
Adaickalavan Aug 10, 2022
f8abdbb
Fix ToC.
Adaickalavan Aug 10, 2022
03e451a
Sync remote and local overview file.
Adaickalavan Aug 10, 2022
ba05408
Sync remote and local overview file.
Adaickalavan Aug 10, 2022
a9d9aa8
Fix missing dependency.
Adaickalavan Aug 10, 2022
2bdb643
Make format.
Adaickalavan Aug 10, 2022
57f2dc4
Improve instructions.
Adaickalavan Aug 10, 2022
f3a1e55
Merge branch 'develop' into comp-x
Adaickalavan Aug 10, 2022
2286401
Latest develop and waymo tool.
Adaickalavan Aug 10, 2022
ad42e05
Reiterate the mandatory use of TargetPose action space.
Adaickalavan Aug 10, 2022
7018ca0
Reiterate the mandatory use of TargetPose action space.
Adaickalavan Aug 10, 2022
a34573f
Merge branch 'comp-1' into comp-x
Adaickalavan Aug 10, 2022
e9b9ade
Fix plotting bug
saulfield Aug 10, 2022
bf0abae
Merge branch 'comp-1' into comp-x
Adaickalavan Aug 10, 2022
5bc869a
Merge branch 'develop' into comp-x
Adaickalavan Aug 10, 2022
d84b0d6
Merge branch 'develop' into comp-x
Adaickalavan Aug 11, 2022
16aefc0
Update zipping of folder.
Adaickalavan Aug 11, 2022
c97956e
Merge branch 'develop' into comp-x
Adaickalavan Aug 11, 2022
5aa897d
Add dataset explanation.
Adaickalavan Aug 11, 2022
ae78a3e
Update zipped folder.
Adaickalavan Aug 12, 2022
6b8f6d2
Fix issue where traffic lights are not in current dataset.
Gamenot Aug 12, 2022
6f5ecc8
Improve evaluation setup
Gamenot Aug 11, 2022
e5017cc
Add app key to the bubble_env clone command to address issues.
Gamenot Aug 12, 2022
e7b7647
Validate that evaluation dependencies are installed.
Gamenot Aug 12, 2022
457cdfc
Update readme with information on dependency install.
Gamenot Aug 12, 2022
eca68d4
Merge branch 'develop' into comp-1
Gamenot Aug 14, 2022
76808cd
Merge branch 'develop' into comp-x
Adaickalavan Aug 14, 2022
e13e15a
Merge branch 'comp-x' into comp-1
Adaickalavan Aug 14, 2022
f0626d4
Offline baseline 2 (#1543)
Gamenot Aug 14, 2022
8107bf3
Merge branch 'develop' into comp-1
Adaickalavan Aug 16, 2022
a216d4e
Range of time delta in TargetPose.
Adaickalavan Aug 16, 2022
2f80835
Change offline dataset naming.
Adaickalavan Aug 18, 2022
6774536
Merge branch 'develop' into comp-1
Gamenot Aug 18, 2022
cacff0f
Merge branch 'comp-add' into comp-1
Adaickalavan Aug 18, 2022
35a7df7
Merge branch 'develop' into comp-1
Adaickalavan Aug 18, 2022
54c6922
Remove scenario and traffic history prefix in name of offline dataset…
saulfield Aug 18, 2022
ab0ec88
Add instructions.
Adaickalavan Aug 19, 2022
b88da5e
Minor changes.
Adaickalavan Aug 19, 2022
07c123a
Minor changes.
Adaickalavan Aug 19, 2022
35d3575
Simplify instructions.
Adaickalavan Aug 20, 2022
58233c2
Simplify instructions.
Adaickalavan Aug 20, 2022
396faf9
Simplify instructions.
Adaickalavan Aug 20, 2022
965a00c
Beautify the table.
Adaickalavan Aug 20, 2022
62c6168
Add waymo dependencies.
Adaickalavan Aug 20, 2022
1251384
Add waymo dependencies.
Adaickalavan Aug 20, 2022
335101f
Bubble env seeds.
Adaickalavan Aug 20, 2022
7fa0ffc
Make Format.
Adaickalavan Aug 20, 2022
50ef281
Simplify instructions.
Adaickalavan Aug 20, 2022
acef818
Improve instructions.
Adaickalavan Aug 22, 2022
40b2e1c
Merge branch 'develop' into comp-1
Gamenot Aug 22, 2022
c3d06d2
Merge branch 'develop' into comp-1
Adaickalavan Aug 23, 2022
dfe4642
Merge branch 'develop' into comp-1
Adaickalavan Aug 23, 2022
5ce6909
Merge branch 'develop' into comp-1
Adaickalavan Aug 26, 2022
85d724d
Simplify code.
Adaickalavan Aug 26, 2022
70fc8e2
Offline baseline (#1572)
cz0204 Aug 29, 2022
bce2cf3
Add the phrase `visualize`.
Adaickalavan Aug 29, 2022
90382f0
Configure eval episode count.
Adaickalavan Aug 31, 2022
6ea8da4
Add a mirror for fallback install
Gamenot Sep 1, 2022
ad8e1a6
Remove pip extra index
Gamenot Sep 6, 2022
26d25de
Merge branch 'develop' into comp-1
Adaickalavan Sep 7, 2022
d12fc37
Limit TargetPose action range (#1622)
Adaickalavan Sep 8, 2022
34a93f0
Fix scenario path
Adaickalavan Sep 8, 2022
03b5241
Add multiprocess for eval.
Adaickalavan Sep 8, 2022
cca4237
Merge branch 'comp-1' into eval-mp
Adaickalavan Sep 8, 2022
f62f211
Multiprocess pool for eval.
Adaickalavan Sep 9, 2022
7d74ef7
Update cloudpickle version
Adaickalavan Sep 9, 2022
262d206
Use concurrent.futures.ProcessPoolExecutor .
Adaickalavan Sep 9, 2022
11921d0
Add mp_context.
Adaickalavan Sep 10, 2022
4583064
Revert temp changes.
Adaickalavan Sep 10, 2022
5270546
Update from develop branch.
Adaickalavan Sep 10, 2022
11c3842
Update from develop branch.
Adaickalavan Sep 10, 2022
9a59a1d
Ignore files during zip.
Adaickalavan Sep 10, 2022
1cf5adf
Fix name-error.
Adaickalavan Sep 10, 2022
bf8e5dd
Fix format.
Adaickalavan Sep 10, 2022
872a193
Multiprocessed evaluation.
Adaickalavan Sep 11, 2022
2c14fde
Add red-coloured ego agent to observation in pkl file. (#1627)
Adaickalavan Sep 14, 2022
c677953
Fix local traffic (#1628)
Gamenot Sep 14, 2022
d5fa226
Add example offline_dataset.
Adaickalavan Sep 14, 2022
b654e22
Move offline dataset.
Adaickalavan Sep 14, 2022
37d3799
Updates from develop.
Adaickalavan Sep 18, 2022
2690423
Add PR1630
Adaickalavan Sep 20, 2022
ea3315c
Update CQL example.
Adaickalavan Sep 28, 2022
f26df85
Envision fixes (#1651)
saulfield Oct 5, 2022
82f71a0
Bugfix trip meter sensor [closes #1656] (#1657)
Gamenot Oct 6, 2022
271a9c8
Fix signal observations (#1661)
saulfield Oct 6, 2022
1e5e50c
Goal position fixes (#1637)
saulfield Oct 6, 2022
8fa863b
Add gifs of single trained model navigating multiple scenarios.
Adaickalavan Oct 11, 2022
58a61aa
Improved example.
Adaickalavan Oct 12, 2022
e5548f8
Suppress websocket 'goodbye' messages
Gamenot Oct 17, 2022
8b7a09e
Bugfix envision resource path (#1682)
Gamenot Oct 26, 2022
3597596
Install smarts in track2 docker image to load offline dataset.
Adaickalavan Oct 27, 2022
a8c7e22
Use resource location for path (#1685)
Gamenot Oct 28, 2022
18f3645
Minor syntax update
Adaickalavan Oct 30, 2022
0097357
Read offline dataset in small chunks to avoid oom.
Adaickalavan Oct 30, 2022
e07d960
Improve costs.
Adaickalavan Nov 3, 2022
31ee15a
Update dockerfile.
Adaickalavan Nov 10, 2022
4098f4a
Updated overview
Adaickalavan Nov 22, 2022
642bfb8
Updated evaluation.html.
Adaickalavan Nov 22, 2022
b66b051
Updated terms_and_conditions.html
Adaickalavan Nov 22, 2022
c0d81ca
Updated rules.html
Adaickalavan Nov 22, 2022
95e86d7
Updated rules.html
Adaickalavan Nov 22, 2022
e70c57b
Updated data.html
Adaickalavan Nov 22, 2022
57a8087
Improved explanation.md file.
Adaickalavan Nov 22, 2022
d71d395
Remove readme preface.
Adaickalavan Nov 22, 2022
334d9ab
Improved competition.yaml
Adaickalavan Nov 22, 2022
c5839af
Merge branch 'develop' into metrics
Adaickalavan Nov 23, 2022
bee1d52
Merge branch 'develop' into metrics
Adaickalavan Nov 23, 2022
66d25a0
Moved files.
Adaickalavan Nov 23, 2022
98c908c
Update cost funcs.
Adaickalavan Nov 24, 2022
4bfe3ba
Merge branch 'develop' into metrics
Adaickalavan Nov 24, 2022
448050f
Reorganised metrics.
Adaickalavan Nov 24, 2022
c46906b
Add dataclass function.
Adaickalavan Nov 24, 2022
c0cdeb8
Refactored metrics wrapper.
Adaickalavan Nov 26, 2022
19717b3
Add docstring.
Adaickalavan Nov 26, 2022
851b15e
Prevent access to private items.
Adaickalavan Nov 26, 2022
57f2358
Remove copy_data
Adaickalavan Nov 26, 2022
6177246
Remove competition bundle and track2 folders.
Adaickalavan Nov 27, 2022
9835417
Merge branch 'develop' into metrics
Adaickalavan Nov 27, 2022
6493610
Revert md format change.
Adaickalavan Nov 27, 2022
7c959b5
Remove evaluation folder.
Adaickalavan Nov 27, 2022
a4652a3
Update to develop branch.
Adaickalavan Nov 27, 2022
01fad70
Fix docstring.
Adaickalavan Nov 27, 2022
0477f72
Fix docstring.
Adaickalavan Nov 27, 2022
3073f50
Make folder a module.
Adaickalavan Nov 27, 2022
4908418
Make method as property.
Adaickalavan Nov 27, 2022
cc28b26
Fix key error.
Adaickalavan Nov 27, 2022
2124216
Cost function returns Costs dataclass.
Adaickalavan Nov 27, 2022
33ef473
Make count and cost as frozen dataclass.
Adaickalavan Nov 28, 2022
278d4cd
CostFunc should return Cost dataclass.
Adaickalavan Nov 28, 2022
6980180
Update counts and costs.
Adaickalavan Nov 28, 2022
314cc81
Make Format.
Adaickalavan Nov 28, 2022
b66cb8e
Make Format.
Adaickalavan Nov 28, 2022
2f13875
Small modification.
Adaickalavan Nov 28, 2022
fa27aa7
Fix pytype and docstring.
Adaickalavan Nov 28, 2022
b10ccac
Fix pytype.
Adaickalavan Nov 28, 2022
d192c27
Check env compatibility for use of Metrics wrapper.
Adaickalavan Nov 28, 2022
f98197e
Prevent access to private variables.
Adaickalavan Nov 28, 2022
ec17661
Prevent access to private variables.
Adaickalavan Nov 28, 2022
fe228f6
Remove competition track1 folder.
Adaickalavan Nov 28, 2022
3dedf1c
Add changelog.
Adaickalavan Nov 28, 2022
72ffff7
Merge branch 'develop' into metrics-1
Adaickalavan Nov 29, 2022
16b55a8
Merge branch 'develop' into metrics-1
Adaickalavan Dec 12, 2022
03bbfbd
Merge review changes.
Adaickalavan Dec 12, 2022
1a337e5
Add type assert.
Adaickalavan Dec 12, 2022
57aa422
Remove termination file.
Adaickalavan Dec 12, 2022
4e73730
Fixed spelling mistake.
Adaickalavan Dec 13, 2022
1e0219d
Merge branch 'develop' into metrics-1
Adaickalavan Dec 14, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Copy and pasting the git commit messages is __NOT__ enough.
- Added `ConfigurableZone` for `Zone` object to types which enable users to build bubble by providing coordinates of the polygon.
- Added "SMARTS Performance Benchmark" development tool for evaluating the simulation performance.
- Added a "All Simulation" button on the header of Envision and made small-windowed simulation(s) in the "All Simulations" page clickable to maximize.
- An env wrapper `Metrics` is introduced to compute agents' performance metrics.
### Deprecated
### Changed
### Removed
Expand Down
5 changes: 3 additions & 2 deletions smarts/core/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class Pose:
"""A pair of position and orientation values."""

position: np.ndarray # [x, y, z]
"""Center of vehicle."""
orientation: np.ndarray # [a, b, c, d] -> a + bi + cj + dk = 0
heading_: Optional[Heading] = None # cached heading to avoid recomputing

Expand Down Expand Up @@ -335,8 +336,8 @@ def point(self) -> Point:
return Point(*self.position)

@classmethod
def from_front_bumper(cls, front_bumper_position, heading, length):
"""Convert from front bumper location
def from_front_bumper(cls, front_bumper_position, heading, length) -> "Pose":
"""Convert from front bumper location to a Pose with center of vehicle.

Args:
front_bumper_position: The (x, y) position of the centre front of the front bumper
Expand Down
20 changes: 9 additions & 11 deletions smarts/core/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@
# to allow for typing to refer to class being defined (Mission)...
from __future__ import annotations

import logging
import math
import random
from dataclasses import dataclass, field
from typing import Optional, Tuple, Union
from typing import Optional, Tuple

import numpy as np

from smarts.core.coordinates import Dimensions, Heading, Point, Pose, RefLinePoint
from smarts.core.road_map import RoadMap
from smarts.core.utils.math import min_angles_difference_signed, vec_to_radians
from smarts.sstudio.types import EntryTactic, TrapEntryTactic

from .coordinates import Dimensions, Heading, Point, Pose, RefLinePoint
from .road_map import RoadMap
from .utils.math import min_angles_difference_signed, vec_to_radians


class PlanningError(Exception):
"""Raised in cases when map related planning fails."""
Expand Down Expand Up @@ -130,7 +128,7 @@ class TraverseGoal(Goal):
successfully finishes traversing a non-closed (acyclic) map
It's a way for the vehicle to exit the simulation successfully,
for example, driving across from one side to the other on a
straight road and then continuing off the map. This goal is
straight road and then continuing off the map. This goal is
non-specific about *where* the map is exited, save for that
the vehicle must be going the correct direction in its lane
just prior to doing so."""
Expand Down Expand Up @@ -322,7 +320,7 @@ def road_map(self) -> RoadMap:
"""The road map this plan is relative to."""
return self._road_map

def create_route(self, mission: Mission) -> Mission:
def create_route(self, mission: Mission):
"""Generates a route that conforms to a mission.
Args:
mission (Mission):
Expand All @@ -333,7 +331,7 @@ def create_route(self, mission: Mission) -> Mission:

if not self._mission.requires_route:
self._route = self._road_map.empty_route()
return self._mission
return

assert isinstance(self._mission.goal, PositionalGoal)

Expand Down Expand Up @@ -374,8 +372,8 @@ def create_route(self, mission: Mission) -> Mission:
raise PlanningError(
"Unable to find a route between start={} and end={}. If either of "
"these are junctions (not well supported today) please switch to "
"roads and ensure there is a > 0 offset into the road if it's "
"roads and ensure there is a > 0 offset into the road if it is "
"after a junction.".format(start_road.road_id, end_road.road_id)
)

return self._mission
return
4 changes: 2 additions & 2 deletions smarts/core/road_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
from shapely.geometry import Point as SPoint
from shapely.geometry import Polygon

from .coordinates import BoundingBox, Heading, Point, Pose, RefLinePoint
from .utils.math import (
from smarts.core.coordinates import BoundingBox, Heading, Point, Pose, RefLinePoint
from smarts.core.utils.math import (
fast_quaternion_from_angle,
min_angles_difference_signed,
signed_dist_to_line,
Expand Down
2 changes: 1 addition & 1 deletion smarts/core/route_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _find_along(
return RoadMap.Route.RouteLane(cand_lane, rind)
except ValueError:
pass
self._logger.warning(f"unable to find road on route near point {rpt}")
self._logger.warning(f"Unable to find road on route near point {rpt}")
return None

@lru_cache(maxsize=8)
Expand Down
18 changes: 9 additions & 9 deletions smarts/core/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from smarts.core.plan import Plan
from smarts.core.road_map import RoadMap, Waypoint
from smarts.core.signals import SignalLightState, SignalState
from smarts.core.utils.math import squared_dist, vec_2d, yaw_from_quaternion
from smarts.core.utils.math import squared_dist

from .coordinates import Dimensions, Heading, Point, Pose, RefLinePoint
from .events import Events
Expand Down Expand Up @@ -88,7 +88,7 @@ class EgoVehicleObservation(NamedTuple):
steering: float
"""Angle of front wheels in radians between [-pi, pi]."""
yaw_rate: float
"""Rotational speed in radians per second"""
"""Speed of vehicle-heading rotation about the z-axis. Equivalent scalar representation of angular_velocity. Units: rad/s."""
road_id: str
"""The identifier for the road nearest to this vehicle."""
lane_id: str
Expand All @@ -98,17 +98,17 @@ class EgoVehicleObservation(NamedTuple):
mission: Mission
"""A field describing the vehicle plotted route"""
linear_velocity: np.ndarray
"""Vehicle velocity along body coordinate axes. A numpy array of shape=(3,) and dtype=np.float64."""
"""Velocity of vehicle along the global coordinate axes. Units: m/s. A numpy array of shape=(3,) and dtype=np.float64."""
angular_velocity: np.ndarray
"""Angular velocity vector. A numpy array of shape=(3,) and dtype=np.float64."""
"""Velocity of vehicle-heading rotation about the z-axis. Equivalent vector representation of yaw_rate. Units: rad/s. A numpy array of shape=(3,) and dtype=np.float64."""
linear_acceleration: Optional[np.ndarray]
"""Linear acceleration vector. A numpy array of shape=(3,). dtype=np.float64. Requires accelerometer sensor."""
"""Acceleration of vehicle along the global coordinate axes. Units: m/s^2. A numpy array of shape=(3,). dtype=np.float64. Requires accelerometer sensor."""
angular_acceleration: Optional[np.ndarray]
"""Angular acceleration vector. A numpy array of shape=(3,) and dtype=np.float64. Requires accelerometer sensor."""
"""Acceleration of vehicle-heading rotation about the z-axis. Units: rad/s^2. A numpy array of shape=(3,) and dtype=np.float64. Requires accelerometer sensor."""
linear_jerk: Optional[np.ndarray]
"""Linear jerk vector. A numpy array of shape=(3,) and dtype=np.float64. Requires accelerometer sensor."""
"""Jerk of vehicle along the global coordinate axes. Units: m/s^3. A numpy array of shape=(3,) and dtype=np.float64. Requires accelerometer sensor."""
angular_jerk: Optional[np.ndarray]
"""Angular jerk vector. A numpy array of shape=(3,) and dtype=np.float64. Requires accelerometer sensor."""
"""Jerk of vehicle-heading rotation about the z-axis. Units: rad/s^3. A numpy array of shape=(3,) and dtype=np.float64. Requires accelerometer sensor."""
lane_position: Optional[RefLinePoint] = None
"""(s,t,h) coordinates within the lane, where s is the longitudinal offset along the lane, t is the lateral displacement from the lane center, and h (not yet supported) is the vertical displacement from the lane surface.
See the Reference Line coordinate system in OpenDRIVE here: https://www.asam.net/index.php?eID=dumpFile&t=f&f=4089&token=deea5d707e2d0edeeb4fccd544a973de4bc46a09#_coordinate_systems """
Expand Down Expand Up @@ -204,7 +204,7 @@ class SignalObservation:
"""If known, the simulation time this signal last changed its state."""


@dataclass
@dataclass(frozen=True)
class Observation:
"""The simulation observation."""

Expand Down
2 changes: 1 addition & 1 deletion smarts/core/smarts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ def resetting(self) -> bool:
return self._resetting

@property
def scenario(self):
def scenario(self) -> Scenario:
"""The current simulation scenario."""
return self._scenario

Expand Down
32 changes: 27 additions & 5 deletions smarts/core/utils/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import math
from dataclasses import dataclass
from math import factorial
from typing import Callable, List, Optional, Sequence, Tuple, Union
from typing import Callable, List, Sequence, Tuple, Union


@dataclass(frozen=True)
Expand Down Expand Up @@ -526,11 +526,13 @@ def welford() -> Tuple[
Callable[[float], None], Callable[[], float], Callable[[], float], Callable[[], int]
]:
"""Welford's online mean and std computation
Reference: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm
Reference: https://www.adamsmith.haus/python/answers/how-to-find-a-running-standard-deviation-in-python
Reference:
https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm
https://www.adamsmith.haus/python/answers/how-to-find-a-running-standard-deviation-in-python

:return: Callable functions to update, get mean, get std, get steps
:rtype: Tuple[ Callable[[float], None], Callable[[], float], Callable[[], float], Callable[[], int] ]
Returns:
Tuple[ Callable[[float], None], Callable[[], float], Callable[[], float], Callable[[], int] ]: Callable
functions to update, get mean, get std, and get steps.
"""

import math
Expand All @@ -548,6 +550,7 @@ def update(val: float):
S = newS

def mean() -> float:
nonlocal M
return M

def std() -> float:
Expand All @@ -559,6 +562,25 @@ def std() -> float:
return std

def steps() -> int:
nonlocal n
return n

return update, mean, std, steps


def running_mean(prev_mean: float, prev_step: int, new_val: float) -> Tuple[float, int]:
"""
Returns a new running mean value, when given previous mean, previous step
count, and new value,

Args:
prev_mean (float): Previous mean value.
prev_step (int): Previous step count.
new_val (float): New value to be averaged.

Returns:
Tuple[float, int]: Updated mean and step count.
"""
new_step = prev_step + 1
new_mean = prev_mean + (new_val - prev_mean) / new_step
return new_mean, new_step
8 changes: 3 additions & 5 deletions smarts/core/vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import os
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
from typing import Any, Dict, List, Optional, Tuple, Union

import numpy as np
from shapely.affinity import rotate as shapely_rotate
Expand All @@ -35,7 +35,7 @@
from . import models
from .actor import ActorRole, ActorState
from .chassis import AckermannChassis, BoxChassis, Chassis
from .colors import Colors, SceneColors
from .colors import SceneColors
from .coordinates import Dimensions, Heading, Pose
from .sensors import (
AccelerometerSensor,
Expand Down Expand Up @@ -152,9 +152,7 @@ class VehicleConfig:
class Vehicle:
"""Represents a single vehicle."""

_HAS_DYNAMIC_ATTRIBUTES = True

_HAS_DYNAMIC_ATTRIBUTES = True # pytype dynamic
_HAS_DYNAMIC_ATTRIBUTES = True # pytype: dynamic attribute

def __init__(
self,
Expand Down
5 changes: 3 additions & 2 deletions smarts/env/multi_scenario_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def multi_scenario_v0_env(
.. note::

A ``smarts.core.controllers.ActionSpaceType.TargetPose``, which is a
sequence of ``[x-coordinate, y-coordinate, heading, and time-delta]``.
sequence of [x-coordinate, y-coordinate, heading, and time-delta].
Use time-delta = 0.1 .

Type:

Expand All @@ -91,7 +92,7 @@ def multi_scenario_v0_env(
* - Ego's next heading with respect to the map's axes
- [-π,π]
* - Time delta to reach the given pose
- [-1e10,1e10]
- [0,1e10]

Reward:

Expand Down
19 changes: 19 additions & 0 deletions smarts/env/wrappers/metric/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (C) 2022. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Loading