Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1.  
  2. import java.util.ArrayList;
  3. import java.util.Timer;
  4. import java.util.TimerTask;
  5.  
  6. /*
  7. * To change this license header, choose License Headers in Project Properties.
  8. * To change this template file, choose Tools | Templates
  9. * and open the template in the editor.
  10. */
  11.  
  12. /**
  13. *
  14. * @author Sandra
  15. */
  16. public class ScenarioDroneControl implements DronePosition {
  17.  
  18. // hat das hier ne droneposition, oder brauchen wir die von irgendeinem dronenmodell?
  19. private DroneControl dControl;
  20. private DroneActorPositionAdapter adapter;
  21. int x= 0;
  22. Timer timer;
  23.  
  24. public ScenarioDroneControl(double[] position, double[] direction, World worldi){
  25. dControl = new SimpleARDroneModel(position, direction, worldi);
  26. adapter = new DroneActorPositionAdapter(position,direction, worldi);
  27.  
  28.  
  29.  
  30. TimerTask task = new TimerTask() {
  31.  
  32.  
  33.  
  34. public void run(){
  35. System.out.println("Wir sind bei: " +x);
  36.  
  37.  
  38. if(x!=5){
  39. dControl.start();
  40. dControl.move(0.0,0.0,10.0,2.0,0.0); //irgendwas nur als Test
  41. }
  42. x++;
  43. if (x==5) {
  44. dControl.land();
  45. timer.cancel();
  46.  
  47. }
  48. }
  49. };
  50.  
  51. timer = new Timer();
  52. timer.schedule(task, 1000, 3000); //start nach 1 sek, dann alle 3 sek eine Meldung
  53. }
  54.  
  55. public double[] getDronePosition(){
  56. ArrayList<Actor> a = adapter.getActors();
  57. return a.get(0).getPosition();
  58. }
  59.  
  60. public double[] getDroneDirection(){
  61. ArrayList<Actor> a = adapter.getActors();
  62. return a.get(0).getDirection();
  63. }
  64.  
  65.  
  66.  
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement