MockBoat has autoVMG disabled by default.

Wind/Tack commands disable autoVMG. VMG command enables it.
Upwind command was turning until boat was at 0 degrees, instead of being aligned with wind direction, but that's fixed.
#story[1096]
main
fjc40 8 years ago
parent 3cf0cf2ee0
commit 39b5cc2edc

@ -25,7 +25,7 @@ public class MockBoat extends Boat {
/**
* Stores whether the boat is on autoVMG or not
*/
private boolean autoVMG = true;
private boolean autoVMG = false;

@ -18,6 +18,9 @@ public class TackGybeCommand implements Command {
//The refactoring of MockRace will require changes to be made
@Override
public void execute() {
boat.setAutoVMG(false);
/*VMG newVMG = boat.getPolars().calculateVMG(
race.getWindDirection(),
race.getWindSpeed(),

@ -18,6 +18,7 @@ public class VMGCommand implements Command {
//The refactoring of MockRace will require changes to be made
@Override
public void execute() {
boat.setAutoVMG(true);
/*VMG newVMG = boat.getPolars().calculateVMG(
race.getWindDirection(),
race.getWindSpeed(),

@ -20,13 +20,17 @@ public class WindCommand implements Command {
@Override
public void execute() {
boat.setAutoVMG(false);
double wind = race.getWindDirection().degrees();
double heading = boat.getBearing().degrees();
double offset = 3.0;
offset *= direction;
if(wind - heading < 0) offset *= -1;
double headWindDelta = wind - heading;
if ((headWindDelta < 0) || (headWindDelta > 180)) offset *= -1;
boat.setBearing(Bearing.fromDegrees(heading + offset));
}

Loading…
Cancel
Save