Skip to content

Commit

Permalink
Fix heading source attribute. (#1934)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamenot authored Mar 30, 2023
1 parent 6dbf4f7 commit cc87d3f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Copy and pasting the git commit messages is __NOT__ enough.
### Changed
### Deprecated
### Fixed
- Fix case where heading source attribute could be undefined.
### Removed
### Security

Expand Down
11 changes: 8 additions & 3 deletions smarts/core/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def from_bullet(cls, bullet_heading):
counter-clockwise.
"""
h = Heading(bullet_heading)
h.source = "bullet"
h._source = "bullet"
return h

@classmethod
Expand All @@ -232,17 +232,22 @@ def from_panda3d(cls, p3d_heading):
and turns counter-clockwise.
"""
h = Heading(math.radians(p3d_heading))
h.source = "p3d"
h._source = "p3d"
return h

@classmethod
def from_sumo(cls, sumo_heading):
"""Sumo's space uses degrees, 0 faces north, and turns clockwise."""
heading = Heading.flip_clockwise(math.radians(sumo_heading))
h = Heading(heading)
h.source = "sumo"
h._source = "sumo"
return h

@property
def source(self) -> Optional[str]:
"""The source of this heading."""
return getattr(self, "_source", None)

@property
def as_panda3d(self):
"""Convert to Panda3D facing format."""
Expand Down
21 changes: 21 additions & 0 deletions smarts/waymo/waymo_open_dataset/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License
#
# Copyright (C) 2023. 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.

0 comments on commit cc87d3f

Please sign in to comment.