Ejemplo n.º 1
0
    def send_lidar_msg(self,
                       point_cloud_stream,
                       simulator_pc,
                       timestamp,
                       lidar_setup,
                       ego_transform=None):
        """Transforms and sends a point cloud reading.

        This method is transforms a point cloud from the challenge format
        to the type Pylot uses, and it sends it on the point cloud stream.
        """
        # Remove the intensity component of the point cloud.
        simulator_pc = simulator_pc[:, :3]
        point_cloud = PointCloud(simulator_pc, lidar_setup)
        if self._last_point_cloud is not None:
            # TODO(ionel): Should offset the last point cloud wrt to the
            # current location.
            # self._last_point_cloud.global_points = \
            #     ego_transform.transform_points(
            #         self._last_point_cloud.global_points)
            # self._last_point_cloud.points = \
            #     self._last_point_cloud._to_camera_coordinates(
            #         self._last_point_cloud.global_points)
            point_cloud.merge(self._last_point_cloud)
        point_cloud_stream.send(
            pylot.perception.messages.PointCloudMessage(
                timestamp, point_cloud))
        point_cloud_stream.send(erdos.WatermarkMessage(timestamp))
        # global_pc = ego_transform.inverse_transform_points(simulator_pc)
        self._last_point_cloud = PointCloud(simulator_pc, lidar_setup)
Ejemplo n.º 2
0
 def send_lidar_msg(self,
                    carla_pc,
                    transform,
                    timestamp,
                    ego_transform=None):
     # Remove the intensity component of the point cloud.
     carla_pc = carla_pc[:, :3]
     point_cloud = PointCloud(carla_pc, self._lidar_setup)
     if self._last_point_cloud is not None:
         # TODO(ionel): Should offset the last point cloud wrt to the
         # current location.
         # self._last_point_cloud.global_points = \
         #     ego_transform.transform_points(
         #         self._last_point_cloud.global_points)
         # self._last_point_cloud.points = \
         #     self._last_point_cloud._to_camera_coordinates(
         #         self._last_point_cloud.global_points)
         point_cloud.merge(self._last_point_cloud)
     self._point_cloud_stream.send(
         pylot.perception.messages.PointCloudMessage(
             timestamp, point_cloud))
     self._point_cloud_stream.send(erdos.WatermarkMessage(timestamp))
     # global_pc = ego_transform.inverse_transform_points(carla_pc)
     self._last_point_cloud = PointCloud(carla_pc, self._lidar_setup)