Fixed velocity issues with mock data

-Was accidentally sending scaled velocity

#story[778]
main
Erika Savell 9 years ago
parent 8886b5db05
commit eb58581e83

@ -32,7 +32,7 @@ public class Race implements Runnable {
protected int boatsFinished = 0;
protected long totalTimeElapsed;
protected int scaleFactor;
protected int PRERACE_TIME = 180; //time in milliseconds to pause during pre-race. At the moment, 3 minutes
protected int PRERACE_TIME = 180000; //time in milliseconds to pause during pre-race. At the moment, 3 minutes
protected boolean countdownFinish = false;
protected boolean runRace = true;
private int lastFPS = 20;
@ -118,7 +118,6 @@ public class Race implements Runnable {
@Override
public void handle(long arg0) {
timeLeft = startTime - currentTime;
System.out.println(timeLeft);
ArrayList<BoatStatusMessage> boatStatusMessages = new ArrayList<>();
//For each boat, we update it's position, and generate a BoatLocationMessage.
for (int i = 0; i < startingBoats.size(); i++) {
@ -140,7 +139,6 @@ public class Race implements Runnable {
if (runRace) {
simulateRace();
}
System.out.println("Stopping");
stop();
}
else {
@ -188,7 +186,7 @@ public class Race implements Runnable {
updatePosition(boat, Math.round(1000 / lastFPS) > 20 ? 15 : Math.round(1000 / lastFPS));
checkPosition(boat, totalTimeElapsed);
}
mockOutput.parseBoatLocation(boat.getSourceID(), boat.getCurrentPosition().getLatitude(), boat.getCurrentPosition().getLongitude(), boat.getHeading(), boat.getScaledVelocity());
mockOutput.parseBoatLocation(boat.getSourceID(), boat.getCurrentPosition().getLatitude(), boat.getCurrentPosition().getLongitude(), boat.getHeading(), boat.getVelocity());
boatStatusMessages.add(new BoatStatusMessage(boat.getSourceID(),
boat.getCurrentLeg().getLegNumber() >= 0 ? BoatStatus.RACING : BoatStatus.DNF, boat.getCurrentLeg().getLegNumber()));
} else {

@ -59,7 +59,6 @@ public class BinaryMessageEncoder {
System.arraycopy(this.header, 0, messageAndHeader, 0, this.header.length);
System.arraycopy(this.message, 0, messageAndHeader, this.header.length, this.message.length);
crc.update(messageAndHeader);
//System.out.println(Arrays.toString(messageAndHeader));
tempMessageByteBuffer.put(intToBytes((int) crc.getValue()));
this.fullMessage = tempMessageByteBuffer.array();

@ -5,9 +5,6 @@ package SharedModel;
* Created by Erika on 19-Mar-17.
*/
public class Constants {
public static final int NMToMetersConversion = 1852; // 1 nautical mile = 1852 meters
//Knots x this = meters per second.
public static final double KnotsToMetersPerSecondConversionFactor = 0.514444;

@ -65,7 +65,6 @@ public class RaceClock {
}
public String getTimeZone() {
System.out.println(zoneId.toString());
return zoneId.toString();
}

@ -84,9 +84,7 @@ public class ResizableRaceCanvas extends Canvas {
}
public void displayBoat(Boat boat, double angle, Color colour) {
GraphCoordinate pos = this.map.convertGPS(boat.getCurrentPosition());/*
System.out.println(String.format("x%s y%s", pos.getX(), pos.getY()));
System.exit(0);*/
GraphCoordinate pos = this.map.convertGPS(boat.getCurrentPosition());
Paint paint = colour;
double[] x = {pos.getX() - 6, pos.getX(), pos.getX() + 6};

Loading…
Cancel
Save