Skip to content

Commit

Permalink
Added, "aboutface" and "offcenter" to optional settings for calibrati…
Browse files Browse the repository at this point in the history
…ng turn times (ms to degrees). Only do 'find home' cal on a full battery.
  • Loading branch information
brad.zdanivsky committed Nov 13, 2011
1 parent a69a93e commit 1341482
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 30 deletions.
16 changes: 10 additions & 6 deletions oculus/WEB-INF/src/developer/terminal/AbstractTerminal.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,22 @@ public void run() {
break;
}
}
try {

//try {

in.close();
/* in.close();
in = null;
out.close();
out.close();
socket.close();
socket.close();*/
System.out.println(".. clean exit...");

} catch (IOException e) {
e.printStackTrace();
}

shutdown();

//} catch (IOException e) {
// e.printStackTrace();
//}
}
}).start();
}
Expand Down
54 changes: 31 additions & 23 deletions oculus/WEB-INF/src/developer/terminal/FindHome.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import developer.CommandServer;

//import oculus.State;
//import oculus.PlayerCommands;
import oculus.OptionalSettings;
import oculus.State;
import oculus.Util;
Expand All @@ -15,6 +13,7 @@ public class FindHome extends AbstractTerminal {

long start = System.currentTimeMillis();
boolean looking = true;
int fullspin = 605;

public FindHome(String ip, String port, final String user, final String pass)
throws NumberFormatException, UnknownHostException, IOException {
Expand All @@ -25,8 +24,9 @@ public FindHome(String ip, String port, final String user, final String pass)
/** wait on the camera and battery, dock */
public void connect() {

out.println("settings");
out.println("state");
Util.delay(500);
Util.delay(2000);

while (true) {
if (state.get(State.batterystatus) == null) {
Expand Down Expand Up @@ -60,20 +60,22 @@ public void connect() {

System.out.println(".. docked, so undocking.");
out.println("undock");
Util.delay(2500);
Util.delay(2300);
out.println("move backward");
Util.delay(1000);
Util.delay(700);
out.println("stop");
Util.delay(1000);
Util.delay(700);

// turn round some

int nudges = state.getInteger(OptionalSettings.offcenter.toString());
if(nudges != State.ERROR) System.out.println("...found offest: " + nudges);
int aboutface = state.getInteger(OptionalSettings.aboutface.toString());
System.out.println("...found offest: " + nudges + " aboutface: " + aboutface);

if(fullspin<600) fullspin = 600;

// find perfect 360 time
out.println("move left");
Util.delay(6300);
Util.delay(fullspin);
out.println("stop");
Util.delay(1000);
}
Expand All @@ -86,9 +88,9 @@ public void connect() {

}

out.println("settings nudgedelay 250");
out.println("settings stopdelay 300");
out.println("settings volume 100");
out.println("settings nudgedelay 290");
out.println("settings stopdelay 100");
out.println("settings volume 90");
out.println("state foo true");

}
Expand All @@ -99,7 +101,7 @@ public void execute() {
connect();

int nudges = spinFind();

System.out.println("spin time = " + (fullspin/2));
out.println("settings " + OptionalSettings.offcenter.toString() +" "+ nudges);

// hand over control, wait for docking...
Expand All @@ -115,12 +117,16 @@ public void execute() {

System.out.println("[" + (System.currentTimeMillis() - start) + "] ms into autodocking.");
if ((System.currentTimeMillis() - start) > State.TWO_MINUTES) {

System.out.println("FindHome, Aborting...");
// nudges = spinFind();

/*
out.println("beep");
out.println("beep");
out.println("beep");
shutdown();
*/ shutdown();

}


Expand All @@ -142,15 +148,15 @@ public void execute() {
out.println("memory");

// save scan setting
out.println("settings " + OptionalSettings.aboutface.toString() + " " + ((double)fullspin/2));



Util.delay(500);
// out.println("restart")
out.println("bye");

Util.delay(500);
System.out.println("find home closed its self??");
Util.delay(500);

System.out.println("... find home closed its self??");
Util.delay(5000);
shutdown();
}

Expand Down Expand Up @@ -191,19 +197,21 @@ public int spinFind(){
}

if(out==null) {
System.out.println("errrorrrrr: socket closed, shutdown");
shutdown();
if(out.checkError()){
System.out.println("errrorrrrr: socket closed, shutdown");
shutdown();
}
}

// call every so often
if ((i++ % 5) == 0) {
if ((i++ % 3) == 0) {

System.out.println(i + " : publish again, look back one" );
out.println("nudge right");
out.println("publish camera");
out.println("memory");
Util.delay(4000);
state.dump();
// state.dump();

}

Expand Down
2 changes: 1 addition & 1 deletion oculus/WEB-INF/src/developer/terminal/Terminal.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.net.*;

/**
* Bare bones terminal client for Oculus. Stdin and Stdout get mapped to socket of given parameters.
* Bare bones telnet terminal client for Oculus. Stdin and Stdout get mapped to socket of given parameters.
*/
public class Terminal {

Expand Down

0 comments on commit 1341482

Please sign in to comment.