nus-yam/ex-repair huggingface dataset:
Program: 42634
Project: 42634
Buggy source:
/** 
 * Constructor for TransistorAuton robot class
 */
private TransistorAuton(){
  super();
  try {
    Thread.sleep(ARDUINO_BOOTLOADER_TIMEOUT);
  }
 catch (  InterruptedException e) {
    new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.EXCEPTION);
    shutDown();
  }
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  nodeList.add(new KfLocalizer(10));
  nodeList.add(new GpsNode(NodeChannel.GPS,RobobuggyConfigFile.getComPortGPS()));
  nodeList.add(new LoggingNode(NodeChannel.GUI_LOGGING_BUTTON,RobobuggyConfigFile.LOG_FILE_LOCATION,NodeChannel.getLoggingChannels()));
  nodeList.add(new RBSMNode(NodeChannel.ENCODER,NodeChannel.STEERING,RobobuggyConfigFile.getComPortRBSM(),RobobuggyConfigFile.RBSM_COMMAND_PERIOD));
  nodeList.add(new HillCrestImuNode());
  try {
    ArrayList<GpsMeasurement> wayPoints=WayPointUtil.createWayPointsFromWaypointList(RobobuggyConfigFile.getWaypointSourceLogFile());
    nodeList.add(new WayPointFollowerPlanner(wayPoints));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  RobobuggyJFrame mainWindow=new RobobuggyJFrame("String_Node_Str",1.0,1.0);
  Gui.getInstance().addWindow(mainWindow);
  RobobuggyGUITabs tabs=new RobobuggyGUITabs();
  mainWindow.addComponent(tabs,0.0,0.0,1.0,1.0);
  tabs.addTab(new MainGuiWindow(),"String_Node_Str");
  tabs.add(new PathPanel(),"String_Node_Str");
  tabs.addTab(new ConfigurationPanel(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Constructor for TransistorAuton robot class
 */
private TransistorAuton(){
  super();
  try {
    Thread.sleep(ARDUINO_BOOTLOADER_TIMEOUT);
  }
 catch (  InterruptedException e) {
    new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.EXCEPTION);
    shutDown();
  }
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  nodeList.add(new KfLocalizer(10));
  nodeList.add(new GpsNode(NodeChannel.GPS,RobobuggyConfigFile.getComPortGPS()));
  nodeList.add(new LoggingNode(NodeChannel.GUI_LOGGING_BUTTON,RobobuggyConfigFile.LOG_FILE_LOCATION,NodeChannel.getLoggingChannels()));
  nodeList.add(new RBSMNode(NodeChannel.ENCODER,NodeChannel.STEERING,RobobuggyConfigFile.getComPortRBSM(),RobobuggyConfigFile.RBSM_COMMAND_PERIOD));
  nodeList.add(new HillcrestImuNode());
  try {
    ArrayList<GpsMeasurement> wayPoints=WayPointUtil.createWayPointsFromWaypointList(RobobuggyConfigFile.getWaypointSourceLogFile());
    nodeList.add(new WayPointFollowerPlanner(wayPoints));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  RobobuggyJFrame mainWindow=new RobobuggyJFrame("String_Node_Str",1.0,1.0);
  Gui.getInstance().addWindow(mainWindow);
  RobobuggyGUITabs tabs=new RobobuggyGUITabs();
  mainWindow.addComponent(tabs,0.0,0.0,1.0,1.0);
  tabs.addTab(new MainGuiWindow(),"String_Node_Str");
  tabs.add(new PathPanel(),"String_Node_Str");
  tabs.addTab(new ConfigurationPanel(),"String_Node_Str");
}
Program: 42636
Project: 42636
Buggy source:
@Before public void setUp() throws Exception {
}

Fixed version (ground truth):
/** 
 * setup done before each test
 */
@Before public void setUp(){
}
Program: 42637
Project: 42637
Buggy source:
@After public void tearDown() throws Exception {
}

Fixed version (ground truth):
/** 
 * work that's done after each test
 */
@After public void tearDown(){
}
Program: 42638
Project: 42638
Buggy source:
private void setupEncoderSubscriber(){
  new Subscriber("String_Node_Str",NodeChannel.ENCODER.getMsgPath(),((topicName,m) -> {
    long currentTime=new Date().getTime();
    long dt=currentTime - lastEncoderTime;
    if (dt < 10) {
      return;
    }
    EncoderMeasurement odometry=(EncoderMeasurement)m;
    double currentEncoder=odometry.getDistance();
    double dx=currentEncoder - lastEncoder;
    double bodySpeed=dx / (dt / 1000.0);
    lastEncoderTime=currentTime;
    lastEncoder=currentEncoder;
    double[][] z2D={{bodySpeed}};
    Matrix z=new Matrix(z2D);
    kalmanFilter(C_encoder,z);
  }
));
}

Fixed version (ground truth):
private void setupEncoderSubscriber(){
  new Subscriber("String_Node_Str",NodeChannel.ENCODER.getMsgPath(),((topicName,m) -> {
    long currentTime=new Date().getTime();
    long dt=currentTime - lastEncoderTime;
    if (dt < 10) {
      return;
    }
    EncoderMeasurement odometry=(EncoderMeasurement)m;
    double currentEncoder=odometry.getDistance();
    double dx=currentEncoder - lastEncoder;
    double bodySpeed=dx / (dt / 1000.0);
    lastEncoderTime=currentTime;
    lastEncoder=currentEncoder;
    double[][] z2D={{0},{0},{bodySpeed},{0},{0}};
    Matrix z=new Matrix(z2D);
    kalmanFilter(C_encoder,z);
  }
));
}
Program: 42639
Project: 42639
Buggy source:
private void setupGPSSubscriber(){
  new Subscriber("String_Node_Str",NodeChannel.GPS.getMsgPath(),((topicName,m) -> {
    GpsMeasurement gpsLoc=(GpsMeasurement)m;
    LocTuple loc=new LocTuple(gpsLoc.getLatitude(),gpsLoc.getLongitude());
    UTMTuple gps=LocalizerUtil.deg2UTM(loc);
    double dx=gps.getEasting() - lastGPS.getEasting();
    double dy=gps.getNorthing() - lastGPS.getNorthing();
    lastGPS=gps;
    double heading=Math.atan2(dy,dx);
    if ((dx * dx + dy * dy) < 0.25) {
      heading=x.get(HEADING_GLOBAL_ROW,0);
    }
    if (Math.abs(gps.getEasting() - initialLocationGPS.getEasting()) + Math.abs(gps.getNorthing() - initialLocationGPS.getNorthing()) < 10.0) {
      heading=INITIAL_HEADING_IN_RADS;
    }
    double[][] z2D={{gps.getEasting()},{gps.getNorthing()},{heading}};
    Matrix z=new Matrix(z2D);
    kalmanFilter(C_gps,z);
  }
));
}

Fixed version (ground truth):
private void setupGPSSubscriber(){
  new Subscriber("String_Node_Str",NodeChannel.GPS.getMsgPath(),((topicName,m) -> {
    GpsMeasurement gpsLoc=(GpsMeasurement)m;
    LocTuple loc=new LocTuple(gpsLoc.getLatitude(),gpsLoc.getLongitude());
    UTMTuple gps=LocalizerUtil.deg2UTM(loc);
    double dx=gps.getEasting() - lastGPS.getEasting();
    double dy=gps.getNorthing() - lastGPS.getNorthing();
    lastGPS=gps;
    double heading=Math.atan2(dy,dx);
    if ((dx * dx + dy * dy) < 0.25) {
      heading=x.get(HEADING_GLOBAL_ROW,0);
    }
    if (Math.abs(gps.getEasting() - initialLocationGPS.getEasting()) + Math.abs(gps.getNorthing() - initialLocationGPS.getNorthing()) < 10.0) {
      heading=INITIAL_HEADING_IN_RADS;
    }
    double[][] z2D={{gps.getEasting()},{gps.getNorthing()},{0},{heading},{0}};
    Matrix z=new Matrix(z2D);
    kalmanFilter(C_gps,z);
  }
));
}
Program: 42640
Project: 42640
Buggy source:
private Matrix getMotionModel(double dt){
  double[][] motionModel2D={{1,0,dt * Math.cos(x.get(HEADING_GLOBAL_ROW,0)),0,0},{0,1,dt * Math.sin(x.get(HEADING_GLOBAL_ROW,0)),0,0},{0,0,1,0,0},{0,0,0,1,dt,0},{0,0,Math.tan(steeringAngle) / WHEELBASE_IN_METERS,0,0}};
  return new Matrix(motionModel2D);
}

Fixed version (ground truth):
private Matrix getMotionModel(double dt){
  double[][] motionModel2D={{1,0,dt * Math.cos(x.get(HEADING_GLOBAL_ROW,0)),0,0},{0,1,dt * Math.sin(x.get(HEADING_GLOBAL_ROW,0)),0,0},{0,0,1,0,0},{0,0,0,1,dt},{0,0,Math.tan(steeringAngle) / WHEELBASE_IN_METERS,0,0}};
  return new Matrix(motionModel2D);
}
Program: 42641
Project: 42641
Buggy source:
private void kalmanFilter(Matrix C,Matrix z){
  Date now=new Date();
  double dt=(now.getTime() - lastTime) / 1000.0;
  lastTime=now.getTime();
  Matrix A=getMotionModel(dt);
  Matrix x_pre=A.times(x);
  Matrix P_pre=A.times(P).times(A.transpose());
  P_pre=P_pre.plus(R);
  x_pre.set(HEADING_GLOBAL_ROW,0,clampAngle(x_pre.get(HEADING_GLOBAL_ROW,0)));
  x_pre.set(HEADING_VEL_ROW,0,clampAngle(x_pre.get(HEADING_VEL_ROW,0)));
  Matrix residual=z.minus(C.times(x));
  Matrix K=C.times(P_pre).times(C.transpose()).plus(Q);
  K=P_pre.times(C.transpose()).times(K.inverse());
  x=x_pre.plus(K.times(residual));
  P=Matrix.identity(5,5).minus(K.times(C));
  P=P.times(P_pre);
  x.set(HEADING_GLOBAL_ROW,0,clampAngle(x.get(HEADING_GLOBAL_ROW,0)));
  x.set(HEADING_VEL_ROW,0,clampAngle(x.get(HEADING_VEL_ROW,0)));
}

Fixed version (ground truth):
private void kalmanFilter(Matrix C,Matrix z){
  Date now=new Date();
  double dt=(now.getTime() - lastTime) / 1000.0;
  lastTime=now.getTime();
  Matrix A=getMotionModel(dt);
  Matrix x_pre=A.times(x);
  Matrix P_pre=A.times(P).times(A.transpose());
  P_pre=P_pre.plus(R);
  x_pre.set(HEADING_GLOBAL_ROW,0,clampAngle(x_pre.get(HEADING_GLOBAL_ROW,0)));
  x_pre.set(HEADING_VEL_ROW,0,clampAngle(x_pre.get(HEADING_VEL_ROW,0)));
  Matrix residual=z.minus(C.times(x));
  Matrix K=C;
  K=K.times(P_pre);
  K=K.times(C.transpose());
  K=K.plus(Q);
  K=P_pre.times(C.transpose()).times(K.inverse());
  x=x_pre.plus(K.times(residual));
  P=Matrix.identity(5,5).minus(K.times(C));
  P=P.times(P_pre);
  x.set(HEADING_GLOBAL_ROW,0,clampAngle(x.get(HEADING_GLOBAL_ROW,0)));
  x.set(HEADING_VEL_ROW,0,clampAngle(x.get(HEADING_VEL_ROW,0)));
}
Program: 42642
Project: 42642
Buggy source:
/** 
 * Create a new   {@link PeriodicNode} decorator
 * @param period of the periodically executed portion of the node
 * @param name the name of the node
 * @param initialPosition the initial position of the localizer
 */
protected RobobuggyKFLocalizer(int period,String name,LocTuple initialPosition){
  super(new BuggyBaseNode(NodeChannel.POSE),period,name);
  posePub=new Publisher(NodeChannel.POSE.getMsgPath());
  initialLocationGPS=LocalizerUtil.deg2UTM(initialPosition);
  lastTime=new Date().getTime();
  lastEncoder=0;
  lastEncoderTime=lastTime;
  lastGPS=initialLocationGPS;
  double[][] x2D={{initialLocationGPS.getEasting()},{initialLocationGPS.getNorthing()},{0},{INITIAL_HEADING_IN_RADS},{0}};
  x=new Matrix(x2D);
  double[] rArray={4,4,0.25,0.01,0.01};
  double[] qArray={4,4,0.25,0.02,0.02};
  double[] pArray={25,25,0.25,2.46,2.46};
  R=arrayToMatrix(rArray);
  Q=arrayToMatrix(qArray);
  P=arrayToMatrix(pArray);
  double[][] cGPS2D={{1,0,0,0,0},{0,1,0,0,0},{0,0,0,1,0}};
  C_gps=new Matrix(cGPS2D);
  double[][] cEncoder2D={{0,0,1,0,0}};
  C_encoder=new Matrix(cEncoder2D);
  setupGPSSubscriber();
  setupEncoderSubscriber();
  setupWheelSubscriber();
}

Fixed version (ground truth):
/** 
 * Create a new   {@link PeriodicNode} decorator
 * @param period of the periodically executed portion of the node
 * @param name the name of the node
 * @param initialPosition the initial position of the localizer
 */
protected RobobuggyKFLocalizer(int period,String name,LocTuple initialPosition){
  super(new BuggyBaseNode(NodeChannel.POSE),period,name);
  posePub=new Publisher(NodeChannel.POSE.getMsgPath());
  initialLocationGPS=LocalizerUtil.deg2UTM(initialPosition);
  lastTime=new Date().getTime();
  lastEncoder=0;
  lastEncoderTime=lastTime;
  lastGPS=initialLocationGPS;
  double[][] x2D={{initialLocationGPS.getEasting()},{initialLocationGPS.getNorthing()},{0},{INITIAL_HEADING_IN_RADS},{0}};
  x=new Matrix(x2D);
  double[] rArray={4,4,0.25,0.01,0.01};
  double[] qArray={4,4,0.25,0.02,0.02};
  double[] pArray={25,25,0.25,2.46,2.46};
  R=arrayToMatrix(rArray);
  Q=arrayToMatrix(qArray);
  P=arrayToMatrix(pArray);
  double[][] cGPS2D={{1,0,0,0,0},{0,1,0,0,0},{0,0,0,0,0},{0,0,0,1,0},{0,0,0,0,0}};
  C_gps=new Matrix(cGPS2D);
  double[][] cEncoder2D={{0,0,0,0,0},{0,0,0,0,0},{0,0,1,0,0},{0,0,0,0,0},{0,0,0,0,0}};
  C_encoder=new Matrix(cEncoder2D);
  setupGPSSubscriber();
  setupEncoderSubscriber();
  setupWheelSubscriber();
}
Program: 42643
Project: 42643
Buggy source:
private void setupGPSSubscriber(){
}

Fixed version (ground truth):
private void setupGPSSubscriber(){
  new Subscriber("String_Node_Str",NodeChannel.GPS.getMsgPath(),((topicName,m) -> {
    GpsMeasurement gpsLoc=(GpsMeasurement)m;
    LocTuple loc=new LocTuple(gpsLoc.getLatitude(),gpsLoc.getLongitude());
    UTMTuple gps=LocalizerUtil.deg2UTM(loc);
    double dx=gps.getEasting() - lastGPS.getEasting();
    double dy=gps.getNorthing() - lastGPS.getNorthing();
    lastGPS=gps;
    double heading=Math.atan2(dy,dx);
    if ((dx * dx + dy * dy) < 0.25) {
      heading=x.get(HEADING_GLOBAL_ROW,0);
    }
    if (Math.abs(gps.getEasting() - initialLocationGPS.getEasting()) + Math.abs(gps.getNorthing() - initialLocationGPS.getNorthing()) < 10.0) {
      heading=INITIAL_HEADING_IN_RADS;
    }
    double[][] z2D={{gps.getEasting()},{gps.getNorthing()},{heading}};
    Matrix z=new Matrix(z2D);
    kalmanFilter(C_gps,Q_gps,z);
  }
));
}
Program: 42644
Project: 42644
Buggy source:
/** 
 * NOTE THIS IS NOT YET A VALID TEST CASE
 * @throws InterruptedException
 */
@Test public void test_singleIteration() throws InterruptedException {
  RobobuggyKFLocalizer localizer=new RobobuggyKFLocalizer(10000,"String_Node_Str",new LocTuple(40.441670,-79.9416362));
  new Publisher(NodeChannel.GPS.getMsgPath()).publish(new GpsMeasurement(40.441670,-79.9412361));
  Thread.sleep(100000);
  Assert.assertEquals(0.0,1.0,0.0);
}

Fixed version (ground truth):
/** 
 * NOTE THIS IS NOT YET A VALID TEST CASE
 * @throws InterruptedException
 */
@Test public void test_singleIteration() throws InterruptedException {
  RobobuggyKFLocalizer localizer=new RobobuggyKFLocalizer(10000,"String_Node_Str",new LocTuple(40.441670,-79.9416362));
  new Publisher(NodeChannel.GPS.getMsgPath()).publish(new GpsMeasurement(40.441670,-79.9512463));
  Thread.sleep(3000);
  localizer.update();
  Thread.sleep(3000);
  Assert.assertEquals(0.0,1.0,0.0);
}
Program: 42645
Project: 42645
Buggy source:
private void setupEncoderSubscriber(){
}

Fixed version (ground truth):
private void setupEncoderSubscriber(){
  new Subscriber("String_Node_Str",NodeChannel.ENCODER.getMsgPath(),((topicName,m) -> {
    long currentTime=new Date().getTime();
    long dt=currentTime - lastEncoderTime;
    if (dt < 10) {
      return;
    }
    EncoderMeasurement odometry=(EncoderMeasurement)m;
    double currentEncoder=odometry.getDistance();
    double dx=currentEncoder - lastEncoder;
    double bodySpeed=dx / (dt / 1000.0);
    lastEncoderTime=currentTime;
    lastEncoder=currentEncoder;
    double[][] z2D={{bodySpeed}};
    Matrix z=new Matrix(z2D);
    kalmanFilter(C_encoder,z);
  }
));
}
Program: 42646
Project: 42646
Buggy source:
private void setupGPSSubscriber(){
}

Fixed version (ground truth):
private void setupGPSSubscriber(){
  new Subscriber("String_Node_Str",NodeChannel.GPS.getMsgPath(),((topicName,m) -> {
    GpsMeasurement gpsLoc=(GpsMeasurement)m;
    LocTuple loc=new LocTuple(gpsLoc.getLatitude(),gpsLoc.getLongitude());
    UTMTuple gps=LocalizerUtil.deg2UTM(loc);
    double dx=gps.getEasting() - lastGPS.getEasting();
    double dy=gps.getNorthing() - lastGPS.getNorthing();
    lastGPS=gps;
    double heading=Math.atan2(dy,dx);
    if ((dx * dx + dy * dy) < 0.25) {
      heading=x.get(HEADING_GLOBAL_ROW,0);
    }
    if (Math.abs(gps.getEasting() - initialGPS.getEasting()) + Math.abs(gps.getNorthing() - initialGPS.getNorthing()) < 10.0) {
      heading=initialHeading;
    }
    double[][] z2D={{gps.getEasting()},{gps.getNorthing()},{heading}};
    Matrix z=new Matrix(z2D);
    kalmanFilter(C_gps,z);
  }
));
}
Program: 42647
Project: 42647
Buggy source:
private void kalmanFilter(Matrix C,Matrix z){
  Date now=new Date();
  double dt=(now.getTime() - lastTime) / 1000.0;
  lastTime=now.getTime();
  Matrix A=motionModel(dt);
  Matrix x_pre=A.times(x);
  Matrix P_pre=A.times(P).times(A.transpose());
  P_pre=P_pre.plus(R);
  x_pre.set(HEADING_GLOBAL_ROW,0,scrubAngle(x_pre.get(HEADING_GLOBAL_ROW,0)));
  x_pre.set(HEADING_VEL_ROW,0,scrubAngle(x_pre.get(HEADING_VEL_ROW,0)));
  Matrix residual=z.minus(C.times(x));
  Matrix K=C.times(P_pre).times(C.transpose()).plus(Q);
  K=P_pre.times(C.transpose()).times(K.inverse());
  x=x_pre.plus(K.times(residual));
  P=Matrix.identity(5,5).minus(K.times(C));
  P=P.times(P_pre);
  x.set(HEADING_GLOBAL_ROW,0,scrubAngle(x.get(HEADING_GLOBAL_ROW,0)));
  x.set(HEADING_VEL_ROW,0,scrubAngle(x.get(HEADING_VEL_ROW,0)));
}

Fixed version (ground truth):
private void kalmanFilter(Matrix C,Matrix z){
  Date now=new Date();
  double dt=(now.getTime() - lastTime) / 1000.0;
  lastTime=now.getTime();
  Matrix A=getMotionModel(dt);
  Matrix x_pre=A.times(x);
  Matrix P_pre=A.times(P).times(A.transpose());
  P_pre=P_pre.plus(R);
  x_pre.set(HEADING_GLOBAL_ROW,0,scrubAngle(x_pre.get(HEADING_GLOBAL_ROW,0)));
  x_pre.set(HEADING_VEL_ROW,0,scrubAngle(x_pre.get(HEADING_VEL_ROW,0)));
  Matrix residual=z.minus(C.times(x));
  Matrix K=C.times(P_pre).times(C.transpose()).plus(Q);
  K=P_pre.times(C.transpose()).times(K.inverse());
  x=x_pre.plus(K.times(residual));
  P=Matrix.identity(5,5).minus(K.times(C));
  P=P.times(P_pre);
  x.set(HEADING_GLOBAL_ROW,0,scrubAngle(x.get(HEADING_GLOBAL_ROW,0)));
  x.set(HEADING_VEL_ROW,0,scrubAngle(x.get(HEADING_VEL_ROW,0)));
}
Program: 42648
Project: 42648
Buggy source:
private static Matrix arrayToMatrix(double[] arr){
}

Fixed version (ground truth):
private static Matrix arrayToMatrix(double[] arr){
  double[][] arr2D={{arr[0],0,0,0,0},{0,arr[1],0,0,0},{0,0,arr[2],0,0},{0,0,0,arr[3],0},{0,0,0,0,arr[4]}};
  return new Matrix(arr2D);
}
Program: 42649
Project: 42649
Buggy source:
/** 
 * Create a new   {@link PeriodicNode} decorator
 * @param base   {@link BuggyNode} to decorate
 * @param period of the periodically executed portion of the node
 * @param name the name of the node
 * @param initialPosition the initial position of the localizer
 */
protected RobobuggyKFLocalizer(int period,String name,LocTuple initialPosition){
}

Fixed version (ground truth):
/** 
 * Create a new   {@link PeriodicNode} decorator
 * @param period of the periodically executed portion of the node
 * @param name the name of the node
 * @param initialPosition the initial position of the localizer
 */
protected RobobuggyKFLocalizer(int period,String name,LocTuple initialPosition){
  super(new BuggyBaseNode(NodeChannel.POSE),period,name);
  posePub=new Publisher(NodeChannel.POSE.getMsgPath());
  lastTime=new Date().getTime();
  lastEncoder=0;
  lastEncoderTime=lastTime;
  lastGPS=initialGPS;
  double[][] x2D={{initialGPS.getEasting()},{initialGPS.getNorthing()},{0},{initialHeading},{0}};
  x=new Matrix(x2D);
  double[] rArray={4,4,0.25,0.01,0.01};
  double[] qArray={4,4,0.25,0.02,0.02};
  double[] pArray={25,25,0.25,2.46,2.46};
  R=arrayToMatrix(rArray);
  Q=arrayToMatrix(qArray);
  P=arrayToMatrix(pArray);
  double[][] cGPS2D={{1,0,0,0,0},{0,1,0,0,0},{0,0,0,1,0}};
  C_gps=new Matrix(cGPS2D);
  double[][] cEncoder2D={{0,0,1,0,0}};
  C_encoder=new Matrix(cEncoder2D);
  setupGPSSubscriber();
  setupEncoderSubscriber();
  setupWheelSubscriber();
}
Program: 42650
Project: 42650
Buggy source:
private Matrix propagate(){
  Date now=new Date();
  double dt=(now.getTime() - lastTime) / 1000.0;
  Matrix A=motionModel(dt);
  return A.times(x);
}

Fixed version (ground truth):
private Matrix propagate(){
  Date now=new Date();
  double dt=(now.getTime() - lastTime) / 1000.0;
  Matrix A=getMotionModel(dt);
  return A.times(x);
}
Program: 42651
Project: 42651
Buggy source:
/** 
 * Creates a   {@link SerialNode} decorator for the specified {@link BuggyNode}
 * @param base       {@link BuggyNode} to decorate
 * @param threadName name of the thread
 * @param portName   name of the desired serial port
 * @param baudRate   baud rate of the serial port
 */
public SerialNode(BuggyNode base,String threadName,String portName,int baudRate){
  super(base,portName);
  this.setName(threadName);
  this.threadName=threadName;
  this.sp=connect(portName,baudRate);
}

Fixed version (ground truth):
/** 
 * Creates a   {@link SerialNode} decorator for the specified {@link BuggyNode}
 * @param base       {@link BuggyNode} to decorate
 * @param threadName name of the thread
 * @param portName   name of the desired serial port
 * @param baudRate   baud rate of the serial port
 */
public SerialNode(BuggyNode base,String threadName,String portName,int baudRate){
  super(base,portName);
  this.setName(threadName);
  this.threadName=threadName;
  if (portName.equals("String_Node_Str")) {
    return;
  }
  this.sp=connect(portName,baudRate);
}
Program: 42652
Project: 42652
Buggy source:
@Override public void actionPerformed(String topicName,Message m){
  GpsMeasurement gpsM=(GpsMeasurement)m;
  messageList.add((GpsMeasurement)m);
}

Fixed version (ground truth):
@Override public void actionPerformed(String topicName,Message m){
  messageList.add((GpsMeasurement)m);
}
Program: 42653
Project: 42653
Buggy source:
@Test public void testStandardGPSNode(){
  GpsNode gpsNode1=new GpsNode(NodeChannel.GPS,"String_Node_Str");
  String input="String_Node_Str";
  char[] inputChars=input.toCharArray();
  byte[] bytes=new String(inputChars).getBytes();
  gpsNode1.peel(bytes,0,bytes.length);
  try {
    Thread.sleep(3000);
    if (messageList.size() != 1) {
      fail("String_Node_Str");
    }
    Thread.sleep(3000);
    while (!messageList.isEmpty()) {
      GpsMeasurement m=messageList.take();
      assertEquals(m.getLatitude(),48.1173,0.0);
      assertEquals(m.getLongitude(),11.51667,0.0001);
      assertEquals(m.getNorth(),true);
      assertEquals(m.getWest(),false);
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
@Test public void testStandardGPSNode(){
  GpsNode gpsNode1=new GpsNode(NodeChannel.GPS,"String_Node_Str");
  String input="String_Node_Str";
  byte[] bytes=Charset.forName("String_Node_Str").encode(input).array();
  gpsNode1.peel(bytes,0,bytes.length);
  try {
    Thread.sleep(3000);
    if (messageList.size() != 1) {
      fail("String_Node_Str");
    }
    Thread.sleep(3000);
    while (!messageList.isEmpty()) {
      GpsMeasurement m=messageList.take();
      assertEquals(m.getLatitude(),48.1173,0.0);
      assertEquals(m.getLongitude(),11.51667,0.0001);
      assertEquals(m.getNorth(),true);
      assertEquals(m.getWest(),false);
    }
  }
 catch (  Exception e) {
  }
}
Program: 42654
Project: 42654
Buggy source:
@BeforeClass public static void oneTime(){
  new Subscriber("String_Node_Str",NodeChannel.GPS.getMsgPath(),new MessageListener(){
    @Override public void actionPerformed(    String topicName,    Message m){
      GpsMeasurement gpsM=(GpsMeasurement)m;
      messageList.add((GpsMeasurement)m);
    }
  }
);
}

Fixed version (ground truth):
@BeforeClass public static void oneTime(){
  new Subscriber("String_Node_Str",NodeChannel.GPS.getMsgPath(),new MessageListener(){
    @Override public void actionPerformed(    String topicName,    Message m){
      messageList.add((GpsMeasurement)m);
    }
  }
);
}
Program: 42655
Project: 42655
Buggy source:
/** 
 * Creates a new decorator for the given   {@link Node}
 * @param node {@link Node} to decorate
 * @param name the name we want for this node to store so that it can be referenced later
 */
public HillcrestNode(BuggyNode node,String name){
  super(node,name);
}

Fixed version (ground truth):
/** 
 * Creates a new Hillcrest IMU node
 */
public HillcrestNode(){
  super(new BuggyBaseNode(NodeChannel.IMU),"String_Node_Str");
}
Program: 42656
Project: 42656
Buggy source:
public void setUp() throws Exception {
  super.setUp();
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
}
Program: 42657
Project: 42657
Buggy source:
public void tearDown() throws Exception {
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
}
Program: 42659
Project: 42659
Buggy source:
@Override protected void update(){
  predictStep();
  UTMTuple currentLatLng=new UTMTuple(17,'T',state.get(0,0),state.get(1,0));
  LocTuple latLng=LocalizerUtil.utm2Deg(currentLatLng);
  posePub.publish(new GPSPoseMessage(new Date(),latLng.getLatitude(),latLng.getLongitude(),state.get(4,0)));
}

Fixed version (ground truth):
@Override protected synchronized void update(){
  predictStep();
  UTMTuple currentLatLng=new UTMTuple(17,'T',state.get(0,0),state.get(1,0));
  LocTuple latLng=LocalizerUtil.utm2Deg(currentLatLng);
  posePub.publish(new GPSPoseMessage(new Date(),latLng.getLatitude(),latLng.getLongitude(),state.get(4,0)));
}
Program: 42660
Project: 42660
Buggy source:
@Override public double getCommandedSteeringAngle(){
  int closestIndex=getClosestIndex(wayPoints,pose);
  if (closestIndex == -1) {
    return 17433504;
  }
  double delta=10;
  int targetIndex=closestIndex;
  while (targetIndex < wayPoints.size() && GPSPoseMessage.getDistance(pose,wayPoints.get(targetIndex).toGpsPoseMessage(0)) < delta) {
    targetIndex=targetIndex + 1;
  }
  if (targetIndex >= wayPoints.size()) {
    return 0;
  }
  GpsMeasurement targetPoint=wayPoints.get(targetIndex);
  MapMarkerDot destPoint=new MapMarkerDot(targetPoint.getLatitude(),targetPoint.getLongitude());
  AnalyticsPanel.getInstance().getDataPanel().getGpsPanel().setDestinationPoint(destPoint);
  double dLon=targetPoint.getLongitude() - pose.getLongitude();
  double dLat=targetPoint.getLatitude() - pose.getLatitude();
  double desiredHeading=Math.toDegrees(Math.atan2(LocalizerUtil.convertLatToMeters(dLat),LocalizerUtil.convertLonToMeters(dLon)));
  desiredHeading=Util.normalizeAngleDeg(desiredHeading);
  double poseHeading=Util.normalizeAngleDeg(pose.getHeading());
  return Util.normalizeAngleDeg(desiredHeading - poseHeading);
}

Fixed version (ground truth):
@Override public double getCommandedSteeringAngle(){
  int closestIndex=getClosestIndex(wayPoints,pose);
  if (closestIndex == -1) {
    return 17433504;
  }
  double delta=10;
  int targetIndex=closestIndex;
  while (targetIndex < wayPoints.size() && GPSPoseMessage.getDistance(pose,wayPoints.get(targetIndex).toGpsPoseMessage(0)) < delta) {
    targetIndex=targetIndex + 1;
  }
  if (targetIndex >= wayPoints.size()) {
    return 0;
  }
  GpsMeasurement targetPoint=wayPoints.get(targetIndex);
  double dLon=targetPoint.getLongitude() - pose.getLongitude();
  double dLat=targetPoint.getLatitude() - pose.getLatitude();
  double desiredHeading=Math.toDegrees(Math.atan2(LocalizerUtil.convertLatToMeters(dLat),LocalizerUtil.convertLonToMeters(dLon)));
  desiredHeading=Util.normalizeAngleDeg(desiredHeading);
  double poseHeading=Util.normalizeAngleDeg(pose.getHeading());
  return Util.normalizeAngleDeg(desiredHeading - poseHeading);
}
Program: 42662
Project: 42662
Buggy source:
/** 
 * Construct a new   {@link DataPanel}
 */
public DataPanel(){
  gpsPanel=new GpsPanel();
  this.addComponent(gpsPanel,0,0,1,.8);
  this.addComponent(createDataPanel(),0,.8,1,.2);
}

Fixed version (ground truth):
/** 
 * Construct a new   {@link DataPanel}
 */
public DataPanel(){
  this.addComponent(createDataPanel(),0,.8,1,.2);
}
Program: 42663
Project: 42663
Buggy source:
@Test public void testGotoWaypoint10meters(){
  GpsMeasurement currentPos=new GpsMeasurement(0,0);
  double deltaLat=LocalizerUtil.convertMetersToLat(10);
}

Fixed version (ground truth):
@Test public void testGotoWaypoint10meters(){
  LocalizerUtil.convertMetersToLat(10);
}
Program: 42667
Project: 42667
Buggy source:
private synchronized void updateStep(Matrix observationMatrix,Matrix measurement,Matrix updateCovariance){
  predictStep();
  Matrix inovation=measurement.minus(observationMatrix.times(state));
  System.out.println(state.get(4,0) + "String_Node_Str" + inovation.get(4,0));
  for (int i=4; i < 7; i++) {
    if (inovation.get(i,0) > 180) {
      inovation.set(i,0,-360 + inovation.get(i,0));
    }
 else     if (inovation.get(i,0) < -180) {
      inovation.set(i,0,360 + inovation.get(i,0));
    }
  }
  Matrix innovationCovariance=observationMatrix.times(covariance).times(observationMatrix.transpose()).plus(updateCovariance);
  Matrix kalmanGain=covariance.times(observationMatrix.transpose()).times(innovationCovariance.inverse());
  state=state.plus(kalmanGain.times(inovation));
  covariance=(Matrix.identity(covariance.getRowDimension(),covariance.getColumnDimension()).minus(kalmanGain.times(observationMatrix)));
}

Fixed version (ground truth):
private synchronized void updateStep(Matrix observationMatrix,Matrix measurement,Matrix updateCovariance){
  predictStep();
  Matrix inovation=measurement.minus(observationMatrix.times(state));
  for (int i=4; i < 7; i++) {
    if (inovation.get(i,0) > 180) {
      inovation.set(i,0,-360 + inovation.get(i,0));
    }
 else     if (inovation.get(i,0) < -180) {
      inovation.set(i,0,360 + inovation.get(i,0));
    }
  }
  Matrix innovationCovariance=observationMatrix.times(covariance).times(observationMatrix.transpose()).plus(updateCovariance);
  Matrix kalmanGain=covariance.times(observationMatrix.transpose()).times(innovationCovariance.inverse());
  state=state.plus(kalmanGain.times(inovation));
  covariance=(Matrix.identity(covariance.getRowDimension(),covariance.getColumnDimension()).minus(kalmanGain.times(observationMatrix)));
}
Program: 42668
Project: 42668
Buggy source:
private synchronized void updateStep(Matrix observationMatrix,Matrix measurement,Matrix updateCovariance){
  predictStep();
  Matrix inovation=measurement.minus(observationMatrix.times(state));
  if (inovation.get(6,0) > 180) {
    inovation.set(6,0,360 - inovation.get(6,0));
  }
  System.out.println("String_Node_Str");
  System.out.println(inovation);
  Matrix innovationCovariance=observationMatrix.times(covariance).times(observationMatrix.transpose()).plus(updateCovariance);
  Matrix kalmanGain=covariance.times(observationMatrix.transpose()).times(innovationCovariance.inverse());
  state=state.plus(kalmanGain.times(inovation));
  covariance=(Matrix.identity(covariance.getRowDimension(),covariance.getColumnDimension()).minus(kalmanGain.times(observationMatrix)));
}

Fixed version (ground truth):
private synchronized void updateStep(Matrix observationMatrix,Matrix measurement,Matrix updateCovariance){
  predictStep();
  Matrix inovation=measurement.minus(observationMatrix.times(state));
  for (int i=4; i < 7; i++) {
    if (inovation.get(i,0) > 180) {
      inovation.set(i,0,-360 + inovation.get(i,0));
    }
 else     if (inovation.get(i,0) < -180) {
      inovation.set(i,0,360 + inovation.get(i,0));
    }
  }
  System.out.println("String_Node_Str");
  System.out.println(inovation);
  Matrix innovationCovariance=observationMatrix.times(covariance).times(observationMatrix.transpose()).plus(updateCovariance);
  Matrix kalmanGain=covariance.times(observationMatrix.transpose()).times(innovationCovariance.inverse());
  state=state.plus(kalmanGain.times(inovation));
  covariance=(Matrix.identity(covariance.getRowDimension(),covariance.getColumnDimension()).minus(kalmanGain.times(observationMatrix)));
}
Program: 42670
Project: 42670
Buggy source:
private synchronized void updateStep(Matrix observationMatrix,Matrix measurement,Matrix updateCovariance){
  predictStep();
  Matrix inovation=measurement.minus(observationMatrix.times(state));
  Matrix innovationCovariance=observationMatrix.times(covariance).times(observationMatrix.transpose()).plus(updateCovariance);
  Matrix kalmanGain=covariance.times(observationMatrix.transpose()).times(innovationCovariance.inverse());
  state=state.plus(kalmanGain.times(inovation));
  covariance=(Matrix.identity(covariance.getRowDimension(),covariance.getColumnDimension()).minus(kalmanGain.times(observationMatrix)));
}

Fixed version (ground truth):
private synchronized void updateStep(Matrix observationMatrix,Matrix measurement,Matrix updateCovariance){
  predictStep();
  Matrix inovation=measurement.minus(observationMatrix.times(state));
  if (inovation.get(6,0) > 180) {
    inovation.set(6,0,360 - inovation.get(6,0));
  }
  System.out.println("String_Node_Str");
  System.out.println(inovation);
  Matrix innovationCovariance=observationMatrix.times(covariance).times(observationMatrix.transpose()).plus(updateCovariance);
  Matrix kalmanGain=covariance.times(observationMatrix.transpose()).times(innovationCovariance.inverse());
  state=state.plus(kalmanGain.times(inovation));
  covariance=(Matrix.identity(covariance.getRowDimension(),covariance.getColumnDimension()).minus(kalmanGain.times(observationMatrix)));
}
Program: 42671
Project: 42671
Buggy source:
/** 
 * Run Alice
 * @param args : None
 */
public static void main(String[] args){
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  try {
    JNISetup.setupJNI();
  }
 catch (  NoSuchFieldException|SecurityException|IllegalAccessException|IllegalArgumentException e1) {
    e1.printStackTrace();
  }
  RobobuggyConfigFile.loadConfigFile();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  robot=SimRobot.getInstance();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  Gui.getInstance();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  robot.startNodes();
  try {
    new JettyServer();
    new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Run Alice
 * @param args : None
 */
public static void main(String[] args){
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  try {
    JNISetup.setupJNI();
  }
 catch (  NoSuchFieldException|SecurityException|IllegalAccessException|IllegalArgumentException e1) {
    e1.printStackTrace();
  }
  RobobuggyConfigFile.loadConfigFile();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  robot=TransistorDataCollection.getInstance();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  Gui.getInstance();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  robot.startNodes();
  try {
    new JettyServer();
    new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 42672
Project: 42672
Buggy source:
@Override protected void paintComponent(Graphics f){
  super.paintComponent(f);
  int brakeX=50;
  int brakeY=0;
  String status="String_Node_Str";
  int battLevelBoxLeft=brakeX + getHeight() / 2;
  if (brakesDown) {
    brakeY=getHeight() - getHeight() / 3;
    status="String_Node_Str";
  }
  Graphics2D g=(Graphics2D)f;
  g.setColor(Color.RED);
  g.fillOval(brakeX,brakeY,getHeight() / 3,getHeight() / 3);
  g.setColor(Color.GREEN);
  g.fillRect(brakeX + getHeight() / 3 + 10,0,getHeight() / 3,getHeight());
  g.setColor(Color.BLACK);
  g.setFont(new Font("String_Node_Str",Font.BOLD,30));
  g.drawString("String_Node_Str" + batteryLevel,battLevelBoxLeft,getHeight() / 2);
  g.drawString("String_Node_Str" + status,0,getHeight() / 2);
  g.drawString("String_Node_Str" + fphash,battLevelBoxLeft,30);
}

Fixed version (ground truth):
@Override protected void paintComponent(Graphics f){
  super.paintComponent(f);
  int brakeX=50;
  int brakeY=0;
  String status="String_Node_Str";
  int battLevelBoxLeft=brakeX + getHeight();
  if (brakesDown) {
    brakeY=getHeight() - getHeight() / 3;
    status="String_Node_Str";
  }
  Graphics2D g=(Graphics2D)f;
  g.setColor(Color.RED);
  g.fillOval(brakeX,brakeY,getHeight() / 3,getHeight() / 3);
  g.setColor(Color.GREEN);
  g.fillRect(battLevelBoxLeft,0,getHeight() / 3,getHeight());
  g.setColor(Color.BLACK);
  g.setFont(new Font("String_Node_Str",Font.BOLD,30));
  g.drawString("String_Node_Str" + batteryLevel,battLevelBoxLeft,getHeight() / 2);
  g.drawString("String_Node_Str" + status,0,getHeight() / 2);
  g.drawString("String_Node_Str" + fphash,battLevelBoxLeft,30);
}
Program: 42674
Project: 42674
Buggy source:
/** 
 * @param originPoint the origin point of the ray
 * @param angle the heading of the ray
 * @param lineColor the color of the line
 * @param clearPrevLine update the line or add a new one
 */
public void addLineToMap(LocTuple originPoint,double angle,Color lineColor,boolean clearPrevLine){
  if (clearPrevLine) {
    mapTree.getViewer().getMapPolygonList().clear();
  }
  double scalingFactor=0.0005;
  double dx=Math.cos(angle) * scalingFactor;
  double dy=Math.sin(angle) * scalingFactor;
  LocTuple endpoint=new LocTuple(originPoint.getLatitude() + dx,originPoint.getLongitude() + dy);
  addLineToMap(originPoint,endpoint,lineColor);
}

Fixed version (ground truth):
/** 
 * @param originPoint the origin point of the ray
 * @param angle the heading of the ray
 * @param lineColor the color of the line
 * @param clearPrevLine update the line or add a new one
 */
public void addLineToMap(LocTuple originPoint,double angle,Color lineColor,boolean clearPrevLine){
  if (clearPrevLine) {
    mapTree.getViewer().getMapPolygonList().clear();
  }
  double scalingFactor=0.0005;
  double dx=Math.cos(angle) * scalingFactor;
  double dy=Math.sin(angle) * scalingFactor;
  LocTuple endpoint=new LocTuple(originPoint.getLatitude() + dy,originPoint.getLongitude() + dx);
  addLineToMap(originPoint,endpoint,lineColor);
}
Program: 42675
Project: 42675
Buggy source:
/** 
 * Run Alice
 * @param args : None
 */
public static void main(String[] args){
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  try {
    JNISetup.setupJNI();
  }
 catch (  NoSuchFieldException|SecurityException|IllegalAccessException|IllegalArgumentException e1) {
    e1.printStackTrace();
  }
  RobobuggyConfigFile.loadConfigFile();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  robot=TransistorDataCollection.getInstance();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  Gui.getInstance();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  robot.startNodes();
  try {
    new JettyServer();
    new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Run Alice
 * @param args : None
 */
public static void main(String[] args){
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  try {
    JNISetup.setupJNI();
  }
 catch (  NoSuchFieldException|SecurityException|IllegalAccessException|IllegalArgumentException e1) {
    e1.printStackTrace();
  }
  RobobuggyConfigFile.loadConfigFile();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  robot=SimRobot.getInstance();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  Gui.getInstance();
  new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  robot.startNodes();
  try {
    new JettyServer();
    new RobobuggyLogicNotification("String_Node_Str",RobobuggyMessageLevel.NOTE);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 42676
Project: 42676
Buggy source:
/** 
 * Constructor for the High Trust Localizer which will initialize the system to an identity (zero position)
 */
public HighTrustGPSLocalizer(){
  buggyFrameGpsX=0.0;
  buggyFrameGpsY=0.0;
  buggyFrameRotZ=0.0;
  posePub=new Publisher(NodeChannel.POSE.getMsgPath());
  mostRecentUpdate=new Date();
  new Subscriber(NodeChannel.GPS.getMsgPath(),new MessageListener(){
    @Override public void actionPerformed(    String topicName,    Message m){
      GpsMeasurement newGPSData=(GpsMeasurement)m;
synchronized (this) {
        long dt=newGPSData.getTimestamp().getTime() - mostRecentUpdate.getTime();
        if (dt > 0.0) {
          buggyFrameGpsY=newGPSData.getLatitude();
          buggyFrameGpsX=newGPSData.getLongitude();
          publishUpdate();
          mostRecentUpdate=newGPSData.getTimestamp();
        }
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Constructor for the High Trust Localizer which will initialize the system to an identity (zero position)
 */
public HighTrustGPSLocalizer(){
  buggyFrameGpsX=0.0;
  buggyFrameGpsY=0.0;
  buggyFrameRotZ=0.0;
  posePub=new Publisher(NodeChannel.POSE.getMsgPath());
  mostRecentUpdate=new Date();
  new Subscriber(NodeChannel.GPS.getMsgPath(),new MessageListener(){
    @Override public void actionPerformed(    String topicName,    Message m){
      GpsMeasurement newGPSData=(GpsMeasurement)m;
synchronized (this) {
        long dt=newGPSData.getTimestamp().getTime() - mostRecentUpdate.getTime();
        if (dt > 0.0) {
          buggyFrameGpsY=newGPSData.getLatitude();
          buggyFrameGpsX=newGPSData.getLongitude();
          publishUpdate();
          mostRecentUpdate=newGPSData.getTimestamp();
        }
      }
    }
  }
);
  new Subscriber(NodeChannel.IMU_MAGNETIC.getMsgPath(),(topicName,m) -> {
    MagneticMeasurement magM=(MagneticMeasurement)m;
    double currAngle=magM.getRotationZ();
    double offset=0.0;
    buggyFrameRotZ=currAngle - offset;
    publishUpdate();
  }
);
}
Program: 42677
Project: 42677
Buggy source:
@Override public double getCommandedSteeringAngle(){
  int closestIndex=getClosestIndex(wayPoints,pose);
  if (closestIndex == -1) {
    return 17433504;
  }
  double delta=10 / 100000.0;
  int targetIndex=closestIndex + 5;
  if (targetIndex >= wayPoints.size()) {
    return 0;
  }
  GpsMeasurement targetPoint=wayPoints.get(targetIndex);
  double dLon=targetPoint.getLongitude() - pose.getLongitude();
  double dLat=targetPoint.getLatitude() - pose.getLatitude();
  double desiredHeading=180 * Math.atan2(dLat,dLon) / Math.PI;
  if (desiredHeading < 0) {
    desiredHeading+=360;
  }
  double poseHeading=pose.getHeading();
  if (poseHeading < 0) {
    poseHeading+=360;
  }
  return desiredHeading - poseHeading;
}

Fixed version (ground truth):
@Override public double getCommandedSteeringAngle(){
  int closestIndex=getClosestIndex(wayPoints,pose);
  if (closestIndex == -1) {
    return 17433504;
  }
  double delta=10 / 100000.0;
  int targetIndex=closestIndex + 5;
  if (targetIndex >= wayPoints.size()) {
    return 0;
  }
  GpsMeasurement targetPoint=wayPoints.get(targetIndex);
  AnalyticsPanel.getInstance().getDataPanel().getGpsPanel().destinationPoint.setLat(targetPoint.getLatitude());
  AnalyticsPanel.getInstance().getDataPanel().getGpsPanel().destinationPoint.setLon(targetPoint.getLongitude());
  double dLon=targetPoint.getLongitude() - pose.getLongitude();
  double dLat=targetPoint.getLatitude() - pose.getLatitude();
  double desiredHeading=180 * Math.atan2(dLat,dLon) / Math.PI;
  desiredHeading=Util.normalizeAngleDeg(desiredHeading);
  double poseHeading=Util.normalizeAngleDeg(pose.getHeading());
  return Util.normalizeAngleDeg(desiredHeading - poseHeading);
}
Program: 42678
Project: 42678
Buggy source:
private SimRobot(){
  super();
  nodeList.add(new HighTrustGPSLocalizer());
  nodeList.add(new SimulatedImuNode(100));
  nodeList.add(new SimulatedGPSNode(500));
  nodeList.add(new SimulatedRBSMNode());
  try {
    ArrayList<GpsMeasurement> wayPoints=WayPointUtil.createWayPointsFromWaypointList(RobobuggyConfigFile.getWaypointSourceLogFile());
    nodeList.add(new WayPointFollowerPlanner(wayPoints));
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
  SimulatedBuggy simBuggy=SimulatedBuggy.getInstance();
  simBuggy.setY(LocalizerUtil.convertLatToMeters(40.4404511));
  simBuggy.setX(LocalizerUtil.convertLonToMeters(-79.9443657));
  simBuggy.setDx(.1);
  RobobuggyJFrame mainWindow=new RobobuggyJFrame("String_Node_Str",1.0,1.0);
  Gui.getInstance().addWindow(mainWindow);
  RobobuggyGUITabs tabs=new RobobuggyGUITabs();
  mainWindow.addComponent(tabs,0.0,0.0,1.0,1.0);
  tabs.addTab(new MainGuiWindow(),"String_Node_Str");
  tabs.addTab(new VelocityWindow(),"String_Node_Str");
  tabs.addTab(new PoseGraphsPanel(),"String_Node_Str");
  tabs.addTab(new ImuPanel(),"String_Node_Str");
  tabs.addTab(new AutonomousPanel(),"String_Node_Str");
  tabs.addTab(new SimulationPanel(),"String_Node_Str");
  tabs.addTab(new PathPanel(),"String_Node_Str");
  tabs.addTab(new ConfigurationPanel(),"String_Node_Str");
}

Fixed version (ground truth):
private SimRobot(){
  super();
  nodeList.add(new HighTrustGPSLocalizer());
  nodeList.add(new SimulatedImuNode(100));
  nodeList.add(new SimulatedGPSNode(500));
  nodeList.add(new SimulatedRBSMNode());
  try {
    ArrayList<GpsMeasurement> wayPoints=WayPointUtil.createWayPointsFromWaypointList(RobobuggyConfigFile.getWaypointSourceLogFile());
    nodeList.add(new WayPointFollowerPlanner(wayPoints));
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
  SimulatedBuggy simBuggy=SimulatedBuggy.getInstance();
  simBuggy.setY(LocalizerUtil.convertLatToMeters(40.438649));
  simBuggy.setX(LocalizerUtil.convertLonToMeters(-79.945233));
  simBuggy.setDx(.1);
  RobobuggyJFrame mainWindow=new RobobuggyJFrame("String_Node_Str",1.0,1.0);
  Gui.getInstance().addWindow(mainWindow);
  RobobuggyGUITabs tabs=new RobobuggyGUITabs();
  mainWindow.addComponent(tabs,0.0,0.0,1.0,1.0);
  tabs.addTab(new MainGuiWindow(),"String_Node_Str");
  tabs.addTab(new PoseGraphsPanel(),"String_Node_Str");
  tabs.addTab(new ImuPanel(),"String_Node_Str");
  tabs.addTab(new AutonomousPanel(),"String_Node_Str");
  tabs.addTab(new SimulationPanel(),"String_Node_Str");
  tabs.addTab(new PathPanel(),"String_Node_Str");
  tabs.addTab(new ConfigurationPanel(),"String_Node_Str");
}
Program: 42679
Project: 42679
Buggy source:
@Override public void actionPerformed(String topicName,Message m){
  GPSPoseMessage curpose=(GPSPoseMessage)m;
  map.addLineToMap(new LocTuple(curpose.getLatitude(),curpose.getLongitude()),curpose.getHeading(),Color.CYAN,true);
}

Fixed version (ground truth):
@Override public void actionPerformed(String topicName,Message m){
  GPSPoseMessage curpose=(GPSPoseMessage)m;
  map.addLineToMap(new LocTuple(curpose.getLatitude(),curpose.getLongitude()),Math.toRadians(curpose.getHeading()),Color.CYAN,true);
}
Program: 42680
Project: 42680
Buggy source:
/** 
 * Construct a new   {@link GpsPanel}
 */
public GpsPanel(){
  map=new Map();
  map.setBounds(0,0,getWidth(),getHeight());
  directionLine=new MapPolygonImpl(new Coordinate(0,0),new Coordinate(0,0),new Coordinate(0,1));
  gpsSub=new Subscriber(NodeChannel.GPS.getMsgPath(),new MessageListener(){
    @Override public void actionPerformed(    String topicName,    Message m){
      double latitude=((GpsMeasurement)m).getLatitude();
      double longitude=((GpsMeasurement)m).getLongitude();
      map.addPointsToMapTree(Color.BLUE,new LocTuple(latitude,longitude));
      map.updateArrow();
      map.repaint();
      GpsPanel.this.repaint();
    }
  }
);
  new Subscriber(NodeChannel.POSE.getMsgPath(),new MessageListener(){
    @Override public void actionPerformed(    String topicName,    Message m){
      GPSPoseMessage curpose=(GPSPoseMessage)m;
      map.addLineToMap(new LocTuple(curpose.getLatitude(),curpose.getLongitude()),curpose.getHeading(),Color.CYAN,true);
    }
  }
);
  this.add(map);
  map.repaint();
}

Fixed version (ground truth):
/** 
 * Construct a new   {@link GpsPanel}
 */
public GpsPanel(){
  map=new Map();
  map.setBounds(0,0,getWidth(),getHeight());
  destinationPoint=new MapMarkerDot(0.0,0.0);
  map.mapTree.getViewer().addMapMarker(destinationPoint);
  directionLine=new MapPolygonImpl(new Coordinate(0,0),new Coordinate(0,0),new Coordinate(0,1));
  gpsSub=new Subscriber(NodeChannel.GPS.getMsgPath(),new MessageListener(){
    @Override public void actionPerformed(    String topicName,    Message m){
      double latitude=((GpsMeasurement)m).getLatitude();
      double longitude=((GpsMeasurement)m).getLongitude();
      map.addPointsToMapTree(Color.BLUE,new LocTuple(latitude,longitude));
      map.updateArrow();
      map.repaint();
      GpsPanel.this.repaint();
    }
  }
);
  new Subscriber(NodeChannel.POSE.getMsgPath(),new MessageListener(){
    @Override public void actionPerformed(    String topicName,    Message m){
      GPSPoseMessage curpose=(GPSPoseMessage)m;
      map.addLineToMap(new LocTuple(curpose.getLatitude(),curpose.getLongitude()),Math.toRadians(curpose.getHeading()),Color.CYAN,true);
    }
  }
);
  this.add(map);
  map.repaint();
}