From f0a4956f07487d98fd21af75d4fadfed4d60b324 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 9 Sep 2024 16:43:21 +0200 Subject: [PATCH] Fix wrong literal comparison and type-error --- PythonAPI/examples/rss/rss_sensor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PythonAPI/examples/rss/rss_sensor.py b/PythonAPI/examples/rss/rss_sensor.py index 02266071897..e3622bdb317 100644 --- a/PythonAPI/examples/rss/rss_sensor.py +++ b/PythonAPI/examples/rss/rss_sensor.py @@ -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 ----------------------------------------------------------------- @@ -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: