code: def _on_actor_constellation_request(self, actor_constellation_data):
      # print("_on_actor_constellation_request: ", str(actor_constellation_data))
  
      actor_constellation_result = carla.RssActorConstellationResult()
      actor_constellation_result.rss_calculation_mode = (
          ad.rss.map.RssMode.NotRelevant
      )
      actor_constellation_result.restrict_speed_limit_mode = (
          ad.rss.map.RssSceneCreation.RestrictSpeedLimitMode.IncreasedSpeedLimit10
      )
      actor_constellation_result.ego_vehicle_dynamics = (
          self.current_vehicle_parameters
      )
      actor_constellation_result.actor_object_type = (
          ad.rss.world.ObjectType.Invalid
      )
      actor_constellation_result.actor_dynamics = (
          self.current_vehicle_parameters
      )
  
      actor_id = -1
      # actor_type_id = "none"
      if actor_constellation_data.other_actor != None:
          actor_id = actor_constellation_data.other_actor.id
          # actor_type_id = actor_constellation_data.other_actor.type_id
  
          ego_on_the_sidewalk = False
          ego_on_routeable_road = False
          for (
              occupied_region
          ) in (
              actor_constellation_data.ego_match_object.mapMatchedBoundingBox.laneOccupiedRegions
          ):
              lane = ad.map.lane.getLane(occupied_region.laneId)
              if lane.type == ad.map.lane.LaneType.PEDESTRIAN:
                  # if not ego_on_the_sidewalk:
                  #   print ( "ego-{} on lane of lane type {} => sidewalk".format(actor_id, lane.type))
                  ego_on_the_sidewalk = True
              elif ad.map.lane.isRouteable(lane):
                  # if not ego_on_routeable_road:
                  #   print ( "ego-{} on lane of lane type {} => road".format(actor_id, lane.type))
                  ego_on_routeable_road = True
  
          if (
              "walker.pedestrian"
              in actor_constellation_data.other_actor.type_id
          ):
              # determine if the pedestrian is walking on the sidewalk or on the road
              pedestrian_on_the_road = False
              pedestrian_on_the_sidewalk = False
              for (
                  occupied_region
              ) in (
                  actor_constellation_data.other_match_object.mapMatchedBoundingBox.laneOccupiedRegions
              ):
                  lane = ad.map.lane.getLane(occupied_region.laneId)
                  if lane.type == ad.map.lane.LaneType.PEDESTRIAN:
                      # if not pedestrian_on_the_sidewalk:
                      #   print ( "pedestrian-{} on lane of lane type {} => sidewalk".format(actor_id, lane.type))
                      pedestrian_on_the_sidewalk = True
                  else:
                      # if not pedestrian_on_the_road:
                      #    print ( "pedestrian-{} on lane of lane type {} => road".format(actor_id, lane.type))
                      pedestrian_on_the_road = True
              if (
                  ego_on_routeable_road
                  and not ego_on_the_sidewalk
                  and not pedestrian_on_the_road
                  and pedestrian_on_the_sidewalk
              ):
                  # pedestrian is not on the road, but on the sidewalk: then common sense is that vehicle has priority
                  # This analysis can and should be done more detailed, but this is a basic starting point for the decision
                  # In addition, the road network has to be correct to work best
                  # (currently there are no sidewalks in intersection areas)
                  # print ( "pedestrian-{} Off".format(actor_id))
                  actor_constellation_result.rss_calculation_mode = (
                      ad.rss.map.RssMode.NotRelevant
                  )
              else:
                  # print ( "pedestrian-{} Unstructured".format(actor_id))
                  actor_constellation_result.rss_calculation_mode = (
                      ad.rss.map.RssMode.Unstructured
                  )
              actor_constellation_result.actor_object_type = (
                  ad.rss.world.ObjectType.Pedestrian
              )
              actor_constellation_result.actor_dynamics = (
                  self.get_pedestrian_parameters()
              )
          elif (
              "vehicle" in actor_constellation_data.other_actor.type_id
          ):
              actor_constellation_result.actor_object_type = (
                  ad.rss.world.ObjectType.OtherVehicle
              )
  
              # set the response time of others vehicles to 2 seconds; the rest stays the same
              actor_constellation_result.actor_dynamics.responseTime = (
                  2.0
              )
  
              # per default, if ego is not on the road -> unstructured
              if ego_on_routeable_road:
                  actor_constellation_result.rss_calculation_mode = (
                      ad.rss.map.RssMode.Structured
                  )
              else:
                  # print("vehicle-{} unstructured: reason other ego not on routeable road".format(actor_id))
                  actor_constellation_result.rss_calculation_mode = (
                      ad.rss.map.RssMode.Unstructured
                  )
  
              # special handling for vehicles standing still
              actor_vel = (
                  actor_constellation_data.other_actor.get_velocity()
              )
              actor_speed = math.sqrt(
                  actor_vel.x**2 + actor_vel.y**2 + actor_vel.z**2
              )
              if actor_speed < 0.01:
                  # reduce response time
                  actor_constellation_result.actor_dynamics.responseTime = (
                      1.0
                  )
                  # still in structured?
                  if (
                      actor_constellation_result.rss_calculation_mode
                      == ad.rss.map.RssMode.Structured
                  ):
                      actor_distance = math.sqrt(
                          float(
                              actor_constellation_data.ego_match_object.enuPosition.centerPoint.x
                              - actor_constellation_data.other_match_object.enuPosition.centerPoint.x
                          )
                          ** 2
                          + float(
                              actor_constellation_data.ego_match_object.enuPosition.centerPoint.y
                              - actor_constellation_data.other_match_object.enuPosition.centerPoint.y
                          )
                          ** 2
                      )
                      # print("vehicle-{} unstructured check: other distance {}".format(actor_id, actor_distance))
  
                      if (
                          actor_constellation_data.ego_dynamics_on_route.ego_speed
                          < 0.01
                      ):
                          # both vehicles stand still, so we have to analyze in detail if we possibly want to use
                          # unstructured mode to cope with blockades on the road...
  
                          if actor_distance < 10:
                              # the other has to be near enough to trigger a switch to unstructured
                              other_outside_routeable_road = False
                              for (
                                  occupied_region
                              ) in (
                                  actor_constellation_data.other_match_object.mapMatchedBoundingBox.laneOccupiedRegions
                              ):
                                  lane = ad.map.lane.getLane(
                                      occupied_region.laneId
                                  )
                                  if not ad.map.lane.isRouteable(lane):
                                      other_outside_routeable_road = (
                                          True
                                      )
  
                              if other_outside_routeable_road:
                                  # if the other is somewhat outside the standard routeable road (e.g. parked at the side, ...)
                                  # we immediately decide for unstructured
                                  # print("vehicle-{} unstructured: reason other outside routeable
                                  # road".format(actor_id))
                                  actor_constellation_result.rss_calculation_mode = (
                                      ad.rss.map.RssMode.Unstructured
                                  )
                              else:
                                  # otherwise we have to look in the orientation delta in addition to get some basic idea of the
                                  # constellation (we don't want to go into unstructured if we both waiting
                                  # behind a red light...)
                                  heading_delta = abs(
                                      float(
                                          actor_constellation_data.ego_match_object.enuPosition.heading
                                          - actor_constellation_data.other_match_object.enuPosition.heading
                                      )
                                  )
                                  if (
                                      heading_delta > 0.2
                                  ):  # around 11 degree
                                      # print("vehicle-{} unstructured: reason heading delta
                                      # {}".format(actor_id, heading_delta))
                                      actor_constellation_result.rss_calculation_mode = (
                                          ad.rss.map.RssMode.Unstructured
                                      )
                                      self.change_to_unstructured_position_map[
                                          actor_id
                                      ] = (
                                          actor_constellation_data.other_match_object.enuPosition
                                      )
                      else:
                          # ego moves
                          if actor_distance < 10:
                              # if the ego moves, the other actor doesn't move an the mode was
                              # previously set to unstructured, keep it
                              try:
                                  if (
                                      self.change_to_unstructured_position_map[
                                          actor_id
                                      ]
                                      == actor_constellation_data.other_match_object.enuPosition
                                  ):
                                      heading_delta = abs(
                                          float(
                                              actor_constellation_data.ego_match_object.enuPosition.heading
                                              - actor_constellation_data.other_match_object.enuPosition.heading
                                          )
                                      )
                                      if heading_delta > 0.2:
                                          actor_constellation_result.rss_calculation_mode = (
                                              ad.rss.map.RssMode.Unstructured
                                          )
                                      else:
                                          del self.change_to_unstructured_position_map[
                                              actor_id
                                          ]
                              except (AttributeError, KeyError):
                                  pass
                          else:
                              if (
                                  actor_id
                                  in self.change_to_unstructured_position_map
                              ):
                                  del self.change_to_unstructured_position_map[
                                      actor_id
                                  ]
  
                  # still in structured?
                  if (
                      actor_constellation_result.rss_calculation_mode
                      == ad.rss.map.RssMode.Structured
                  ):
                      # in structured case we have to cope with not yet implemented lateral intersection checks in core RSS implementation
                      # if the other is standing still, we don't assume that he will accelerate
                      # otherwise if standing at the intersection the acceleration within reaction time
                      # will allow to enter the intersection which current RSS implementation will immediately consider
                      # as dangerous
                      # print("_on_actor_constellation_result({}) setting accelMax to
                      # zero".format(actor_constellation_data.other_actor.id))
                      actor_constellation_result.actor_dynamics.alphaLon.accelMax = (
                          0.0
                      )
                      actor_constellation_result.actor_dynamics.alphaLat.accelMax = (
                          0.0
                      )
      else:
          # store route for debug drawings
          self.route = actor_constellation_data.ego_route
      # since the ego vehicle is controlled manually, it is easy possible that the ego vehicle
      # accelerates far more in lateral direction than the ego_dynamics indicate
      # in an automated vehicle this would be considered by the low-level controller when the RSS restriction
      # is taken into account properly
      # but the simple RSS restrictor within CARLA is not able to do so...
      # So we should at least tell RSS about the fact that we acceleration more than this
      # to be able to react on this
      abs_avg_route_accel_lat = abs(
          float(
              actor_constellation_data.ego_dynamics_on_route.avg_route_accel_lat
          )
      )
      if (
          abs_avg_route_accel_lat
          > actor_constellation_result.ego_vehicle_dynamics.alphaLat.accelMax
      ):
          # print("!! Route lateral dynamics exceed expectations: route:{} expected:{} !!".format(abs_avg_route_accel_lat,
          #                                                                                      actor_constellation_result.ego_vehicle_dynamics.alphaLat.accelMax))
          actor_constellation_result.ego_vehicle_dynamics.alphaLat.accelMax = min(
              20.0, abs_avg_route_accel_lat
          )
  
      # print("_on_actor_constellation_result({}-{}): ".format(actor_id,
      # actor_type_id), str(actor_constellation_result))
      return actor_constellation_result
  
imports: import glob
  import os
  import sys
  import inspect
  import carla
  from carla import ad
  import math
  from rss_visualization import RssDebugVisualizer
label_desc: Use image node_id 2 for calling the RssSensor obj's underlying member method code with example usage: obj._on_actor_constellation_request(actor_constellation_data) and returns: actor_constellation_result