Skip to content

Commit

Permalink
tuning parameters and bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TimLethbridge committed Jul 17, 2018
1 parent 410efeb commit c6d5850
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/RoverController_FMparameterSets.ump
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class RoverController {
const INITIAL_LEADER_HEADSTART_TIME=500;

// Amount of time in ms by default to coast in each cycle
const DEFAULT_COAST_TIME=500;
const DEFAULT_COAST_TIME=250;

// Constants to control turning

Expand All @@ -32,7 +32,7 @@ class RoverController {
const MAX_AMOUNT_BEHIND_BEFORE_THRUST = 13.0;

// Amount of time in ms by default to thrust each cycle
const DEFAULT_THRUST_TIME = 500;
const DEFAULT_THRUST_TIME = 250;

// Amount behind leader before we thrust even longer
const EXTRA_THRUST_NEEDED_DISTANCE = 13.3;
Expand Down
11 changes: 8 additions & 3 deletions src/RoverController_code-updateData.ump
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,19 @@ class FollowerRover {
void updateOtherData() {
String qresult = getQuerySocket().send(getNameForCommanding()+",getCompass()");
Scanner s = new Scanner(qresult);
s.findInLine(getNameForCommanding()+",(\\d+\\.\\d+(?:E-?d+)?);");
s.findInLine(getNameForCommanding()+",(\\d+(?:\\.\\d+)(?:E-?d+)?);");
try {
MatchResult result = s.match();
setCompass(Double.parseDouble(result.group(1)));
}
catch(Exception ise) {
System.out.println("Could not extract compass: "+qresult);
System.exit(-1);
if(qresult.substring(qresult.length() - 3).equals(",0;")) {
setCompass(0.0);
}
else {
System.out.println("Could not extract compass: "+qresult);
System.exit(-1);
}
}

s.close();
Expand Down

0 comments on commit c6d5850

Please sign in to comment.