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

Fix heading source attribute. #1934

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -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.