Fixed FRCSim artf2594 - JavaGazebo no longer crashes if gzserver hasn't started, and cleaned up some code in the area.

Change-Id: I4daae199fb6dda6561c2cb85fc5254e36bcb3066
This commit is contained in:
Colby Skeggs
2014-06-20 10:18:42 -07:00
parent e9ade472e4
commit 698f38d404
6 changed files with 107 additions and 81 deletions

View File

@@ -3,13 +3,21 @@ package edu.wpi.first.wpilibj.simulation.ds;
import org.gazebosim.transport.Node;
public class Main {
public static void main(String args[]) {
Node node = new Node("frc");
JoystickProvider provider = new JoystickProvider();
@SuppressWarnings("unused")
public static void main(String args[]) {
Node node = new Node("frc");
try {
node.waitForConnection();
} catch (Throwable thr) {
System.err.println("Could not connect to Gazebo.");
thr.printStackTrace();
System.exit(1);
return;
}
JoystickProvider provider = new JoystickProvider();
DS ds = new DS(provider);
ds.advertise(node);
ds.advertise(node);
while (true) {
ds.publish();
for (int i = 0; i < provider.getJoysticks().size(); i++) {
@@ -25,5 +33,5 @@ public class Main {
e.printStackTrace();
}
}
}
}
}