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]
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user