Fixed FRCSim artf2619, and misc reformatting.

Change-Id: I7133f46f88f7e2cb2451c2a6714daa8f3f368b40
This commit is contained in:
Colby Skeggs
2014-07-22 13:10:23 -07:00
parent 461e359484
commit 2dd45c3ea6
5 changed files with 86 additions and 53 deletions

View File

@@ -13,7 +13,6 @@ public class SimEncoder {
public SimEncoder(String topic) {
command_pub = MainNode.advertise(topic+"/control", Msgs.String());
command_pub.setLatchMode(true);
MainNode.subscribe(topic+"/position", Msgs.Float64(),
new SubscriberCallback<Float64>() {
@@ -21,15 +20,26 @@ public class SimEncoder {
position = msg.getData();
}
}
);
MainNode.subscribe(topic+"/velocity", Msgs.Float64(),
);
MainNode.subscribe(topic+"/velocity", Msgs.Float64(),
new SubscriberCallback<Float64>() {
@Override public void callback(Float64 msg) {
velocity = msg.getData();
}
}
);
try {
if (command_pub.waitForConnection(5000)) { // Wait up to five seconds.
System.out.println("Initialized " + topic);
} else {
System.err.println("Failed to initialize " + topic + ": does the encoder exist?");
}
} catch (InterruptedException ex) {
ex.printStackTrace(); // TODO: Better way to handle this?
Thread.currentThread().interrupt();
}
}
public void reset() {