Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Timer;
- import java.util.TimerTask;
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author Sandra
- */
- public class ScenarioDroneControl implements DronePosition {
- // hat das hier ne droneposition, oder brauchen wir die von irgendeinem dronenmodell?
- private DroneControl dControl;
- private DroneActorPositionAdapter adapter;
- int x= 0;
- Timer timer;
- public ScenarioDroneControl(double[] position, double[] direction, World worldi){
- dControl = new SimpleARDroneModel(position, direction, worldi);
- adapter = new DroneActorPositionAdapter(position,direction, worldi);
- TimerTask task = new TimerTask() {
- public void run(){
- System.out.println("Wir sind bei: " +x);
- if(x!=5){
- dControl.start();
- dControl.move(0.0,0.0,10.0,2.0,0.0); //irgendwas nur als Test
- }
- x++;
- if (x==5) {
- dControl.land();
- timer.cancel();
- }
- }
- };
- timer = new Timer();
- timer.schedule(task, 1000, 3000); //start nach 1 sek, dann alle 3 sek eine Meldung
- }
- public double[] getDronePosition(){
- ArrayList<Actor> a = adapter.getActors();
- return a.get(0).getPosition();
- }
- public double[] getDroneDirection(){
- ArrayList<Actor> a = adapter.getActors();
- return a.get(0).getDirection();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement