Commit 615845e5 authored by Julian Zobel's avatar Julian Zobel
Browse files

Get the base location also to application layer

parent e425f862
...@@ -51,6 +51,8 @@ public interface ControllableLocationActuator extends Actuator { ...@@ -51,6 +51,8 @@ public interface ControllableLocationActuator extends Actuator {
public PositionVector getCurrentDirection(); public PositionVector getCurrentDirection();
public PositionVector getBaseLocation();
public void updateCurrentDirection(PositionVector direction); public void updateCurrentDirection(PositionVector direction);
public double getCurrentBatteryLevel(); public double getCurrentBatteryLevel();
......
...@@ -346,6 +346,11 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S ...@@ -346,6 +346,11 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
return movement.estimatePowerConsumption(velocity); return movement.estimatePowerConsumption(velocity);
} }
@Override
public PositionVector getBaseLocation() {
return baseLocation.clone();
}
} }
...@@ -353,17 +353,13 @@ public class SimpleMulticopterMovement implements UAVMovementModel { ...@@ -353,17 +353,13 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
else if(velocity < minimumHorizontalVelocity()) { else if(velocity < minimumHorizontalVelocity()) {
return -1; return -1;
} }
else { else {
// System.out.println("===========================");
double estimateAngle = estimatePitchAngleForVelocity(velocity); double estimateAngle = estimatePitchAngleForVelocity(velocity);
double estimatedDrag = forwardDrag(velocity, estimateAngle); double estimatedDrag = forwardDrag(velocity, estimateAngle);
double requiredThrust = Math.sqrt(hoverThrustRequired() * hoverThrustRequired() + estimatedDrag * estimatedDrag); double requiredThrust = Math.sqrt(hoverThrustRequired() * hoverThrustRequired() + estimatedDrag * estimatedDrag);
double wattage = motor.estimatePowerConsumptionWatt(requiredThrust); double wattage = motor.estimatePowerConsumptionWatt(requiredThrust);
// System.out.println("Motor requires " + wattage + " J/s at velocity " + velocity + " (Thrust: " + requiredThrust + " N, angle = " + Math.toDegrees(estimateAngle) + ", drag = "+ estimatedDrag+" N )");
return wattage; return wattage;
} }
...@@ -440,21 +436,10 @@ public class SimpleMulticopterMovement implements UAVMovementModel { ...@@ -440,21 +436,10 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
nearest = d; nearest = d;
} }
} }
// double n = Math.sqrt(2 * hoverThrustRequired() * Math.tan(Math.toRadians(nearest)) / bodyDrag(Math.toRadians(nearest), new PositionVector(1,0,0)));
//System.out.println("target velocity = " + velocity + " m/s ==> AoA = " + nearest + "° // v_max = " + n + " m/s");
return Math.toRadians(nearest); return Math.toRadians(nearest);
} }
return maxPitchAngle;
return maxPitchAngle; }
}
} }
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