Exemple #1
0
 def _publish_collision(self, collision_event):
     """
     Function to wrap the collision event into a ros messsage
     :param collision_event: carla collision event object
     :type collision_event: carla.CollisionEvent
     """
     collision_msg = CarlaCollisionEvent()
     collision_msg.header.frame_id = "ego_vehicle"
     set_timestamp(collision_msg.header, collision_event.timestamp)
     collision_msg.other_actor_id = collision_event.other_actor.id
     collision_msg.normal_impulse.x = collision_event.normal_impulse.x
     collision_msg.normal_impulse.y = collision_event.normal_impulse.y
     collision_msg.normal_impulse.z = collision_event.normal_impulse.z
     self.publish("collision", collision_msg)
Exemple #2
0
    def sensor_data_updated(self, collision_event):
        """
        Function to wrap the collision event into a ros messsage

        :param collision_event: carla collision event object
        :type collision_event: carla.CollisionEvent
        """
        collision_msg = CarlaCollisionEvent()
        collision_msg.header = self.get_msg_header()
        collision_msg.other_actor_id = collision_event.other_actor.id
        collision_msg.normal_impulse.x = collision_event.normal_impulse.x
        collision_msg.normal_impulse.y = collision_event.normal_impulse.y
        collision_msg.normal_impulse.z = collision_event.normal_impulse.z

        self.collision_publisher.publish(collision_msg)
Exemple #3
0
    def sensor_data_updated(self, collision_event):
        """
        Function to wrap the collision event into a ros messsage

        :param collision_event: carla collision event object
        :type collision_event: carla.CollisionEvent
        """
        collision_msg = CarlaCollisionEvent()
        collision_msg.header = self.get_msg_header(use_parent_frame=False)
        collision_msg.other_actor_id = collision_event.other_actor.id
        collision_msg.normal_impulse.x = collision_event.normal_impulse.x
        collision_msg.normal_impulse.y = collision_event.normal_impulse.y
        collision_msg.normal_impulse.z = collision_event.normal_impulse.z

        self.publish_ros_message(self.topic_name(), collision_msg)