diff options
Diffstat (limited to 'Planification_vol')
| -rw-r--r-- | Planification_vol/.project | 17 | ||||
| -rw-r--r-- | Planification_vol/flightplan.txt | 20 | ||||
| -rw-r--r-- | Planification_vol/input.txt | 1 | ||||
| -rw-r--r-- | Planification_vol/readme.md | 0 | ||||
| -rw-r--r-- | Planification_vol/src/planification/App.java | 79 | ||||
| -rw-r--r-- | Planification_vol/src/planification/Waypoint.java | 49 |
6 files changed, 166 insertions, 0 deletions
diff --git a/Planification_vol/.project b/Planification_vol/.project new file mode 100644 index 0000000..0ade069 --- /dev/null +++ b/Planification_vol/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Planification_vol</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/Planification_vol/flightplan.txt b/Planification_vol/flightplan.txt new file mode 100644 index 0000000..35ee33a --- /dev/null +++ b/Planification_vol/flightplan.txt @@ -0,0 +1,20 @@ +23.0:0.0:0.0:0.0:0.0:true +-3.3465007775981115:22.75523967233778:0.8:0.0:0.0:true +-22.026168047437846:-6.6217762832965015:1.6:0.0:0.0:true +9.756117168751004:-20.828302326152315:2.4000000000000004:0.0:0.0:true +19.187137291649737:12.682813668558884:3.2:0.0:0.0:true +-15.339575418002024:17.137602691025023:4.0:0.0:0.0:true +-14.72331980779172:-17.66985721044423:4.8:0.0:0.0:true +19.62406247761935:-11.995673047999112:5.6:0.0:0.0:true +9.0127162998798:21.16059887852612:6.3999999999999995:0.0:0.0:true +-22.246763530299216:5.837937343527151:7.199999999999999:0.0:0.0:true +-16.79446561434967:15.714513187764567:8.0:0.0:0.0:true +17.990878528672237:14.329280853084018:7.2:0.0:0.0:true +11.55911874601273:-19.884334884918253:6.4:0.0:0.0:true +-21.354582865357497:-8.54293805704922:5.6000000000000005:0.0:0.0:true +-5.344933688256022:22.37033043716936:4.800000000000001:0.0:0.0:true +22.909958930049594:2.0331703872132243:4.000000000000001:0.0:0.0:true +-1.3218659094963057:-22.96198315732575:3.200000000000001:0.0:0.0:true +-22.525295861005265:4.648768264194198:2.4000000000000012:0.0:0.0:true +7.876728528146882:21.60919127810842:1.6000000000000012:0.0:0.0:true +20.233167326711982:-10.937044387277341:0.8000000000000012:0.0:0.0:true diff --git a/Planification_vol/input.txt b/Planification_vol/input.txt new file mode 100644 index 0000000..87d5b27 --- /dev/null +++ b/Planification_vol/input.txt @@ -0,0 +1 @@ +45.3213 3.2312 20 10 8 0.1 10 diff --git a/Planification_vol/readme.md b/Planification_vol/readme.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Planification_vol/readme.md diff --git a/Planification_vol/src/planification/App.java b/Planification_vol/src/planification/App.java new file mode 100644 index 0000000..cd51bc1 --- /dev/null +++ b/Planification_vol/src/planification/App.java @@ -0,0 +1,79 @@ +package planification; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Scanner; + +public class App { + + public static void main(String[] args) throws IOException { + + Scanner sc = new Scanner(System.in); + String line = sc.nextLine(); + + double lat; + double lon; + double longueur; + double largeur; + double alt; + double k; + double nbWaypoint; + + String[] parts = line.split(" "); + lat = Double.parseDouble(parts[0]); + lon = Double.parseDouble(parts[1]); + longueur = Double.parseDouble(parts[2]); + largeur = Double.parseDouble(parts[3]); + alt = Double.parseDouble(parts[4]); + k = Double.parseDouble(parts[5]); + nbWaypoint= Double.parseDouble(parts[6]); + + double zForEachWaypoint = alt / nbWaypoint; + + ArrayList<Waypoint> waypoints = new ArrayList<Waypoint>(); + + double r = Math.max(longueur, largeur) + 3; + double z = 0; + double theta = 0; + double gimbal = 0; + + for(int i = 0 ; i < nbWaypoint ; ++i) { + + theta = z / k; + double x = r * Math.cos(theta); + double y = r * Math.sin(theta); + + waypoints.add(new Waypoint(x, y, z, theta, gimbal, true)); + System.out.println("x = " + x + " y = " + y + " z = " + z + " t = " + theta); + + z += zForEachWaypoint; + + } + + z = alt; + for(int i = 0 ; i < nbWaypoint ; ++i) { + + theta = z / k + 180; + double x = r * Math.cos(theta); + double y = r * Math.sin(theta); + + waypoints.add(new Waypoint(x, y, z, theta, gimbal, true)); + System.out.println("x = " + x + " y = " + y + " z = " + z + " t = " + theta); + + z -= zForEachWaypoint; + + } + + BufferedWriter writer = new BufferedWriter(new FileWriter("./flightplan.txt")); + for(int i = 0 ; i < waypoints.size() ; ++i) { + Waypoint wp = waypoints.get(i); + String s = wp.getLat() + ":" + wp.getLon() + ":" + wp.getAlt() + ":" + wp.getDirection() + ":" + wp.getGimbal() + ":" + wp.isPhoto() + "\n"; + writer.write(s); + } + writer.close(); + + } + +} diff --git a/Planification_vol/src/planification/Waypoint.java b/Planification_vol/src/planification/Waypoint.java new file mode 100644 index 0000000..9efd85d --- /dev/null +++ b/Planification_vol/src/planification/Waypoint.java @@ -0,0 +1,49 @@ +package planification; + +public class Waypoint { + + private double lat; + private double lon; + private double alt; + private double direction; + private double gimbal; + private boolean photo; + + public Waypoint(double lat, double lon, double alt, double turnDegree, double gimbal, boolean photo) { + super(); + this.lat = lat; + this.lon = lon; + this.alt = alt; + this.direction = direction; + this.gimbal = gimbal; + this.photo = photo; + } + + public double getLat() { + return lat; + } + + public double getLon() { + return lon; + } + + public double getAlt() { + return alt; + } + + public double getDirection() { + return direction; + } + + public double getGimbal() { + return gimbal; + } + + public boolean isPhoto() { + return photo; + } + + + +} + |
