diff --git a/RoboX/Robo X/jinput-dx8.dll b/Example/jinput-dx8.dll
similarity index 100%
rename from RoboX/Robo X/jinput-dx8.dll
rename to Example/jinput-dx8.dll
diff --git a/RoboX/Robo X/jinput-dx8_64.dll b/Example/jinput-dx8_64.dll
similarity index 100%
rename from RoboX/Robo X/jinput-dx8_64.dll
rename to Example/jinput-dx8_64.dll
diff --git a/RoboX/Robo X/jinput-raw.dll b/Example/jinput-raw.dll
similarity index 100%
rename from RoboX/Robo X/jinput-raw.dll
rename to Example/jinput-raw.dll
diff --git a/RoboX/Robo X/jinput-raw_64.dll b/Example/jinput-raw_64.dll
similarity index 100%
rename from RoboX/Robo X/jinput-raw_64.dll
rename to Example/jinput-raw_64.dll
diff --git a/RoboX/Robo X/jinput-wintab.dll b/Example/jinput-wintab.dll
similarity index 100%
rename from RoboX/Robo X/jinput-wintab.dll
rename to Example/jinput-wintab.dll
diff --git a/RoboX/Robo X/libjinput-linux.so b/Example/libjinput-linux.so
similarity index 100%
rename from RoboX/Robo X/libjinput-linux.so
rename to Example/libjinput-linux.so
diff --git a/RoboX/Robo X/libjinput-linux64.so b/Example/libjinput-linux64.so
similarity index 100%
rename from RoboX/Robo X/libjinput-linux64.so
rename to Example/libjinput-linux64.so
diff --git a/RoboX/Robo X/libjinput-osx.jnilib b/Example/libjinput-osx.jnilib
similarity index 100%
rename from RoboX/Robo X/libjinput-osx.jnilib
rename to Example/libjinput-osx.jnilib
diff --git a/Example/robox.bat b/Example/robox.bat
new file mode 100644
index 0000000..ff1ea78
--- /dev/null
+++ b/Example/robox.bat
@@ -0,0 +1 @@
+java -Djava.library.path=. -cp .\jinput.jar;.\jssc.jar;.\robox.jar robo.x.Main
diff --git a/Example/robox.sh b/Example/robox.sh
new file mode 100644
index 0000000..789e2f9
--- /dev/null
+++ b/Example/robox.sh
@@ -0,0 +1 @@
+java -Djava.library.path=. -cp ./jinput.jar:./jssc.jar:./robox.jar robo.x.Main
diff --git a/ROV.bat b/ROV.bat
deleted file mode 100644
index 24eeb59..0000000
--- a/ROV.bat
+++ /dev/null
@@ -1 +0,0 @@
-java -cp .\LinuxJoystick.jar; .\jssc.jar .\RoboX.jar -Djava.library.path=. -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel joymonitor.Main
diff --git a/RoboX/DUMMY b/RoboX/DUMMY
deleted file mode 100644
index 8b13789..0000000
--- a/RoboX/DUMMY
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/RoboX/Robo X /build/classes/robo/x/Main.class b/RoboX/Robo X /build/classes/robo/x/Main.class
deleted file mode 100644
index b2470c9..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/Main.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/SettingsHelper.class b/RoboX/Robo X /build/classes/robo/x/SettingsHelper.class
deleted file mode 100644
index 1d28713..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/SettingsHelper.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/controllers/EventCallbackHandler.class b/RoboX/Robo X /build/classes/robo/x/controllers/EventCallbackHandler.class
deleted file mode 100644
index 96d729b..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/controllers/EventCallbackHandler.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/controllers/Joystick.class b/RoboX/Robo X /build/classes/robo/x/controllers/Joystick.class
deleted file mode 100644
index e60d1ca..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/controllers/Joystick.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/controllers/Keyboard.class b/RoboX/Robo X /build/classes/robo/x/controllers/Keyboard.class
deleted file mode 100644
index 687fe52..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/controllers/Keyboard.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/controllers/SerialCommunication$PortReader.class b/RoboX/Robo X /build/classes/robo/x/controllers/SerialCommunication$PortReader.class
deleted file mode 100644
index 68afdfe..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/controllers/SerialCommunication$PortReader.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/controllers/SerialCommunication.class b/RoboX/Robo X /build/classes/robo/x/controllers/SerialCommunication.class
deleted file mode 100644
index 9407fd3..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/controllers/SerialCommunication.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Home$1.class b/RoboX/Robo X /build/classes/robo/x/views/Home$1.class
deleted file mode 100644
index 3b503e4..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Home$1.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Home$2.class b/RoboX/Robo X /build/classes/robo/x/views/Home$2.class
deleted file mode 100644
index 60390b7..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Home$2.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Home$3.class b/RoboX/Robo X /build/classes/robo/x/views/Home$3.class
deleted file mode 100644
index 1c72a41..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Home$3.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Home$4.class b/RoboX/Robo X /build/classes/robo/x/views/Home$4.class
deleted file mode 100644
index 5113757..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Home$4.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Home$5.class b/RoboX/Robo X /build/classes/robo/x/views/Home$5.class
deleted file mode 100644
index 7522d2e..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Home$5.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Home$6.class b/RoboX/Robo X /build/classes/robo/x/views/Home$6.class
deleted file mode 100644
index ff8e76c..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Home$6.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Home$7.class b/RoboX/Robo X /build/classes/robo/x/views/Home$7.class
deleted file mode 100644
index b37fe26..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Home$7.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Home.class b/RoboX/Robo X /build/classes/robo/x/views/Home.class
deleted file mode 100644
index 59db666..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Home.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Settings$1.class b/RoboX/Robo X /build/classes/robo/x/views/Settings$1.class
deleted file mode 100644
index 167559f..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Settings$1.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Settings$2.class b/RoboX/Robo X /build/classes/robo/x/views/Settings$2.class
deleted file mode 100644
index 269acaf..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Settings$2.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Settings.class b/RoboX/Robo X /build/classes/robo/x/views/Settings.class
deleted file mode 100644
index 84c3793..0000000
Binary files a/RoboX/Robo X /build/classes/robo/x/views/Settings.class and /dev/null differ
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Settings.form b/RoboX/Robo X /build/classes/robo/x/views/Settings.form
deleted file mode 100644
index 8796954..0000000
--- a/RoboX/Robo X /build/classes/robo/x/views/Settings.form
+++ /dev/null
@@ -1,286 +0,0 @@
-
-
-
diff --git a/RoboX/Robo X /src/robo/x/SettingsHelper.java b/RoboX/Robo X /src/robo/x/SettingsHelper.java
deleted file mode 100644
index 25cd93e..0000000
--- a/RoboX/Robo X /src/robo/x/SettingsHelper.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package robo.x;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Properties;
-
-/**
- *
- * @author root
- */
-public class SettingsHelper {
-
- static Properties prop = new Properties();
-
- static OutputStream output = null;
- static InputStream input = null;
-
- /**
- *
- *
- *
- *
- *
- */
- static void saveProperty(String property, String data) {
-
- try {
-
- output = new FileOutputStream("config.properties");
-
- // set the properties value
- prop.setProperty(property, data);
- prop.store(output, null);
-
- } catch (IOException io) {
-
- io.printStackTrace();
-
- } finally {
-
- if (output != null) {
-
- try {
-
- output.close();
-
- } catch (IOException e) {
-
- e.printStackTrace();
-
- }
- }
-
- }
-
- }
-
- /**
- *
- *
- *
- *
- *
- */
- static String readProperty(String property) {
-
- String temporary = "";
-
- try {
-
- input = new FileInputStream("config.properties");
-
- prop.load(input);
-
- temporary = prop.getProperty(property);
-
- } catch (IOException ex) {
-
- ex.printStackTrace();
-
- } finally {
-
- if (input != null) {
-
- try {
-
- input.close();
-
- } catch (IOException e) {
-
- e.printStackTrace();
-
- }
- }
- }
-
- return temporary;
- }
-
-}
diff --git a/RoboX/Robo X /src/robo/x/controllers/EventCallbackHandler.java b/RoboX/Robo X /src/robo/x/controllers/EventCallbackHandler.java
deleted file mode 100644
index 160f0de..0000000
--- a/RoboX/Robo X /src/robo/x/controllers/EventCallbackHandler.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package robo.x.controllers;
-
-import org.bbi.linuxjoy.LinuxJoystick;
-import org.bbi.linuxjoy.LinuxJoystickEvent;
-import org.bbi.linuxjoy.LinuxJoystickEventCallback;
-
-/**
- *
- * @author root
- */
-public class EventCallbackHandler implements LinuxJoystickEventCallback {
-
- public void callback(LinuxJoystick j, LinuxJoystickEvent ev) {
-
- switch (ev.isAxisChanged()) {
- case 0:
- System.out.print("dsfsd");
- break;
- case 1:
- System.out.print("fafsfs");
- break;
- }
-
- switch (ev.isButtonDown()) {
-
- case 0:
- // handle button 0 press here
- System.out.print("0");
-
- break;
- case 1:
- // handle button 1 press here
- System.out.print("1");
-
- break;
-
- case 2:
- // handle button 0 press here
- System.out.print("2");
-
- break;
- case 3:
- // handle button 1 press here
- System.out.print("3");
-
- break;
-
- case 4:
- // handle button 0 press here
- System.out.print("4");
-
- break;
- case 5:
- // handle button 1 press here
- System.out.print("5");
-
- break;
-
- case 6:
- // handle button 0 press here
- System.out.print("6");
-
- break;
- case 7:
- // handle button 1 press here
- System.out.print("7");
-
- break;
-
- }
-
- }
-}
diff --git a/RoboX/Robo X /src/robo/x/controllers/Joystick.java b/RoboX/Robo X /src/robo/x/controllers/Joystick.java
deleted file mode 100644
index 37fe041..0000000
--- a/RoboX/Robo X /src/robo/x/controllers/Joystick.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package robo.x.controllers;
-
-import javax.swing.JOptionPane;
-import org.bbi.linuxjoy.JoyFactory;
-import org.bbi.linuxjoy.LinuxJoystick;
-import static robo.x.views.Home.jMenu1;
-
-/**
- *
- * @author root
- *
- */
-public class Joystick {
-
- static LinuxJoystick j = JoyFactory.getFirstUsableDevice();
-
- public static void start() {
-
- if (j != null) {
-
- j.setCallback(new EventCallbackHandler());
- j.startPollingThread(5); // sleep for 5 ms between polls
-
- } else {
-
- JOptionPane.showMessageDialog(jMenu1, "Error, No JoySticks Connected");
-
- }
-
- }
-
-}
diff --git a/RoboX/Robo X /src/robo/x/controllers/Keyboard.java b/RoboX/Robo X /src/robo/x/controllers/Keyboard.java
deleted file mode 100644
index 79ee7f4..0000000
--- a/RoboX/Robo X /src/robo/x/controllers/Keyboard.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package robo.x.controllers;
-
-/**
- *
- * @author root
- */
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-
-public class Keyboard implements KeyListener {
-
-
- @Override
- public void keyTyped(KeyEvent e) {
-
- switch (e.getKeyCode()) {
- case KeyEvent.VK_RIGHT:
- System.out.println("Right typed.");
-
- break;
- case KeyEvent.VK_LEFT:
- System.out.println("Left typed.");
- break;
- case KeyEvent.VK_UP:
- System.out.println("Up typed.");
- break;
- case KeyEvent.VK_DOWN:
- System.out.println("Down typed.");
- break;
- default:
- System.out.println("Key typed: " + e.getKeyChar());
- break;
- }
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
-
- switch (e.getKeyCode()) {
- case KeyEvent.VK_RIGHT:
- System.out.println("Right pressed.");
- break;
- case KeyEvent.VK_LEFT:
- System.out.println("Left pressed.");
- break;
- case KeyEvent.VK_UP:
- System.out.println("Up pressed.");
- break;
- case KeyEvent.VK_DOWN:
- System.out.println("Down pressed.");
- break;
- default:
- System.out.println("Key pressed: " + e.getKeyChar());
- break;
- }
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
-
- switch (e.getKeyCode()) {
- case KeyEvent.VK_RIGHT:
- System.out.println("Right released.");
- break;
- case KeyEvent.VK_LEFT:
- System.out.println("Left released.");
- break;
- case KeyEvent.VK_UP:
- System.out.println("Up released.");
- break;
- case KeyEvent.VK_DOWN:
- System.out.println("Down released.");
- break;
- default:
- System.out.println("Key released: " + e.getKeyChar());
- break;
- }
- }
-}
diff --git a/RoboX/Robo X /src/robo/x/views/Home.form b/RoboX/Robo X /src/robo/x/views/Home.form
deleted file mode 100644
index 7023387..0000000
--- a/RoboX/Robo X /src/robo/x/views/Home.form
+++ /dev/null
@@ -1,504 +0,0 @@
-
-
-
diff --git a/RoboX/Robo X /src/robo/x/views/Settings.form b/RoboX/Robo X /src/robo/x/views/Settings.form
deleted file mode 100644
index 8796954..0000000
--- a/RoboX/Robo X /src/robo/x/views/Settings.form
+++ /dev/null
@@ -1,286 +0,0 @@
-
-
-
diff --git a/RoboX/Robo X /src/robo/x/views/Settings.java b/RoboX/Robo X /src/robo/x/views/Settings.java
deleted file mode 100644
index 2b41c8d..0000000
--- a/RoboX/Robo X /src/robo/x/views/Settings.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package robo.x.views;
-
-/**
- *
- * @author root
- */
-public class Settings extends javax.swing.JFrame {
-
- /**
- * Creates new form Settings
- */
- public Settings() {
- initComponents();
- }
-
-
- @SuppressWarnings("unchecked")
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- jInternalFrame1 = new javax.swing.JInternalFrame();
- jSeparator1 = new javax.swing.JSeparator();
- jLabel1 = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- jTextField1 = new javax.swing.JTextField();
- jTextField2 = new javax.swing.JTextField();
- jTextField3 = new javax.swing.JTextField();
- jButton1 = new javax.swing.JButton();
- jButton2 = new javax.swing.JButton();
- jTextField4 = new javax.swing.JTextField();
- jTextField5 = new javax.swing.JTextField();
- jTextField6 = new javax.swing.JTextField();
- jTextField7 = new javax.swing.JTextField();
- jLabel3 = new javax.swing.JLabel();
- jLabel4 = new javax.swing.JLabel();
- jLabel5 = new javax.swing.JLabel();
- jLabel6 = new javax.swing.JLabel();
- jLabel7 = new javax.swing.JLabel();
- jLabel8 = new javax.swing.JLabel();
- jLabel9 = new javax.swing.JLabel();
-
- jInternalFrame1.setVisible(true);
-
- javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
- jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
- jInternalFrame1Layout.setHorizontalGroup(
- jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 0, Short.MAX_VALUE)
- );
- jInternalFrame1Layout.setVerticalGroup(
- jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 0, Short.MAX_VALUE)
- );
-
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
-
- jLabel1.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
- jLabel1.setText("Controls");
-
- jLabel2.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
- jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel2.setText("Sensors");
-
- jTextField1.setText(" X");
-
- jTextField2.setText("SQUARE");
-
- jTextField3.setText("CIRCLE");
-
- jButton1.setText("Save");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
-
- jButton2.setText("Reset");
- jButton2.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton2ActionPerformed(evt);
- }
- });
-
- jTextField4.setText("1");
-
- jTextField5.setText("2");
-
- jTextField6.setText("3");
-
- jTextField7.setText("4");
-
- jLabel3.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
- jLabel3.setText("Control #1");
-
- jLabel4.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
- jLabel4.setText("Control #2");
-
- jLabel5.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
- jLabel5.setText("Control #3");
-
- jLabel6.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
- jLabel6.setText("Sensor #1");
-
- jLabel7.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
- jLabel7.setText("Sensor #2");
-
- jLabel8.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
- jLabel8.setText("Sensor #3");
-
- jLabel9.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
- jLabel9.setText("Sensor #4");
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 232, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel6)
- .addComponent(jLabel7)
- .addComponent(jLabel8)
- .addComponent(jLabel9))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(jTextField7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)
- .addComponent(jTextField6, javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jTextField5, javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jTextField4, javax.swing.GroupLayout.Alignment.TRAILING)))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 393, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel4)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 393, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel5)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 393, javax.swing.GroupLayout.PREFERRED_SIZE))))
- .addGroup(layout.createSequentialGroup()
- .addGap(207, 207, 207)
- .addComponent(jLabel1)
- .addGap(0, 0, Short.MAX_VALUE)))
- .addContainerGap())
- .addGroup(layout.createSequentialGroup()
- .addGap(206, 206, 206)
- .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel1)
- .addGap(14, 14, 14)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel3))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel4))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel5))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 8, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel6))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel7))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel8))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel9))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
- .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE))
- .addContainerGap())
- );
-
- pack();
- }// //GEN-END:initComponents
-
-
-
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
-
- // TODO add your handling code here:
-
-
-
- }//GEN-LAST:event_jButton1ActionPerformed
-
- private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
- // TODO add your handling code here:
-
-
-
- }//GEN-LAST:event_jButton2ActionPerformed
-
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JButton jButton1;
- private javax.swing.JButton jButton2;
- private javax.swing.JInternalFrame jInternalFrame1;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JLabel jLabel3;
- private javax.swing.JLabel jLabel4;
- private javax.swing.JLabel jLabel5;
- private javax.swing.JLabel jLabel6;
- private javax.swing.JLabel jLabel7;
- private javax.swing.JLabel jLabel8;
- private javax.swing.JLabel jLabel9;
- private javax.swing.JSeparator jSeparator1;
- private javax.swing.JTextField jTextField1;
- private javax.swing.JTextField jTextField2;
- private javax.swing.JTextField jTextField3;
- private javax.swing.JTextField jTextField4;
- private javax.swing.JTextField jTextField5;
- private javax.swing.JTextField jTextField6;
- private javax.swing.JTextField jTextField7;
- // End of variables declaration//GEN-END:variables
-}
diff --git a/RoboX/Robo X/jinput.jar b/RoboX/Robo X/jinput.jar
deleted file mode 100644
index 3cdf2c5..0000000
Binary files a/RoboX/Robo X/jinput.jar and /dev/null differ
diff --git a/RoboX/Robo X/build.xml b/RoboX/build.xml
similarity index 100%
rename from RoboX/Robo X/build.xml
rename to RoboX/build.xml
diff --git a/RoboX/build/built-jar.properties b/RoboX/build/built-jar.properties
new file mode 100644
index 0000000..9c047d2
--- /dev/null
+++ b/RoboX/build/built-jar.properties
@@ -0,0 +1,4 @@
+#Tue, 21 Feb 2017 03:03:40 +0200
+
+
+/root/NetBeansProjects/Robo\ X\ =
diff --git a/RoboX/dist/README.TXT b/RoboX/dist/README.TXT
new file mode 100644
index 0000000..3f8ea3b
--- /dev/null
+++ b/RoboX/dist/README.TXT
@@ -0,0 +1,32 @@
+========================
+BUILD OUTPUT DESCRIPTION
+========================
+
+When you build an Java application project that has a main class, the IDE
+automatically copies all of the JAR
+files on the projects classpath to your projects dist/lib folder. The IDE
+also adds each of the JAR files to the Class-Path element in the application
+JAR files manifest file (MANIFEST.MF).
+
+To run the project from the command line, go to the dist folder and
+type the following:
+
+java -jar "Robo_X_.jar"
+
+To distribute this project, zip up the dist folder (including the lib folder)
+and distribute the ZIP file.
+
+Notes:
+
+* If two JAR files on the project classpath have the same name, only the first
+JAR file is copied to the lib folder.
+* Only JAR files are copied to the lib folder.
+If the classpath contains other types of files or folders, these files (folders)
+are not copied.
+* If a library on the projects classpath also has a Class-Path element
+specified in the manifest,the content of the Class-Path element has to be on
+the projects runtime path.
+* To set a main class in a standard Java project, right-click the project node
+in the Projects window and choose Properties. Then click Run and enter the
+class name in the Main Class field. Alternatively, you can manually type the
+class name in the manifest Main-Class element.
diff --git a/RoboX/jinput-dx8.dll b/RoboX/jinput-dx8.dll
new file mode 100644
index 0000000..ce1e38f
Binary files /dev/null and b/RoboX/jinput-dx8.dll differ
diff --git a/RoboX/jinput-dx8_64.dll b/RoboX/jinput-dx8_64.dll
new file mode 100644
index 0000000..ffa4adb
Binary files /dev/null and b/RoboX/jinput-dx8_64.dll differ
diff --git a/RoboX/jinput-raw.dll b/RoboX/jinput-raw.dll
new file mode 100644
index 0000000..2252072
Binary files /dev/null and b/RoboX/jinput-raw.dll differ
diff --git a/RoboX/jinput-raw_64.dll b/RoboX/jinput-raw_64.dll
new file mode 100644
index 0000000..852b3a9
Binary files /dev/null and b/RoboX/jinput-raw_64.dll differ
diff --git a/RoboX/jinput-wintab.dll b/RoboX/jinput-wintab.dll
new file mode 100644
index 0000000..bae3f9a
Binary files /dev/null and b/RoboX/jinput-wintab.dll differ
diff --git a/RoboX/libjinput-linux.so b/RoboX/libjinput-linux.so
new file mode 100644
index 0000000..dba9e59
Binary files /dev/null and b/RoboX/libjinput-linux.so differ
diff --git a/RoboX/libjinput-linux64.so b/RoboX/libjinput-linux64.so
new file mode 100644
index 0000000..9df47f9
Binary files /dev/null and b/RoboX/libjinput-linux64.so differ
diff --git a/RoboX/libjinput-osx.jnilib b/RoboX/libjinput-osx.jnilib
new file mode 100644
index 0000000..1cf6dbb
Binary files /dev/null and b/RoboX/libjinput-osx.jnilib differ
diff --git a/RoboX/Robo X/manifest.mf b/RoboX/manifest.mf
similarity index 100%
rename from RoboX/Robo X/manifest.mf
rename to RoboX/manifest.mf
diff --git a/RoboX/Robo X /nbproject/build-impl.xml b/RoboX/nbproject/build-impl.xml
similarity index 100%
rename from RoboX/Robo X /nbproject/build-impl.xml
rename to RoboX/nbproject/build-impl.xml
diff --git a/RoboX/Robo X /nbproject/genfiles.properties b/RoboX/nbproject/genfiles.properties
similarity index 100%
rename from RoboX/Robo X /nbproject/genfiles.properties
rename to RoboX/nbproject/genfiles.properties
diff --git a/RoboX/nbproject/private/config.properties b/RoboX/nbproject/private/config.properties
new file mode 100644
index 0000000..e69de29
diff --git a/RoboX/Robo X /nbproject/private/private.properties b/RoboX/nbproject/private/private.properties
similarity index 100%
rename from RoboX/Robo X /nbproject/private/private.properties
rename to RoboX/nbproject/private/private.properties
diff --git a/RoboX/Robo X /nbproject/private/private.xml b/RoboX/nbproject/private/private.xml
similarity index 86%
rename from RoboX/Robo X /nbproject/private/private.xml
rename to RoboX/nbproject/private/private.xml
index a8a74f4..7650e25 100644
--- a/RoboX/Robo X /nbproject/private/private.xml
+++ b/RoboX/nbproject/private/private.xml
@@ -3,9 +3,9 @@
- file:/root/NetBeansProjects/Robo%20X%20/src/robo/x/views/Home.java
- file:/root/NetBeansProjects/Robo%20X%20/src/robo/x/views/Settings.java
+ file:/root/NetBeansProjects/Robo%20X%20/src/robo/x/controllers/JoystickController.java
file:/root/NetBeansProjects/Robo%20X%20/src/robo/x/Main.java
+ file:/root/NetBeansProjects/Robo%20X%20/src/robo/x/controllers/Joystick.java
diff --git a/RoboX/Robo X /nbproject/project.properties b/RoboX/nbproject/project.properties
similarity index 93%
rename from RoboX/Robo X /nbproject/project.properties
rename to RoboX/nbproject/project.properties
index 2557c84..619e92a 100644
--- a/RoboX/Robo X /nbproject/project.properties
+++ b/RoboX/nbproject/project.properties
@@ -29,15 +29,13 @@ dist.jar=${dist.dir}/Robo_X_.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
-file.reference.jinput.jar=jinput.jar
+file.reference.jinput.jar=/home/rashad/Desktop/JInputJoystickTestV2/dist/lib/jinput.jar
file.reference.jssc-2.8.0.jar=/media/rashad/Work_Stuff1/Development/Admiral Team/ROV Bridge/dist/lib/jssc-2.8.0.jar
-file.reference.LinuxJoystick.jar=/home/rashad/Documents/LinuxJoystick.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.jssc-2.8.0.jar}:\
- ${file.reference.jinput.jar}:\
- ${file.reference.LinuxJoystick.jar}
+ ${file.reference.jinput.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
diff --git a/RoboX/Robo X /nbproject/project.xml b/RoboX/nbproject/project.xml
similarity index 100%
rename from RoboX/Robo X /nbproject/project.xml
rename to RoboX/nbproject/project.xml
diff --git a/RoboX/Robo X /src/robo/x/Main.java b/RoboX/src/robo/x/Main.java
similarity index 100%
rename from RoboX/Robo X /src/robo/x/Main.java
rename to RoboX/src/robo/x/Main.java
diff --git a/RoboX/src/robo/x/communication/Ethernet.java b/RoboX/src/robo/x/communication/Ethernet.java
new file mode 100644
index 0000000..b15f346
--- /dev/null
+++ b/RoboX/src/robo/x/communication/Ethernet.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 root
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package robo.x.communication;
+
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+
+/**
+ *
+ * @author root
+ */
+public class Ethernet {
+
+ String IPAdress;
+
+ private DatagramSocket m_clientSocket;
+
+ public Ethernet(String data) {
+
+ this.IPAdress = data;
+ }
+
+ public void startUDPClient(String data) throws IOException {
+
+ m_clientSocket = new DatagramSocket(8888);
+
+ byte[] packet = data.getBytes();
+
+ DatagramPacket client_packet = new DatagramPacket(packet, packet.length, InetAddress.getByName(data), 8888);
+
+ m_clientSocket.send(client_packet);
+ System.out.println("Sent!");
+
+ m_clientSocket.close();
+
+ System.out.println("Client socket closed");
+
+ }
+
+}
diff --git a/RoboX/Robo X /src/robo/x/controllers/SerialCommunication.java b/RoboX/src/robo/x/communication/SerialCommunication.java
similarity index 99%
rename from RoboX/Robo X /src/robo/x/controllers/SerialCommunication.java
rename to RoboX/src/robo/x/communication/SerialCommunication.java
index 523a7d0..cb1a6eb 100644
--- a/RoboX/Robo X /src/robo/x/controllers/SerialCommunication.java
+++ b/RoboX/src/robo/x/communication/SerialCommunication.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package robo.x.controllers;
+package robo.x.communication;
import java.util.logging.Level;
import java.util.logging.Logger;
diff --git a/RoboX/src/robo/x/controllers/JInputJoystick.java b/RoboX/src/robo/x/controllers/JInputJoystick.java
new file mode 100644
index 0000000..5ca6a74
--- /dev/null
+++ b/RoboX/src/robo/x/controllers/JInputJoystick.java
@@ -0,0 +1,537 @@
+package robo.x.controllers;
+
+import java.util.ArrayList;
+import net.java.games.input.Component;
+import net.java.games.input.Component.Identifier;
+import net.java.games.input.Controller;
+import net.java.games.input.ControllerEnvironment;
+
+/**
+ *
+ * JInput Joystick
+ *
+ *
+ * @author TheUzo007 http://theuzo007.wordpress.com
+ *
+ *
+ * To use this you need JInput libraries and its files.
+ * http://java.net/projects/jinput
+ *
+ * This class is intended for use with joysticks of stick or gamepad type
+ * (JInput type), like Logitech Dual Action which is a stick type or Xbox
+ * MadCatz which is a gamepad type. It can be used with other types to, but each
+ * controller has different components, therefore, some methods that I wrote are
+ * not useful with other types of controller. But you can always use
+ * getComponentValue method and specify controller component identifier that you
+ * need or add your own methods.
+ *
+ * JInput javadoc: http://www.newdawnsoftware.com/resources/jinput/apidocs
+ *
+ *
+ * More on the blog:
+ * http://theuzo007.wordpress.com/2012/09/02/joystick-in-java-with-jinput
+ *
+ */
+public class JInputJoystick {
+
+ private Controller controller;
+
+ // Controller buttons states
+ private ArrayList buttonsValues;
+
+ /**
+ * Creates a controller, of type that has been given.
+ *
+ * @param controllerType Desired controller type.
+ */
+ public JInputJoystick(Controller.Type controllerType) {
+ initialize();
+ initController(controllerType, null);
+ }
+
+ /**
+ * Creates a controller, of one of the types that has been given. Controller
+ * type which is first found will be created.
+ *
+ * @param controllerType_1 Desired controller type.
+ * @param controllerType_2 Desired controller type.
+ */
+ public JInputJoystick(Controller.Type controllerType_1, Controller.Type controllerType_2) {
+ initialize();
+ initController(controllerType_1, controllerType_2);
+ }
+
+ private void initialize() {
+ this.controller = null;
+ this.buttonsValues = new ArrayList();
+ }
+
+ /**
+ * Save first founded controller of given type.
+ *
+ * @param controllerType Desired controller type.
+ */
+ private void initController(Controller.Type controllerType_1, Controller.Type controllerType_2) {
+ Controller[] controllers = ControllerEnvironment.getDefaultEnvironment().getControllers();
+
+ for (int i = 0; i < controllers.length && controller == null; i++) {
+ if (controllers[i].getType() == controllerType_1
+ || controllers[i].getType() == controllerType_2) {
+ controller = controllers[i];
+ break;
+ }
+ }
+ }
+
+ /**
+ * Checks if the controller is connected/valid. It also poll the controller
+ * for data, but it doesn't save states of the buttons into buttons array
+ * list that is used by getButtonsValues() and getButtonValue(int index)
+ * methods.
+ *
+ * @see joystick.JInputJoystick#pollController()
+ *
+ * @return True if controller is connected, false otherwise.
+ */
+ public boolean isControllerConnected() {
+ try {
+ return controller.poll();
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ /**
+ * Gets the controller type. Throws exception if controller doesn't exists.
+ *
+ * @return Type of the controller.
+ */
+ public Controller.Type getControllerType() {
+ return controller.getType();
+ }
+
+ /**
+ * Gets the human readable controller name. Throws exception if controller
+ * doesn't exists.
+ *
+ * @return Controller name.
+ */
+ public String getControllerName() {
+ return controller.getName();
+ }
+
+ /**
+ * Check and save current controller state (controller components values).
+ * Must be called every time before using controller state methods (eg.
+ * method for x axis value), so that you get latest controller components
+ * values.
+ *
+ * @return True if controller is connected/valid, false otherwise.
+ */
+ public boolean pollController() {
+ boolean isControllerValid;
+
+ // Clear previous values of buttons.
+ buttonsValues.clear();
+
+ isControllerValid = controller.poll();
+ if (!isControllerValid) {
+ return false;
+ }
+
+ Component[] components = controller.getComponents();
+
+ for (int i = 0; i < components.length; i++) {
+ Component component = components[i];
+
+ // Add states of the buttons
+ if (component.getName().contains("Button")) {
+ if (component.getPollData() == 1.0f) {
+ buttonsValues.add(Boolean.TRUE);
+ } else {
+ buttonsValues.add(Boolean.FALSE);
+ }
+ }
+ }
+
+ return isControllerValid;
+ }
+
+ /**
+ * Checks if component with given identifier exists.
+ *
+ * @param identifier Identifier that correspond to component.
+ * @return True if component exists or false if not exists.
+ */
+ public boolean componentExists(Identifier identifier) {
+ Component component = controller.getComponent(identifier);
+
+ if (component != null) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Gets value of component with given identifier.
+ *
+ * @param identifier Identifier that correspond to component from which we
+ * need value.
+ * @return Component value.
+ */
+ public float getComponentValue(Identifier identifier) {
+ return controller.getComponent(identifier).getPollData();
+ }
+
+ /**
+ * How many buttons does controller have?
+ *
+ * @return Number of buttons on a controller.
+ */
+ public int getNumberOfButtons() {
+ return buttonsValues.size();
+ }
+
+ /**
+ * Controller buttons states. Index of element in array list correspond to
+ * button number on the controller. If element is true then button is
+ * pressed, if element is false then button is not pressed.
+ *
+ * @return Array list of states of all controller buttons.
+ */
+ public ArrayList getButtonsValues() {
+ return buttonsValues;
+ }
+
+ /**
+ * Gets value of required button.
+ *
+ * @param index Index of a button in array list.
+ * @return True if button is pressed, false otherwise.
+ */
+ public boolean getButtonValue(int index) {
+ return buttonsValues.get(index);
+ }
+
+ /**
+ * Value of axis named X Axis.
+ *
+ * @return X Axis value.
+ */
+ public float getXAxisValue() {
+ Identifier identifier = Component.Identifier.Axis.X;
+ return controller.getComponent(identifier).getPollData();
+ }
+
+ /**
+ * Value of axis named X Axis in percentage. Percentages increases from left
+ * to right. If idle (in center) returns 50, if joystick axis is pushed to
+ * the left edge returns 0 and if it's pushed to the right returns 100.
+ *
+ * @return X Axis value in percentage.
+ */
+ public int getXAxisPercentage() {
+ float xAxisValue = this.getXAxisValue();
+ int xAxisValuePercentage = (int) ((2 - (1 - xAxisValue)) * 100) / 2;
+
+ return xAxisValuePercentage;
+ }
+
+ /**
+ * Value of axis named Y Axis.
+ *
+ * @return Y Axis value.
+ */
+ public float getYAxisValue() {
+ Identifier identifier = Component.Identifier.Axis.Y;
+ return controller.getComponent(identifier).getPollData();
+ }
+
+ /**
+ * Value of axis named Y Axis in percentage. Percentages increases from top
+ * to bottom. If idle (in center) returns 50, if joystick axis is pushed to
+ * the top edge returns 0 and if it is pushed to the bottom returns 100.
+ *
+ * @return Y Axis value in percentage.
+ */
+ public int getYAxisPercentage() {
+ float yAxisValue = this.getYAxisValue();
+ int yAxisValuePercentage = (int) ((2 - (1 - yAxisValue)) * 100) / 2;
+
+ return yAxisValuePercentage;
+ }
+
+ /**
+ * Value of axis named Z Rotation.
+ *
+ * @return Z Rotation value.
+ */
+ public float getZRotationValue() {
+ Identifier identifier = Component.Identifier.Axis.RZ;
+ return controller.getComponent(identifier).getPollData();
+ }
+
+ /**
+ * Value of axis named Z Rotation in percentage. Percentages increases from
+ * top to bottom. If idle (in center) returns 50, if joystick axis is pushed
+ * to the top edge returns 0 and if it is pushed to the bottom returns 100.
+ *
+ * @return Z Rotation value in percentage.
+ */
+ public int getZRotationPercentage() {
+ float zRotation = this.getZRotationValue();
+ int zRotationValuePercentage = (int) ((2 - (1 - zRotation)) * 100) / 2;
+
+ return zRotationValuePercentage;
+ }
+
+ /**
+ * Value of axis named Z Axis.
+ *
+ * @return Z Axis value.
+ */
+ public float getZAxisValue() {
+ Identifier identifier = Component.Identifier.Axis.Z;
+ return controller.getComponent(identifier).getPollData();
+ }
+
+ /**
+ * Value of axis named Z Axis in percentage. Percentages increases from left
+ * to right. If idle (in center) returns 50, if joystick axis is pushed to
+ * the left edge returns 0 and if it's pushed to the right returns 100.
+ *
+ * @return Z Axis value in percentage.
+ */
+ public int getZAxisPercentage() {
+ float zAxisValue = this.getZAxisValue();
+ int zAxisValuePercentage = (int) ((2 - (1 - zAxisValue)) * 100) / 2;
+
+ return zAxisValuePercentage;
+ }
+
+ /**
+ * Value of axis named X Rotation.
+ *
+ * @return X Rotation value.
+ */
+ public float getXRotationValue() {
+ Identifier identifier = Component.Identifier.Axis.RX;
+ return controller.getComponent(identifier).getPollData();
+ }
+
+ /**
+ * Value of axis named X Rotation in percentage. Percentages increases from
+ * left to right. If idle (in center) returns 50, if joystick axis is pushed
+ * to the left edge returns 0 and if it's pushed to the right returns 100.
+ *
+ * @return X Rotation value in percentage.
+ */
+ public int getXRotationPercentage() {
+ float xRotationValue = this.getXRotationValue();
+ int xRotationValuePercentage = (int) ((2 - (1 - xRotationValue)) * 100) / 2;
+
+ return xRotationValuePercentage;
+ }
+
+ /**
+ * Value of axis named Y Rotation.
+ *
+ * @return Y Rotation value.
+ */
+ public float getYRotationValue() {
+ Identifier identifier = Component.Identifier.Axis.RY;
+ return controller.getComponent(identifier).getPollData();
+ }
+
+ /**
+ * Value of axis named Y Rotation in percentage. Percentages increases from
+ * top to bottom. If idle (in center) returns 50, if joystick axis is pushed
+ * to the top edge returns 0 and if it is pushed to the bottom returns 100.
+ *
+ * @return Y Rotation value in percentage.
+ */
+ public int getYRotationPercentage() {
+ float yRotationValue = this.getYRotationValue();
+ int yRotationValuePercentage = (int) ((2 - (1 - yRotationValue)) * 100) / 2;
+
+ return yRotationValuePercentage;
+ }
+
+ /**
+ * Gets position of the Hat Switch. Float number that is returned by this
+ * method correspond with positions in the JInput class Component.POV.
+ *
+ * @return Float number that corresponds with the Hat Switch position.
+ */
+ public float getHatSwitchPosition() {
+ Identifier identifier = Component.Identifier.Axis.POV;
+ return controller.getComponent(identifier).getPollData();
+ }
+
+ /* Left joystick */
+ /**
+ * X position of left controller joystick.
+ *
+ * The same as method getXAxisValue().
+ *
+ * @see joystick.JInputJoystick#getXAxisValue()
+ *
+ * @return Float value (from -1.0f to 1.0f) corresponding to left controller
+ * joystick on x coordinate.
+ */
+ public float getX_LeftJoystick_Value() {
+ return this.getXAxisValue();
+ }
+
+ /**
+ * X position, in percentages, of left controller joystick.
+ *
+ * The same as method getXAxisPercentage().
+ *
+ * @see joystick.JInputJoystick#getXAxisPercentage()
+ *
+ * @return Int value (from 0 to 100) corresponding to left controller
+ * joystick on x coordinate.
+ */
+ public int getX_LeftJoystick_Percentage() {
+ return this.getXAxisPercentage();
+ }
+
+ /**
+ * Y position of left controller joystick.
+ *
+ * The same as method getYAxisValue().
+ *
+ * @see joystick.JInputJoystick#getYAxisValue()
+ *
+ * @return Float value (from -1.0f to 1.0f) corresponding to left controller
+ * joystick on y coordinate.
+ */
+ public float getY_LeftJoystick_Value() {
+ return this.getYAxisValue();
+ }
+
+ /**
+ * Y position, in percentages, of left controller joystick.
+ *
+ * The same as method getYAxisPercentage().
+ *
+ * @see joystick.JInputJoystick#getYAxisPercentage()
+ *
+ * @return Int value (from 0 to 100) corresponding to left controller
+ * joystick on y coordinate.
+ */
+ public int getY_LeftJoystick_Percentage() {
+ return this.getYAxisPercentage();
+ }
+
+ /* Right joystick */
+ /**
+ * X position of right controller joystick.
+ *
+ * The same as method getZAxisValue() if controller type is
+ * Controller.Type.STICK. The same as method getXRotationValue() if
+ * controller type is Controller.Type.GAMEPAD.
+ *
+ * @see joystick.JInputJoystick#getZAxisValue()
+ * @see joystick.JInputJoystick#getXRotationValue()
+ *
+ * @return Float value (from -1.0f to 1.0f) corresponding to right
+ * controller joystick on x coordinate.
+ */
+ public float getX_RightJoystick_Value() {
+ float xValueRightJoystick;
+
+ // stick type controller
+ if (this.controller.getType() == Controller.Type.STICK) {
+ xValueRightJoystick = this.getZAxisValue();
+ } // gamepad type controller
+ else {
+ xValueRightJoystick = this.getXRotationValue();
+ }
+
+ return xValueRightJoystick;
+ }
+
+ /**
+ * X position, in percentages, of right controller joystick.
+ *
+ * The same as method getZAxisPercentage() if controller type is
+ * Controller.Type.STICK. The same as method getXRotationPercentage() if
+ * controller type is Controller.Type.GAMEPAD.
+ *
+ * @see joystick.JInputJoystick#getZAxisPercentage()
+ * @see joystick.JInputJoystick#getXRotationPercentage()
+ *
+ * @return Int value (from 0 to 100) corresponding to right controller
+ * joystick on x coordinate.
+ */
+ public int getX_RightJoystick_Percentage() {
+ int xValueRightJoystickPercentage;
+
+ // stick type controller
+ if (this.controller.getType() == Controller.Type.STICK) {
+ xValueRightJoystickPercentage = this.getZAxisPercentage();
+ } // gamepad type controller
+ else {
+ xValueRightJoystickPercentage = this.getXRotationPercentage();
+ }
+
+ return xValueRightJoystickPercentage;
+ }
+
+ /**
+ * Y position of right controller joystick.
+ *
+ * The same as method getZRotationValue() if controller type is
+ * Controller.Type.STICK. The same as method getYRotationValue() if
+ * controller type is Controller.Type.GAMEPAD.
+ *
+ * @see joystick.JInputJoystick#getZRotationValue()
+ * @see joystick.JInputJoystick#getYRotationValue()
+ *
+ * @return Float value (from -1.0f to 1.0f) corresponding to right
+ * controller joystick on y coordinate.
+ */
+ public float getY_RightJoystick_Value() {
+ float yValueRightJoystick;
+
+ // stick type controller
+ if (this.controller.getType() == Controller.Type.STICK) {
+ yValueRightJoystick = this.getZRotationValue();
+ } // gamepad type controller
+ else {
+ yValueRightJoystick = this.getYRotationValue();
+ }
+
+ return yValueRightJoystick;
+ }
+
+ /**
+ * Y position, in percentages, of right controller joystick.
+ *
+ * The same as method getZRotationPercentage() if controller type is
+ * Controller.Type.STICK. The same as method getYRotationPercentage() if
+ * controller type is Controller.Type.GAMEPAD.
+ *
+ * @see joystick.JInputJoystick#getZRotationPercentage()
+ * @see joystick.JInputJoystick#getYRotationPercentage()
+ *
+ * @return Int value (from 0 to 100) corresponding to right controller
+ * joystick on y coordinate.
+ */
+ public int getY_RightJoystick_Percentage() {
+ int yValueRightJoystickPercentage;
+
+ // stick type controller
+ if (this.controller.getType() == Controller.Type.STICK) {
+ yValueRightJoystickPercentage = this.getZRotationPercentage();
+ } // gamepad type controller
+ else {
+ yValueRightJoystickPercentage = this.getYRotationPercentage();
+ }
+
+ return yValueRightJoystickPercentage;
+ }
+}
diff --git a/RoboX/src/robo/x/controllers/Joystick.java b/RoboX/src/robo/x/controllers/Joystick.java
new file mode 100644
index 0000000..cd026f0
--- /dev/null
+++ b/RoboX/src/robo/x/controllers/Joystick.java
@@ -0,0 +1,89 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package robo.x.controllers;
+
+import robo.x.communication.Ethernet;
+import robo.x.communication.SerialCommunication;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JOptionPane;
+import jssc.SerialPortException;
+import net.java.games.input.Controller;
+import static robo.x.views.Home.jMenu1;
+
+/**
+ *
+ * @author root
+ *
+ */
+public class Joystick {
+
+ static Ethernet ether;
+ static SerialCommunication serial;
+ static int connectionType;
+ static String connectionParameter;
+
+ static Thread control_thread = new Thread(new JoystickController(), "JoyStick");
+
+ static JInputJoystick joystick = new JInputJoystick(Controller.Type.STICK, Controller.Type.GAMEPAD);
+
+ public static void start(int type, String par) {
+
+ connectionType = type;
+ connectionParameter = par;
+
+ if (connectionType == 0) {
+
+ ether = new Ethernet(connectionParameter);
+
+ } else if (connectionType == 1) {
+
+ serial = new SerialCommunication();
+
+ serial.SerialCommunicationInitializer(connectionParameter);
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ if (!joystick.isControllerConnected()) {
+
+ JOptionPane.showMessageDialog(jMenu1, "Error, No JoySticks Connected");
+ System.exit(0);
+
+ }
+
+ control_thread.start();
+
+ }
+
+ public static void stop() {
+
+ control_thread.interrupt();
+
+ }
+
+ public static void sendData(String data) {
+
+ if (connectionType == 0) {
+
+ try {
+ ether.startUDPClient(data);
+ } catch (IOException ex) {
+ Logger.getLogger(Joystick.class.getName()).log(Level.SEVERE, null, ex);
+ }
+
+ } else if (connectionType == 1) {
+
+ try {
+ serial.writeData(data);
+ } catch (SerialPortException ex) {
+ Logger.getLogger(Joystick.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ }
+}
diff --git a/RoboX/src/robo/x/controllers/JoystickController.java b/RoboX/src/robo/x/controllers/JoystickController.java
new file mode 100644
index 0000000..b97eaf8
--- /dev/null
+++ b/RoboX/src/robo/x/controllers/JoystickController.java
@@ -0,0 +1,137 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package robo.x.controllers;
+
+import javax.swing.JOptionPane;
+import robo.x.views.Home;
+import static robo.x.views.Home.jMenu1;
+
+/**
+ *
+ * @author root
+ *
+ */
+public class JoystickController extends Thread {
+
+ @Override
+ public void run() {
+
+ while (Home.jToggleButton1.isSelected()) {
+
+ if (!Joystick.joystick.pollController()) {
+
+ System.out.println("Controller disconnected!");
+ JOptionPane.showMessageDialog(jMenu1, "Error, Controller disconnected!");
+ System.exit(0);
+
+ }
+
+ int xValuePercentageLeftJoystick = Joystick.joystick.getX_LeftJoystick_Percentage();
+ int yValuePercentageLeftJoystick = Joystick.joystick.getY_LeftJoystick_Percentage();
+
+ boolean joystickButton_1 = Joystick.joystick.getButtonValue(0);
+ boolean joystickButton_2 = Joystick.joystick.getButtonValue(1);
+ boolean joystickButton_3 = Joystick.joystick.getButtonValue(2);
+ boolean joystickButton_4 = Joystick.joystick.getButtonValue(3);
+ boolean joystickButton_5 = Joystick.joystick.getButtonValue(4);
+ boolean joystickButton_6 = Joystick.joystick.getButtonValue(5);
+ boolean joystickButton_7 = Joystick.joystick.getButtonValue(6);
+ boolean joystickButton_8 = Joystick.joystick.getButtonValue(7);
+
+ ////////////////////////////////////////////////////////
+ if (xValuePercentageLeftJoystick > 0) {
+ Joystick.sendData("l");
+ } else if (xValuePercentageLeftJoystick < 0) {
+ Joystick.sendData("r");
+ } else {
+
+ Joystick.sendData("s");
+
+ }
+
+ ////////////////////////////////////////////////////////
+ if (yValuePercentageLeftJoystick > 0) {
+
+ Joystick.sendData("f");
+
+ } else if (yValuePercentageLeftJoystick < 0) {
+ Joystick.sendData("b");
+ } else {
+
+ Joystick.sendData("s");
+
+ }
+
+ ////////////////////////////////////////////////////////
+ if (joystickButton_1) {
+ Joystick.sendData("u");
+
+ } else {
+
+ Joystick.sendData("s");
+ }
+
+ if (joystickButton_2) {
+ Joystick.sendData("d");
+
+ } else {
+
+ Joystick.sendData("s");
+ }
+
+ if (joystickButton_3) {
+ Joystick.sendData("o");
+
+ } else {
+
+ Joystick.sendData("s");
+ }
+
+ if (joystickButton_4) {
+ Joystick.sendData("c");
+
+ } else {
+
+ Joystick.sendData("s");
+ }
+
+ //////////////////////////////////////////////////////////////////
+ if (joystickButton_5) {
+ Joystick.sendData("u");
+
+ } else {
+
+ Joystick.sendData("s");
+ }
+
+ if (joystickButton_6) {
+ Joystick.sendData("u");
+
+ } else {
+
+ Joystick.sendData("s");
+ }
+
+ if (joystickButton_7) {
+ Joystick.sendData("u");
+
+ } else {
+
+ Joystick.sendData("s");
+ }
+
+ if (joystickButton_8) {
+ Joystick.sendData("u");
+
+ } else {
+
+ Joystick.sendData("s");
+ }
+
+ }
+ }
+
+}
diff --git a/RoboX/Robo X /build/classes/robo/x/views/Home.form b/RoboX/src/robo/x/views/Home.form
similarity index 80%
rename from RoboX/Robo X /build/classes/robo/x/views/Home.form
rename to RoboX/src/robo/x/views/Home.form
index 7023387..2736d13 100644
--- a/RoboX/Robo X /build/classes/robo/x/views/Home.form
+++ b/RoboX/src/robo/x/views/Home.form
@@ -29,9 +29,6 @@
-