public WaypointProcessor(CameraDefinition cameraDefinition, SurveyArea surveyArea, Georeferencing georeferencing, int totalWaypoints, string folderPath) { // Build GameObject gameObject = new GameObject("Image Capture"); // Build the render texture renderTexture = new RenderTexture(cameraDefinition.resolutionX, cameraDefinition.resolutionY, 24); // Set the camera camera = gameObject.AddComponent <Camera>(); camera.usePhysicalProperties = true; camera.focalLength = cameraDefinition.focalLength; camera.sensorSize = new Vector2(cameraDefinition.sensorSizeX, cameraDefinition.sensorSizeY); camera.targetTexture = renderTexture; camera.enabled = false; // We don't want to render constantly, so we disable the camera // Initialize queue waypointsToProcess = new Queue <WaypointData>(); // Store pertinent values this.cameraDefinition = cameraDefinition; this.totalWaypoints = totalWaypoints; this.folderPath = folderPath; // Initialize necessary entities this.gcpManager = new GroundControlPointManager(cameraDefinition, surveyArea); this.geoTagger = new GeoTagger(cameraDefinition, georeferencing); this.georeferencing = georeferencing; // Prepare the folder PrepareFolder(folderPath); // Start the waypoint listener StaticCoroutine.StartCoroutine(ProcessWaypoints()); }
void Start() { // Assert an object was selected if (surveyAreaConfiguration.objectOfInterest == null) { throw new System.Exception("You must set an object of interest!"); } // Build necessary entities cameraDefinition = cameraDefinitionConfiguration.BuildDomain(); surveyArea = surveyAreaConfiguration.BuildDomain(); georeferencing = georeferencingConfiguration.BuildDomain(surveyArea); // Set the camera Camera camera = GetComponent <Camera>(); camera.usePhysicalProperties = true; camera.focalLength = cameraDefinition.focalLength; camera.sensorSize = new Vector2(cameraDefinition.sensorSizeX, cameraDefinition.sensorSizeY); // Prepare the execution PrepareMission(flightSpecsConfigurations[0]); // Add event listeners MissionExecution.OnMissionFinished += MissionFinished; }
public SerializedGeoreferencing(Georeferencing georeferencing) { this.eastingCenter = georeferencing.centerEasting; this.northingCenter = georeferencing.centerNorthing; this.utmZone = georeferencing.utmZone; this.utmHemisphere = georeferencing.hemisphere.Value; }
public void WriteToFile(Georeferencing georeferencing, string folderPath) { if (associations.Count > 0) { using (StreamWriter file = new StreamWriter(Path.Combine(folderPath, FILE_NAME))) { file.WriteLine(georeferencing.GetDefinition()); associations.Select(association => association.MapToUTMAndPrint(georeferencing)) .ToList() .ForEach(file.WriteLine); } } }
private int currentWaypointInMission; // Starts with 1 void Start() { // Assert an object was selected if (surveyAreaConfiguration.objectOfInterest == null) { throw new System.Exception("You must set an object of interest!"); } // Build necessary entities CameraDefinition cameraDefinition = cameraDefinitionConfiguration.BuildDomain(); SurveyArea surveyArea = surveyAreaConfiguration.BuildDomain(); Georeferencing georeferencing = georeferencingConfiguration.BuildDomain(surveyArea); // Set the camera Camera camera = GetComponent <Camera>(); camera.usePhysicalProperties = true; camera.focalLength = cameraDefinition.focalLength; camera.sensorSize = new Vector2(cameraDefinition.sensorSizeX, cameraDefinition.sensorSizeY); Mission mission = flightSpecsConfiguration.BuildMission(surveyArea, cameraDefinition); // Prepare the execution missionExecution = new MissionExecution(cameraDefinition, surveyArea, georeferencing, mission, transform, flightSpecsConfiguration.speed, folderPath); missionDebugger = new MissionDebugger(cameraDefinition, surveyArea, mission, transform); // Add event listeners MissionExecution.OnWaypointReached += ReachedWaypoint; MissionExecution.OnMissionFinished += Quit; }
public GeoTagger(CameraDefinition cameraDefinition, Georeferencing georeferencing) { this.cameraDefinition = cameraDefinition; this.georeferencing = georeferencing; }
public static void WriteToXml(CameraDefinition cameraDefinition, SurveyArea surveyArea, Mission.FlightPlan flightPlan, Georeferencing georeferencing, string folderPath) { SerializedDroneFlight droneFlight = new SerializedDroneFlight(cameraDefinition, surveyArea, flightPlan, georeferencing); XmlSerializer serializer = new XmlSerializer(typeof(SerializedDroneFlight)); TextWriter writer = new StreamWriter(Path.Combine(folderPath, "droneFlight.xml")); serializer.Serialize(writer, droneFlight); writer.Close(); }
public string MapToUTMAndPrint(Georeferencing georeferencing) { UTMCoordinate coordinate = georeferencing.MapUnityToUTM(gcp); return(string.Format("{0} {1} {2} {3} {4} {5}", coordinate.Easting, coordinate.Northing, coordinate.Altitude, pixel.x, pixel.y, imageName)); }
private void SaveXML(CameraDefinition cameraDefinition, SurveyArea surveyArea, FlightPlan flightPlan, Georeferencing georeferencing, string folderPath) { Debug.Log("Writing an XML that details the mission"); XMLWriter.WriteToXml(cameraDefinition, surveyArea, flightPlan, georeferencing, folderPath); }
public MissionExecution(CameraDefinition cameraDefinition, SurveyArea surveyArea, Georeferencing georeferencing, Mission mission, Transform droneTransform, float flightSpeed, string folderPath) { // Calculate the flight plan FlightPlan flightPlan = mission.CalculateFlightPlan(); Debug.Log(string.Format("Mission calculated. Will take {0} images.", flightPlan.waypoints.Count)); // Build helpers that will move the drone, take the images, and log everything to later geotag the images droneMovement = new DroneMovement(droneTransform, flightPlan, flightSpeed); waypointProcessor = new WaypointProcessor(cameraDefinition, surveyArea, georeferencing, flightPlan.waypoints.Count, folderPath); // Save all configuration as XML SaveXML(cameraDefinition, surveyArea, flightPlan, georeferencing, folderPath); // Add event listeners droneMovement.OnReachedWaypoint += ReachedWaypoint; waypointProcessor.OnProcessedAllWaypoints += () => OnMissionFinished?.Invoke(); }
public SerializedDroneFlight(CameraDefinition cameraDefinition, SurveyArea surveyArea, Mission.FlightPlan flightPlan, Georeferencing georeferencing) { this.cameraDefinition = new SerializedCameraDefinition(cameraDefinition); this.surveyArea = new SerializedSurveyArea(surveyArea); this.flightPlan = new SerializedFlightPlan(flightPlan); this.georeferencing = new SerializedGeoreferencing(georeferencing); }