Beispiel #1
0
    def as_simulator_bounding_box(self):
        """Retrieves the bounding box as instance of a simulator bounding box.

        Returns:
            A instance of a simulator class that represents the bounding box.
        """
        from carla import BoundingBox
        bb_loc = self.transform.location.as_simulator_location()
        bb_extent = self.extent.as_simulator_vector()
        return BoundingBox(bb_loc, bb_extent)
Beispiel #2
0
def draw_trigger_volume(world, actor):
    """Draws the trigger volume of an actor.

    Args:
        world: A handle to the world running inside the simulation.
        actor: A simulator actor.
    """
    from carla import BoundingBox
    transform = actor.get_transform()
    tv = transform.transform(actor.trigger_volume.location)
    bbox = BoundingBox(tv, actor.trigger_volume.extent)
    world.debug.draw_box(bbox, transform.rotation, life_time=1000)
 def _draw_trigger_volume(self, world, tl_actor):
     transform = tl_actor.get_transform()
     tv = transform.transform(tl_actor.trigger_volume.location)
     bbox = BoundingBox(tv, tl_actor.trigger_volume.extent)
     tl_state = tl_actor.get_state()
     if tl_state in TL_STATE_TO_PIXEL_COLOR:
         r, g, b = TL_STATE_TO_PIXEL_COLOR[tl_state]
         bbox_color = Color(r, g, b)
     else:
         bbox_color = Color(0, 0, 0)
     bbox_life_time = \
         (1 / self._flags.simulator_fps + TL_BBOX_LIFETIME_BUFFER)
     world.debug.draw_box(bbox,
                          transform.rotation,
                          thickness=0.5,
                          color=bbox_color,
                          life_time=bbox_life_time)