Program: 42613
Project: 42613
Buggy source:
/** 
 * reads a sensor log and outputs the next message, if the next message is not suppose to appear for some time then this method will block until that time
 * @param sensorDataJson  the json object of sensor data
 * @param translator      translator object
 * @param playBacktime    the time the playback should play until
 * @param sensorStartTime the time the sensor playback started at
 * @param playBackSpeed   the speed to playback at
 * @return the message from the log
 * @throws InterruptedException timing didn't work
 */
public static Message parseSensorLog(JsonObject sensorDataJson,Gson translator,long playBacktime,long sensorStartTime,double playBackSpeed) throws InterruptedException {
  long sensorTime=sensorDataJson.get("String_Node_Str").getAsLong();
  long sensorDt=(sensorTime - sensorStartTime);
  long dt=(long)(sensorDt / playBackSpeed) - playBacktime;
  if (dt > 10) {
    Thread.sleep(dt);
  }
  String versionID=sensorDataJson.get("String_Node_Str").getAsString();
  Message transmitMessage=null;
switch (versionID) {
case BrakeControlMessage.VERSION_ID:
    transmitMessage=translator.fromJson(sensorDataJson,BrakeControlMessage.class);
  break;
case BrakeMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,BrakeMessage.class);
getPrivateInstance().brakePub.publish(transmitMessage);
break;
case MagneticMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,MagneticMeasurement.class);
getPrivateInstance().magPub.publish(transmitMessage);
break;
case DriveControlMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,DriveControlMessage.class);
break;
case EncoderMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,EncoderMeasurement.class);
getPrivateInstance().encoderPub.publish(transmitMessage);
break;
case FingerPrintMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,FingerPrintMessage.class);
break;
case GpsMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,GpsMeasurement.class);
getPrivateInstance().gpsPub.publish(transmitMessage);
break;
case GuiLoggingButtonMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,GuiLoggingButtonMessage.class);
getPrivateInstance().loggingButtonPub.publish(transmitMessage);
break;
case ImuMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,ImuMeasurement.class);
getPrivateInstance().imuPub.publish(transmitMessage);
break;
case GPSPoseMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,GPSPoseMessage.class);
getPrivateInstance().posePub.publish(transmitMessage);
break;
case RemoteWheelAngleRequest.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,RemoteWheelAngleRequest.class);
break;
case IMUAngularPositionMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,IMUAngularPositionMessage.class);
break;
case ResetMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,ResetMessage.class);
break;
case RobobuggyLogicNotificationMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,RobobuggyLogicNotificationMeasurement.class);
getPrivateInstance().logicNotificationPub.publish(transmitMessage);
break;
case StateMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,StateMessage.class);
break;
case SteeringMeasurement.VERSION_ID:
if (sensorDataJson.get("String_Node_Str").getAsString().equals(NodeChannel.STEERING.getMsgPath())) {
transmitMessage=translator.fromJson(sensorDataJson,SteeringMeasurement.class);
getPrivateInstance().steeringPub.publish(transmitMessage);
}
 else if (sensorDataJson.get("String_Node_Str").getAsString().equals(NodeChannel.STEERING_COMMANDED.getMsgPath())) {
transmitMessage=translator.fromJson(sensorDataJson,SteeringMeasurement.class);
getPrivateInstance().steeringCommandPub.publish(transmitMessage);
}
 else {
return transmitMessage;
}
break;
case WheelAngleCommandMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,WheelAngleCommandMeasurement.class);
break;
default :
break;
}
return transmitMessage;
}

Fixed version (ground truth):
/** 
 * reads a sensor log and outputs the next message, if the next message is not suppose to appear for some time then this method will block until that time
 * @param sensorDataJson  the json object of sensor data
 * @param translator      translator object
 * @param playBacktime    the time the playback should play until
 * @param sensorStartTime the time the sensor playback started at
 * @param playBackSpeed   the speed to playback at
 * @return the message from the log
 * @throws InterruptedException timing didn't work
 */
public static Message parseSensorLog(JsonObject sensorDataJson,Gson translator,long playBacktime,long sensorStartTime,double playBackSpeed) throws InterruptedException {
  long sensorTime=sensorDataJson.get("String_Node_Str").getAsLong();
  long sensorDt=(sensorTime - sensorStartTime);
  long dt=(long)(sensorDt / playBackSpeed) - playBacktime;
  if (dt > 10) {
    Thread.sleep(dt);
  }
  String versionID=sensorDataJson.get("String_Node_Str").getAsString();
  Message transmitMessage=null;
switch (versionID) {
case BrakeControlMessage.VERSION_ID:
    transmitMessage=translator.fromJson(sensorDataJson,BrakeControlMessage.class);
  break;
case BrakeMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,BrakeMessage.class);
getPrivateInstance().brakePub.publish(transmitMessage);
break;
case MagneticMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,MagneticMeasurement.class);
getPrivateInstance().magPub.publish(transmitMessage);
break;
case DriveControlMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,DriveControlMessage.class);
getPrivateInstance().driveCtrlPub.publish(transmitMessage);
break;
case EncoderMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,EncoderMeasurement.class);
getPrivateInstance().encoderPub.publish(transmitMessage);
break;
case FingerPrintMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,FingerPrintMessage.class);
break;
case GpsMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,GpsMeasurement.class);
getPrivateInstance().gpsPub.publish(transmitMessage);
break;
case GuiLoggingButtonMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,GuiLoggingButtonMessage.class);
getPrivateInstance().loggingButtonPub.publish(transmitMessage);
break;
case ImuMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,ImuMeasurement.class);
getPrivateInstance().imuPub.publish(transmitMessage);
break;
case GPSPoseMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,GPSPoseMessage.class);
getPrivateInstance().posePub.publish(transmitMessage);
break;
case RemoteWheelAngleRequest.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,RemoteWheelAngleRequest.class);
break;
case IMUAngularPositionMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,IMUAngularPositionMessage.class);
break;
case ResetMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,ResetMessage.class);
break;
case RobobuggyLogicNotificationMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,RobobuggyLogicNotificationMeasurement.class);
getPrivateInstance().logicNotificationPub.publish(transmitMessage);
break;
case StateMessage.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,StateMessage.class);
break;
case SteeringMeasurement.VERSION_ID:
if (sensorDataJson.get("String_Node_Str").getAsString().equals(NodeChannel.STEERING.getMsgPath())) {
transmitMessage=translator.fromJson(sensorDataJson,SteeringMeasurement.class);
getPrivateInstance().steeringPub.publish(transmitMessage);
}
 else if (sensorDataJson.get("String_Node_Str").getAsString().equals(NodeChannel.STEERING_COMMANDED.getMsgPath())) {
transmitMessage=translator.fromJson(sensorDataJson,SteeringMeasurement.class);
getPrivateInstance().steeringCommandPub.publish(transmitMessage);
}
 else {
return transmitMessage;
}
break;
case WheelAngleCommandMeasurement.VERSION_ID:
transmitMessage=translator.fromJson(sensorDataJson,WheelAngleCommandMeasurement.class);
break;
default :
break;
}
return transmitMessage;
}