simulation.src.simulation_evaluation.src.speaker.speakers.speaker module

Base class for all other speakers.

Summary

Classes:

LabeledSpeakerPolygon

Speaker

Base class for all speakers.

Reference

class LabeledSpeakerPolygon(id_: int, desc: str, frame: simulation.utils.geometry.polygon.Polygon, height: float)[source]

Bases: object

id_: int
desc: str
frame: simulation.utils.geometry.polygon.Polygon
height: float
class Speaker(*, section_proxy: Callable[], List[simulation_groundtruth.msg._Section.Section]], lane_proxy: Callable[[int], simulation_groundtruth.msg._Lane.Lane], obstacle_proxy: Optional[Callable[[int], List[simulation_groundtruth.msg._LabeledPolygon.LabeledPolygon]]] = None, surface_marking_proxy: Optional[Callable[[int], List[simulation_groundtruth.msg._LabeledPolygon.LabeledPolygon]]] = None, intersection_proxy: Optional[Callable[[int], Any]] = None, sign_proxy: Optional[Callable[[int], List[simulation_groundtruth.msg._LabeledPolygon.LabeledPolygon]]] = None)[source]

Bases: object

Base class for all speakers.

This class is part of the evaluation pipeline used to automatically evaluate the cars behavior in simulation. It converts information about the cars state and the predefined groundtruth into SpeakerMsg’s which serve as inputs for the state machines.

Information is passed to the speaker by calling the Speaker.listen() function

with a new CarState msg.

Output can be retrieved in form of Speaker msgs by calling the .speak function.

sections

List of all sections as SectionMsgs

Type

Callable[[], List[SectionMsg]]

get_lanes

Get LaneMsg for a given section

Type

Callable[[int], LaneMsg]

get_obstacles

Get ObstacleMsg for a given section

Type

Callable[[int], List[LabeledPolygonMsg]]

get_intersection

Get intersections for a given section

Type

Callable[[int], Any]

listen(msg: gazebo_simulation.msg._CarState.CarState)[source]

Receive information about current observations and update internal values.

speak() → List[simulation_evaluation.msg._Speaker.Speaker][source]

Speak about the current observations.

property middle_line

Complete middle line.

property left_line

Complete left line.

property right_line

Complete right line.

property arc_length

Position of the car projected on the middle line (== Length driven so far).

property section_intervals

Get (start,end) intervals of all sections.

property current_section

Get the current section.

Returns

SectionMsg of the current.

get_road_lines(section_id: int)simulation.utils.road.sections.line_tuple.LineTuple[source]

Request and return the road lines of a single section.

Parameters

section_id (int) – id of the section

Returns

LineTuple of the section as a named tuple.

_get_labeled_polygons(proxy: Callable[[int], List[simulation_groundtruth.msg._LabeledPolygon.LabeledPolygon]], section_id: int) → List[simulation.src.simulation_evaluation.src.speaker.speakers.speaker.LabeledSpeakerPolygon][source]

Get all objects inside a section returned by a service.

Parameters
  • proxy – Service receiver function

  • section_id – id of the section

Returns

List of tuples containing id, description, polygon, and height.

get_obstacles_in_section(section_id: int) → List[simulation.src.simulation_evaluation.src.speaker.speakers.speaker.LabeledSpeakerPolygon][source]

Get all obstacles in a section.

get_traffic_signs_in_section(section_id: int) → List[simulation.src.simulation_evaluation.src.speaker.speakers.speaker.LabeledSpeakerPolygon][source]

Get all traffic_signs inside section.

get_surface_markings_in_section(section_id: int) → List[simulation.src.simulation_evaluation.src.speaker.speakers.speaker.LabeledSpeakerPolygon][source]

Get all surface_markings inside a section.

get_interval_for_polygon(*polygons: Iterable[simulation.utils.geometry.polygon.Polygon]) → Tuple[float, float][source]

Get start and end points of the polygons.

Parameters

polygon – The polygon.

Returns

Start and end point for each polygon as a tuple

car_is_inside(*polygons: Iterable[simulation.utils.geometry.polygon.Polygon], min_wheel_count: Optional[int] = None) → bool[source]

Check if the car is currently inside one of the polygons.

The car can also be in the union of the provided polygons.

Parameters
  • polygons – The polygons.

  • min_wheel_count – If provided it is enough for a given number of wheels to be inside the polygons (e.g. 3 wheels inside parking spot)

wheel_count_inside(*polygons: Iterable[simulation.utils.geometry.polygon.Polygon], in_total: bool = False) → int[source]

Get the maximum number of wheels inside one of the polygons.

Parameters
  • polygons – The polygons.

  • in_total – If true, the number of wheels are summed up

car_overlaps_with(*polygons: Iterable[simulation.utils.geometry.polygon.Polygon]) → bool[source]

Decide if the car overlaps with any of the polygons.

Parameters

polygons – The polygons.