Skip to content

Commit 0722495

Browse files
committed
Simplified code
1 parent fabfa7c commit 0722495

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

PythonAPI/examples/rss/rss_sensor.py

+17-19
Original file line numberDiff line numberDiff line change
@@ -248,24 +248,22 @@ def _on_actor_constellation_request(self, actor_constellation_data):
248248
actor_constellation_result.rss_calculation_mode = ad.rss.map.RssMode.Unstructured
249249
self.change_to_unstructured_position_map[
250250
actor_id] = actor_constellation_data.other_match_object.enuPosition
251-
else:
252-
# ego moves
253-
if actor_distance < 10:
254-
# if the ego moves, the other actor doesn't move an the mode was
255-
# previously set to unstructured, keep it
256-
try:
257-
if self.change_to_unstructured_position_map[actor_id] == actor_constellation_data.other_match_object.enuPosition:
258-
heading_delta = abs(float(actor_constellation_data.ego_match_object.enuPosition.heading -
259-
actor_constellation_data.other_match_object.enuPosition.heading))
260-
if heading_delta > 0.2:
261-
actor_constellation_result.rss_calculation_mode = ad.rss.map.RssMode.Unstructured
262-
else:
263-
del self.change_to_unstructured_position_map[actor_id]
264-
except (AttributeError, KeyError):
265-
pass
266-
else:
267-
if actor_id in self.change_to_unstructured_position_map:
268-
del self.change_to_unstructured_position_map[actor_id]
251+
# ego moves
252+
elif actor_distance < 10:
253+
# if the ego moves, the other actor doesn't move an the mode was
254+
# previously set to unstructured, keep it
255+
try:
256+
if self.change_to_unstructured_position_map[actor_id] == actor_constellation_data.other_match_object.enuPosition:
257+
heading_delta = abs(float(actor_constellation_data.ego_match_object.enuPosition.heading -
258+
actor_constellation_data.other_match_object.enuPosition.heading))
259+
if heading_delta > 0.2:
260+
actor_constellation_result.rss_calculation_mode = ad.rss.map.RssMode.Unstructured
261+
else:
262+
del self.change_to_unstructured_position_map[actor_id]
263+
except (AttributeError, KeyError):
264+
pass
265+
elif actor_id in self.change_to_unstructured_position_map:
266+
del self.change_to_unstructured_position_map[actor_id]
269267

270268
# still in structured?
271269
if actor_constellation_result.rss_calculation_mode == ad.rss.map.RssMode.Structured:
@@ -399,7 +397,7 @@ def get_pedestrian_parameters():
399397
pedestrian_dynamics.unstructuredSettings.vehicleBrakeIntermediateAccelerationSteps = 3
400398
return pedestrian_dynamics
401399

402-
def get_steering_ranges(self) -> List[Tuple[float, float]]:
400+
def get_steering_ranges(self):
403401
return [
404402
((float(self.ego_dynamics_on_route.ego_heading) - float(heading_range.begin)) / self._max_steer_angle,
405403
(float(self.ego_dynamics_on_route.ego_heading) - float(heading_range.end)) / self._max_steer_angle)

0 commit comments

Comments
 (0)