if (connected == 0) {
System.out.println("Please connect a controller first.");
System.exit(1);
}
PSMoveTracker tracker = new PSMoveTracker();
PSMove move = new PSMove();
// Mirror the camera image
tracker.set_mirror(1);
while (tracker.enable(move) != Status.Tracker_CALIBRATED);
while (true) {
tracker.update_image();
tracker.update();
/* Optional and not required by default
short [] r = {0};
short [] g = {0};
short [] b = {0};
tracker.get_color(move, r, g, b);
move.set_leds(r[0], g[0], b[0]);
move.update_leds();
*/
if (tracker.get_status(move) == Status.Tracker_TRACKING) {
float [] x = { 0.f };
float [] y = { 0.f };
float [] radius = { 0.f };
tracker.get_position(move, x, y, radius);
System.out.format("x: %5.2f y: %5.2f radius: %5.2f\n",
x[0], y[0], radius[0]);
} else {
System.out.println("Not tracking.");