Exemplo n.º 1
0
class GPDAgent(Agent):
    def __init__(self, vehicle: Vehicle, agent_settings: AgentConfig):
        super().__init__(vehicle=vehicle, agent_settings=agent_settings)
        self.depth_to_pointcloud_detector = GroundPlaneDetector(agent=self)

    def run_step(self, vehicle: Vehicle,
                 sensors_data: SensorsData) -> VehicleControl:
        super(GPDAgent, self).run_step(vehicle=vehicle,
                                       sensors_data=sensors_data)
        try:
            self.depth_to_pointcloud_detector.run_step()

        except Exception as e:
            print(e)
        # print(np.shape(points))
        return VehicleControl()

    @staticmethod
    def visualize_pointcloud(points):
        """

        :param points: Nx3 array
        :return:
        """
        pcd = o3d.geometry.PointCloud()
        pcd.points = o3d.utility.Vector3dVector(points)
        o3d.visualization.draw_geometries([pcd])
Exemplo n.º 2
0
 def __init__(self, vehicle: Vehicle, agent_settings: AgentConfig):
     super().__init__(vehicle=vehicle, agent_settings=agent_settings)
     self.output_file_path: Path = self.output_folder_path / "Users\James Cheney\git\ROAR\ROAR_Sim\data\easy_map_waypointsJAM1.txt"
     self.output_file = self.output_file_path.open('w')
     # self.depth_to_pointcloud_detector = DepthToPointCloudDetector(self)
     self.gpd = GroundPlaneDetector(self,
                                    should_compute_global_pointcloud=False)
Exemplo n.º 3
0
class GPDFloodFillAgent(Agent):
    def __init__(self,
                 vehicle: Vehicle,
                 agent_settings: AgentConfig,
                 target_speed=50):
        super().__init__(vehicle=vehicle, agent_settings=agent_settings)
        self.gpd_detector = GroundPlaneDetector(self)

    def run_step(self, sensors_data: SensorsData,
                 vehicle: Vehicle) -> VehicleControl:
        super(GPDFloodFillAgent, self).run_step(sensors_data=sensors_data,
                                                vehicle=vehicle)
        self.gpd_detector.run_in_series()
        return VehicleControl()
Exemplo n.º 4
0
class JSONWaypointGeneratigAgent(Agent):
    def __init__(self, vehicle: Vehicle, agent_settings: AgentConfig):
        super().__init__(vehicle=vehicle, agent_settings=agent_settings)
        self.output_file_path: Path = self.output_folder_path / "easy_map_waypoint_t.txt"
        self.output_file = self.output_file_path.open('w')
        # self.depth_to_pointcloud_detector = DepthToPointCloudDetector(self)
        self.gpd = GroundPlaneDetector(self,
                                       should_compute_global_pointcloud=False)

    def run_step(self, sensors_data: SensorsData,
                 vehicle: Vehicle) -> VehicleControl:
        super(JSONWaypointGeneratigAgent,
              self).run_step(sensors_data=sensors_data, vehicle=vehicle)
        try:
            self.gpd.run_in_series()

        except Exception as e:
            self.logger.error(e)

        return VehicleControl()
Exemplo n.º 5
0
 def __init__(self, vehicle: Vehicle, agent_settings: AgentConfig, **kwargs):
     super().__init__(vehicle, agent_settings, **kwargs)
     # initialize occupancy grid map content
     self.occu_map = OccupancyGridMap(agent=self)
     self.depth_to_pcd = DepthToPointCloudDetector(agent=self)
     self.ground_plane_detector = GroundPlaneDetector(agent=self)
     # initialize open3d related content
     self.vis = o3d.visualization.Visualizer()
     self.vis.create_window(width=500, height=500)
     self.pcd = o3d.geometry.PointCloud()
     self.coordinate_frame = o3d.geometry.TriangleMesh.create_coordinate_frame()
     self.points_added = False
Exemplo n.º 6
0
class JSONWaypointGeneratingAgent(
        Agent):  #added n to "GeneratigAgent".  below in line 22 also 201125
    def __init__(self, vehicle: Vehicle, agent_settings: AgentConfig):
        super().__init__(vehicle=vehicle, agent_settings=agent_settings)
        self.output_file_path: Path = self.output_folder_path / "Users\James Cheney\git\ROAR\ROAR_Sim\data\easy_map_waypointsJAM1.txt"
        self.output_file = self.output_file_path.open('w')
        # self.depth_to_pointcloud_detector = DepthToPointCloudDetector(self)
        self.gpd = GroundPlaneDetector(self,
                                       should_compute_global_pointcloud=False)

    def run_step(self, sensors_data: SensorsData,
                 vehicle: Vehicle) -> VehicleControl:
        super(JSONWaypointGeneratingAgent,
              self).run_step(sensors_data=sensors_data, vehicle=vehicle)
        try:
            self.gpd.run_in_series()
            ground_points = self.kwargs["ground_points"]
            # using the next waypoint to find the line

        except Exception as e:
            self.logger.error(e)

        return VehicleControl()
Exemplo n.º 7
0
 def __init__(self, vehicle: Vehicle, agent_settings: AgentConfig):
     super().__init__(vehicle=vehicle, agent_settings=agent_settings)
     self.depth_to_pointcloud_detector = GroundPlaneDetector(agent=self)
Exemplo n.º 8
0
 def __init__(self,
              vehicle: Vehicle,
              agent_settings: AgentConfig,
              target_speed=50):
     super().__init__(vehicle=vehicle, agent_settings=agent_settings)
     self.gpd_detector = GroundPlaneDetector(self)