Example #1
0
 public MissionDebugger(CameraDefinition cameraDefinition, SurveyArea surveyArea, Mission mission, Transform droneTransform)
 {
     this.cameraDefinition = cameraDefinition;
     this.surveyArea       = surveyArea;
     this.flightPlan       = mission.CalculateFlightPlan();
     this.droneTransform   = droneTransform;
 }
Example #2
0
 public SerializedSurveyArea(SurveyArea surveyArea)
 {
     this.areaWidth      = surveyArea.areaToCover.size.x;
     this.areaDistance   = surveyArea.areaToCover.size.z;
     this.frontalOverlap = surveyArea.frontalOverlap;
     this.sideOverlap    = surveyArea.sideOverlap;
 }
Example #3
0
 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);
 }
Example #4
0
    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());
    }
Example #5
0
    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;
    }
Example #6
0
 public GridMission(SurveyArea surveyArea, CameraDefinition cameraDefinition, float relativeAltitude, float cameraAngle)
     : base(MissionType.Grid, surveyArea, cameraDefinition)
 {
     this.altitude    = surveyArea.areaToCover.center.y - surveyArea.areaToCover.extents.y + relativeAltitude;
     this.cameraAngle = cameraAngle;
     this.imageWidth  = altitude * cameraDefinition.sensorSizeX / cameraDefinition.focalLength;
     this.imageHeight = altitude * cameraDefinition.sensorSizeY / cameraDefinition.focalLength;
 }
Example #7
0
 public DoubleGridMission(SurveyArea surveyArea, CameraDefinition cameraDefinition, float relativeAltitude1, float cameraAngle1, float relativeAltitude2, float cameraAngle2)
     : base(MissionType.DoubleGrid, surveyArea, cameraDefinition)
 {
     this.altitude1    = surveyArea.areaToCover.center.y - surveyArea.areaToCover.extents.y + relativeAltitude1;
     this.altitude2    = surveyArea.areaToCover.center.y - surveyArea.areaToCover.extents.y + relativeAltitude2;
     this.cameraAngle1 = cameraAngle1;
     this.cameraAngle2 = cameraAngle2;
 }
Example #8
0
    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();
    }
Example #9
0
    public static List <GroundControlPoint> LocateGCPs(SurveyArea surveyArea)
    {
        // For now, we are looking for manually placed GCPs. In the future, it might make sense to locate them automatically.
        // Maybe using Voronoi diagrams?

        return(GameObject.FindGameObjectsWithTag("GCP")
               .Select(GroundControlPoint.FromGameObject)
               .Where(gcp => gcp.IsContainedByBound(surveyArea.areaToCover))
               .ToList());
    }
Example #10
0
    public Mission BuildMission(SurveyArea surveyArea, CameraDefinition cameraDefinition)
    {
        switch (missionType)
        {
        case MissionType.Grid:
            return(new GridMission(surveyArea, cameraDefinition, altitude1, cameraAngle1));

        case MissionType.DoubleGrid:
            return(new DoubleGridMission(surveyArea, cameraDefinition, altitude1, cameraAngle1, altitude2, cameraAngle2));

        default:
            throw new System.Exception("Couldn't fin a mission for the selected mission type");
        }
    }
Example #11
0
    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();
    }
Example #12
0
    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;
    }
Example #13
0
 protected Mission(MissionType missionType, SurveyArea surveyArea, CameraDefinition cameraDefinition)
 {
     this.missionType      = missionType;
     this.surveyArea       = surveyArea;
     this.cameraDefinition = cameraDefinition;
 }
Example #14
0
 public Georeferencing BuildDomain(SurveyArea surveyArea)
 {
     return(new Georeferencing(centerEasting, centerNorthing, utmZone, utmHemisphere == Hemisphere.North ? Georeferencing.Hemisphere.North : Georeferencing.Hemisphere.South, dilutionOfPrecision, noiseRandomSeed, noise, surveyArea));
 }
Example #15
0
 public Georeferencing(double centerEasting, double centerNorthing, int utmZone, Hemisphere hemisphere, float dilutionOfPrecision, int noiseRandomSeed, int maxNoise, SurveyArea surveyArea)
 {
     this.centerEasting       = centerEasting;
     this.centerNorthing      = centerNorthing;
     this.utmZone             = utmZone;
     this.hemisphere          = hemisphere;
     this.dilutionOfPrecision = dilutionOfPrecision;
     Random.InitState(noiseRandomSeed);
     this.noise  = maxNoise;
     this.center = surveyArea.areaToCover.center;
 }
Example #16
0
 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);
 }
Example #17
0
 public GroundControlPointManager(CameraDefinition cameraDefinition, SurveyArea surveyArea)
 {
     this.cameraDefinition = cameraDefinition;
     this.gcps             = LocateGCPs(surveyArea);
     this.associations     = new List <ImageAssociation>();
 }