Skip to content

Commit

Permalink
Fix wrong literal comparison and type-error
Browse files Browse the repository at this point in the history
  • Loading branch information
Daraan committed Sep 9, 2024
1 parent ea6f2ae commit 5f82dc4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions PythonAPI/examples/rss/rss_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import math
from rss_visualization import RssDebugVisualizer # pylint: disable=relative-import

EVALUATOR_NONE_STATE = ad.rss.state.RssStateEvaluator.names["None"]

# ==============================================================================
# -- RssSensor -----------------------------------------------------------------
Expand Down Expand Up @@ -52,14 +53,14 @@ def __init__(self, rss_state, ego_dynamics_on_route, world_model):
self.longitudinal_margin = float(rss_state.longitudinalState.rssStateInformation.currentDistance - rss_state.longitudinalState.rssStateInformation.safeDistance)
self.margin = max(0, self.longitudinal_margin)
self.lateral_margin = None
if rss_state.lateralStateLeft.rssStateInformation.evaluator != "None":
if rss_state.lateralStateLeft.rssStateInformation.evaluator != EVALUATOR_NONE_STATE:
self.lateral_margin = rss_state.lateralStateLeft.rssStateInformation.currentDistance - rss_state.lateralStateLeft.rssStateInformation.safeDistance
if rss_state.lateralStateRight.rssStateInformation.evaluator != "None":
if rss_state.lateralStateRight.rssStateInformation.evaluator != EVALUATOR_NONE_STATE:
lateral_margin_right = rss_state.lateralStateRight.rssStateInformation.currentDistance - rss_state.lateralStateRight.rssStateInformation.safeDistance
if self.lateral_margin==None or self.lateral_margin > lateral_margin_right:
self.lateral_margin=lateral_margin_right
if self.lateral_margin!=None and self.lateral_margin>0:
self.margin += self.lateral_margin
self.margin += float(self.lateral_margin)

def get_actor(self, world):
if self.rss_state.objectId == 18446744073709551614:
Expand Down

0 comments on commit 5f82dc4

Please sign in to comment.