Commit 4c8daf00 authored by Julian Zobel's avatar Julian Zobel
Browse files

Added optimal speed approximation to UAV movement models

parent 104224ba
......@@ -90,4 +90,6 @@ public interface ControllableLocationActuator extends Actuator {
public double estimatePowerConsumptionWatt(double velocity);
public double estimateFlightDistance(double velocity, double batterylevel, double batterythreshold);
public double estimateOptimalSpeed();
}
......@@ -57,6 +57,7 @@ public interface UAVMovementModel {
* @return The power consumption in W for the given velocity.
*/
public double estimatePowerConsumptionWatt(double velocity);
public double estimateOptimalSpeed();
public void move(long timeBetweenMovementOperations);
......
......@@ -106,7 +106,7 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
}
// retrieve base location
baseLocation = UAVBasePlacement.base.position.clone();
baseLocation = UAVBasePlacement.base.position.clone();
}
public void setState(UAVstate newState) {
......@@ -365,6 +365,10 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
return distance;
}
public double estimateOptimalSpeed() {
return movement.estimateOptimalSpeed();
}
@Override
public PositionVector getBaseLocation() {
return baseLocation.clone();
......
......@@ -70,6 +70,8 @@ public class MulticopterMovement implements UAVMovementModel {
private double maximumPitchAngleAllowed; // ° max angle
private double maximumDecentVelocityAllowed; // m/s
private double optimalVelocity = -1;
// TODO currently not used
private double maximumTurnAngle; // 90° per second turn angle
......@@ -573,4 +575,33 @@ public class MulticopterMovement implements UAVMovementModel {
}
@Override
public double estimateOptimalSpeed() {
if(optimalVelocity == -1) {
double MIN = Double.MAX_VALUE;
double opt = -1;
double min = getHorizontalMinVelocity();
double max = getHorizontalMaxVelocity();
int steps = 50;
double stepsize = ( max-min) / steps;
for (int i = 0; i < steps; i++) {
double speed = min + i * stepsize;
double energyPerMeter = estimatePowerConsumptionWatt(speed) / speed ;
if(energyPerMeter < MIN) {
MIN = energyPerMeter;
opt = speed;
}
}
optimalVelocity = opt;
}
return optimalVelocity;
}
}
......@@ -258,4 +258,9 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
maximumVerticalVelocity, minimumHorizontalVelocity, minimumVerticalVelocity);
}
}
@Override
public double estimateOptimalSpeed() {
return maximumHorizontalVelocity;
}
}
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