package nomadgui;

import nomadgui.state.*;

class rpTestThread extends Thread {
  RSPFrame rframe;

  rpTestThread(RSPFrame r) {
    rframe = r;
  }

  public void run() {
    for(float x=0; x<=30; x+=1) {   // Pitch from 0 -> 30 degrees
      rframe.setPitch(x);
      try { Thread.sleep(10); } catch(InterruptedException ie) {}
    }
    for(float x=30; x>=-30; x-=1) { // Pitch from 30 -> -30 degrees
      rframe.setPitch(x);
      try { Thread.sleep(10); } catch(InterruptedException ie) {}
    }
    for(float x=-30; x<=0; x+=1) {  // Pitch from -30 to 0 degrees
      rframe.setPitch(x);
      try { Thread.sleep(10); } catch(InterruptedException ie) {}
    }
    rframe.setPitch(0.0f);
	
    for(float x=0; x<=30; x+=1) {  // Roll from 0 -> 30 degrees
      rframe.setRoll(x);
      try { Thread.sleep(10); } catch(InterruptedException ie) {}
    }
    for(float x=30; x>=-30; x-=1) {  // Roll from 30 -> -30 degrees
      rframe.setRoll(x);
      try { Thread.sleep(10); } catch(InterruptedException ie) {}
    }
    for(float x=-30; x<=0; x+=1) {  // Roll from -30 -> 0 degrees
      rframe.setRoll(x);
      try { Thread.sleep(10); } catch(InterruptedException ie) {}
    }
    rframe.setRoll(0.0f);

    for(float x=0; x<=30; x+=1) {  // Pitch & Roll from 0 -> 30 degrees
      rframe.setRoll(x);
      rframe.setPitch(x);
      try { Thread.sleep(10); } catch(InterruptedException ie) {}
    }
    for(float x=30; x>=-30; x-=1) {  // Pitch & Roll from 30 -> -30 deg.
      rframe.setRoll(x);
      rframe.setPitch(x);
      try { Thread.sleep(10); } catch(InterruptedException ie) {}
    }
    for(float x=-30; x<=0; x+=1) {  // Pitch & Roll from -30 -> 0 degrees
      rframe.setRoll(x);
      rframe.setPitch(x);
      try { Thread.sleep(10); } catch(InterruptedException ie) {}
    }
    rframe.setRoll(0.0f);
    rframe.setPitch(0.0f);
  }
}
