Commit ccc05c50 authored by Julian Zobel's avatar Julian Zobel
Browse files

UAV placement and registration of the base component to UAVs

parent 25e1ab23
...@@ -26,11 +26,14 @@ import de.tud.kom.p2psim.api.common.SimHost; ...@@ -26,11 +26,14 @@ import de.tud.kom.p2psim.api.common.SimHost;
import de.tud.kom.p2psim.api.topology.Topology; import de.tud.kom.p2psim.api.topology.Topology;
import de.tud.kom.p2psim.api.topology.movement.MovementModel; import de.tud.kom.p2psim.api.topology.movement.MovementModel;
import de.tud.kom.p2psim.api.topology.placement.PlacementModel; import de.tud.kom.p2psim.api.topology.placement.PlacementModel;
import de.tudarmstadt.maki.simonstrator.api.component.overlay.OverlayComponent;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint; import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location;
public class BaseTopologyComponent extends AbstractTopologyComponent { public class BaseTopologyComponent extends AbstractTopologyComponent {
private OverlayComponent baseOverlayComponent;
public BaseTopologyComponent(SimHost host, Topology topology, public BaseTopologyComponent(SimHost host, Topology topology,
MovementModel movementModel, PlacementModel placementModel, MovementModel movementModel, PlacementModel placementModel,
boolean registerAsInformationProviderInSiS) { boolean registerAsInformationProviderInSiS) {
...@@ -74,6 +77,11 @@ public class BaseTopologyComponent extends AbstractTopologyComponent { ...@@ -74,6 +77,11 @@ public class BaseTopologyComponent extends AbstractTopologyComponent {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public void setOverlayComponent(OverlayComponent component) {
this.baseOverlayComponent = component;
}
public OverlayComponent getBaseComponent() {
return baseOverlayComponent;
}
} }
...@@ -30,8 +30,8 @@ import de.tud.kom.p2psim.impl.topology.util.PositionVector; ...@@ -30,8 +30,8 @@ import de.tud.kom.p2psim.impl.topology.util.PositionVector;
public class UAVBasePlacement implements PlacementModel { public class UAVBasePlacement implements PlacementModel {
private static LinkedList<UAVTopologyComponent> uavs = new LinkedList<>(); public static LinkedList<UAVTopologyComponent> uavs = new LinkedList<>();
private static BaseTopologyComponent base; public static BaseTopologyComponent base;
private static double baseX, baseY; private static double baseX, baseY;
......
...@@ -574,12 +574,7 @@ public class PositionVector implements Location { ...@@ -574,12 +574,7 @@ public class PositionVector implements Location {
* Calculates the angle using atan2 - this implies that the first * Calculates the angle using atan2 - this implies that the first
* two dimensions in your vector are the plane you are interested * two dimensions in your vector are the plane you are interested
* in. * in.
*/ */
System.out.println("dest is " + t);
System.out.println("y vec dif " + (t.getEntry(1) - this.getEntry(1)));
System.out.println("x vec dif " + (t.getEntry(0) - this.getEntry(0)));
return (float) Math.atan2(t.getEntry(1) - this.getEntry(1), return (float) Math.atan2(t.getEntry(1) - this.getEntry(1),
t.getEntry(0) - this.getEntry(0)); t.getEntry(0) - this.getEntry(0));
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment