diff --git a/Java/Examples/ContinuousOperation/.idea/.name b/Java/Examples/ContinuousOperation/.idea/.name new file mode 100644 index 0000000..9ac7aa6 --- /dev/null +++ b/Java/Examples/ContinuousOperation/.idea/.name @@ -0,0 +1 @@ +ContinuousOperation \ No newline at end of file diff --git a/Java/Examples/ContinuousOperation/.idea/compiler.xml b/Java/Examples/ContinuousOperation/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/Java/Examples/ContinuousOperation/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Java/Examples/ContinuousOperation/.idea/copyright/profiles_settings.xml b/Java/Examples/ContinuousOperation/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/Java/Examples/ContinuousOperation/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Java/Examples/ContinuousOperation/.idea/libraries/XPlaneConnect.xml b/Java/Examples/ContinuousOperation/.idea/libraries/XPlaneConnect.xml new file mode 100644 index 0000000..da48fd9 --- /dev/null +++ b/Java/Examples/ContinuousOperation/.idea/libraries/XPlaneConnect.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Java/Examples/ContinuousOperation/.idea/misc.xml b/Java/Examples/ContinuousOperation/.idea/misc.xml new file mode 100644 index 0000000..a61f7bc --- /dev/null +++ b/Java/Examples/ContinuousOperation/.idea/misc.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Java/Examples/ContinuousOperation/.idea/modules.xml b/Java/Examples/ContinuousOperation/.idea/modules.xml new file mode 100644 index 0000000..0a1c2fe --- /dev/null +++ b/Java/Examples/ContinuousOperation/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Java/Examples/ContinuousOperation/.idea/vcs.xml b/Java/Examples/ContinuousOperation/.idea/vcs.xml new file mode 100644 index 0000000..6564d52 --- /dev/null +++ b/Java/Examples/ContinuousOperation/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Java/Examples/ContinuousOperation/ContinuousOperation.iml b/Java/Examples/ContinuousOperation/ContinuousOperation.iml new file mode 100644 index 0000000..6c4f0ab --- /dev/null +++ b/Java/Examples/ContinuousOperation/ContinuousOperation.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Java/Examples/ContinuousOperation/libs/XPlaneConnect.jar b/Java/Examples/ContinuousOperation/libs/XPlaneConnect.jar new file mode 100644 index 0000000..eba5283 Binary files /dev/null and b/Java/Examples/ContinuousOperation/libs/XPlaneConnect.jar differ diff --git a/Java/Examples/ContinuousOperation/src/Main.java b/Java/Examples/ContinuousOperation/src/Main.java new file mode 100644 index 0000000..61a14eb --- /dev/null +++ b/Java/Examples/ContinuousOperation/src/Main.java @@ -0,0 +1,47 @@ +package gov.nasa.xpc.ex; + +import gov.nasa.xpc.XPlaneConnect; + +import java.io.IOException; + +/** + * An example program demonstrating the use of X-PlaneConnect in a continuous loop. + * + * @author Jason Watkins + * @version 1.0 + * @since 2015-06-19 + */ +public class Main +{ + public static void main(String[] args) + { + try (XPlaneConnect xpc = new XPlaneConnect()) + { + int aircraft = 0; + while(true) + { + float[] posi = xpc.getPOSI(aircraft); + float[] ctrl = xpc.getCTRL(aircraft); + + System.out.format("Loc: (%4f, %4f, %4f) Aileron:%2f Elevator:%2f Rudder:%2f\n", + posi[0], posi[1], posi[2], ctrl[1], ctrl[0], ctrl[2]); + + try + { + Thread.sleep(100); + } + catch (InterruptedException ex) {} + + if(System.in.available() > 0) + { + break; + } + } + } + catch(IOException ex) + { + System.out.println("Error:"); + System.out.println(ex.getMessage()); + } + } +}