Commit 3c3a6d77 authored by Maciej Żurad's avatar Maciej Żurad
Browse files

Adding disappearing target, prob. model needs improv

parent 6c9ba00c
Pipeline #338 skipped
......@@ -42,3 +42,13 @@ UAVs,Run,nbScannedCells,NbNeverScannedCells,NbCellsOlderThanThreshold,avgNbScans
10,30,35.35,25.24,61.68,54.29,74.52,1.94,85.16,77.14,220.0,92.04,122.0,3436.44,6377.05,26571.0,0.0
UAVs,Run,nbScannedCells,NbNeverScannedCells,NbCellsOlderThanThreshold,avgNbScans,stdNbScans,nbConnectedComponents,GiantConnectedComponent,nbUAVConnectedToBase,nbDetection,% of first time detection,nbMessagesSent,avgTargetTimeTracked - ms,avgTargetTime(UnTracked - ms,BestTargetTimeTracked - ms,avgPredictionAccurarcy - %
10,30,38.6,25.38,58.37,53.4,68.4,2.06,82.56,76.12,213.0,92.65,135.0,2720.82,7124.1,26623.0,0.0
UAVs,Run,nbScannedCells,NbNeverScannedCells,NbCellsOlderThanThreshold,avgNbScans,stdNbScans,nbConnectedComponents,GiantConnectedComponent,nbUAVConnectedToBase,nbDetection,% of first time detection,nbMessagesSent,avgTargetTimeTracked - ms,avgTargetTime(UnTracked - ms,BestTargetTimeTracked - ms,avgPredictionAccurarcy - %,mapCoverageSpeed
10,30,38.77,21.31,57.9,52.7,63.01,2.06,83.12,80.2,204.0,93.47,83.0,2849.15,7931.99,29030.0,0.0
UAVs,Run,nbScannedCells,NbNeverScannedCells,NbCellsOlderThanThreshold,avgNbScans,stdNbScans,nbConnectedComponents,GiantConnectedComponent,nbUAVConnectedToBase,nbDetection,% of first time detection,nbMessagesSent,avgTargetTimeTracked - ms,avgTargetTime(UnTracked - ms,BestTargetTimeTracked - ms,avgPredictionAccurarcy - %,mapCoverageSpeed
10,30,37.64,29.61,59.22,54.15,77.23,2.08,80.52,73.88,191.0,93.27,121.0,2827.95,8676.46,27109.0,0.0
UAVs,Run,nbScannedCells,NbNeverScannedCells,NbCellsOlderThanThreshold,avgNbScans,stdNbScans,nbConnectedComponents,GiantConnectedComponent,nbUAVConnectedToBase,nbDetection,% of first time detection,nbMessagesSent,avgTargetTimeTracked - ms,avgTargetTime(UnTracked - ms,BestTargetTimeTracked - ms,avgPredictionAccurarcy - %,mapCoverageSpeed
10,30,38.19,26.19,58.67,53.06,66.45,2.14,80.34,76.33,239.0,92.04,139.0,2840.61,6890.56,48093.0,0.0
UAVs,Run,nbScannedCells,NbNeverScannedCells,NbCellsOlderThanThreshold,avgNbScans,stdNbScans,nbConnectedComponents,GiantConnectedComponent,nbUAVConnectedToBase,nbDetection,% of first time detection,nbMessagesSent,avgTargetTimeTracked - ms,avgTargetTime(UnTracked - ms,BestTargetTimeTracked - ms,avgPredictionAccurarcy - %,mapCoverageSpeed
10,30,37.1,24.55,59.62,53.79,68.01,2.0,82.19,74.9,241.0,94.08,157.0,2588.3,7616.43,26006.0,0.0
UAVs,Run,nbScannedCells,NbNeverScannedCells,NbCellsOlderThanThreshold,avgNbScans,stdNbScans,nbConnectedComponents,GiantConnectedComponent,nbUAVConnectedToBase,nbDetection,% of first time detection,nbMessagesSent,avgTargetTimeTracked - ms,avgTargetTime(UnTracked - ms,BestTargetTimeTracked - ms,avgPredictionAccurarcy - %,mapCoverageSpeed
10,30,35.75,28.2,61.47,53.66,68.71,1.9,87.2,84.9,207.0,92.24,84.0,134966.43,228699.86,9032809.0,0.0
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -54,6 +54,17 @@ abstract public class AbstractTarget {
*/
protected int detectionCounter;
/**
* Visibility of the drone
* If the drone disappeared, it cannot be detected even if it's in range
*/
protected boolean visibility;
/**
* Is the target able to suddenly disappear?
*/
protected boolean disapperingTargetModel = false;
/**
* Time a target is tracked
*/
......@@ -72,6 +83,7 @@ abstract public class AbstractTarget {
private long maxTimeForShortlyLost = 500;
// //////////////////////////////////////////////////////////////////////
/**
......@@ -95,6 +107,8 @@ abstract public class AbstractTarget {
this.untrackedTime = new ArrayList<Long>();
predictedInformationList = new ArrayList<PredictedInformation>();
predictionSimilarityList = new ArrayList<Integer>();
this.visibility = true;
}
......@@ -148,7 +162,12 @@ abstract public class AbstractTarget {
/**
* The action of the local decision after the movement
*/
abstract protected void localActionBeforeMove();
protected void localActionBeforeMove() {
if (disapperingTargetModel && rand.nextFloat() > 0.9)
visibility = false;
else
visibility = true;
}
/*********************************************
*
......@@ -547,4 +566,17 @@ abstract public class AbstractTarget {
this.isLost(0);
}
}
public boolean isVisible() {
return visibility;
}
public void setVisible(boolean visibility) {
this.visibility = visibility;
}
public void setDisapperingTargetModel(boolean disapperingTargetModel) {
this.disapperingTargetModel = disapperingTargetModel;
}
}
......@@ -253,16 +253,17 @@ public class TargetDiscreteMovement extends AbstractTarget {
*/
@Override
protected void localActionBeforeMove() {
double currentX = this.getAuto().getCurrentStatus()
.getCurrentPosition().getX();
double currentY = this.getAuto().getCurrentStatus()
.getCurrentPosition().getY();
if (nextPoint != null && nextPoint.getX() == currentX
&& currentY == nextPoint.getY()) {
this.currentPoint = nextPoint;
newDestination();
} else if (nextPoint == null)
newDestination();
super.localActionBeforeMove();
double currentX = this.getAuto().getCurrentStatus()
.getCurrentPosition().getX();
double currentY = this.getAuto().getCurrentStatus()
.getCurrentPosition().getY();
if (nextPoint != null && nextPoint.getX() == currentX
&& currentY == nextPoint.getY()) {
this.currentPoint = nextPoint;
newDestination();
} else if (nextPoint == null)
newDestination();
}
}
......@@ -281,27 +281,28 @@ public class TargetManhattanMovement extends AbstractTarget {
*/
@Override
protected void localActionBeforeMove() {
// React on corner points to select a new direction
double coordX = auto.getCurrentStatus().getPositionX();
double coordY = auto.getCurrentStatus().getPositionY();
if (coordX == nextCorner.getX() && coordY == nextCorner.getY()) {
int x = -1;
int y = -1;
if (coordX % manhattanGrid.getBoxWidth() == 0
&& coordY % manhattanGrid.getBoxHeight() == 0) {
x = (int) (coordX / manhattanGrid.getBoxWidth());
y = (int) (coordY / manhattanGrid.getBoxHeight());
}
String currentCorner = x + "," + y;
if (!currentCorner.equals(lastCorner)
&& manhattenHashMap.containsKey(currentCorner)) {
lastCorner = currentCorner;
newManhattanChoice(manhattenHashMap.get(currentCorner));
}
}
super.localActionBeforeMove();
// React on corner points to select a new direction
double coordX = auto.getCurrentStatus().getPositionX();
double coordY = auto.getCurrentStatus().getPositionY();
if (coordX == nextCorner.getX() && coordY == nextCorner.getY()) {
int x = -1;
int y = -1;
if (coordX % manhattanGrid.getBoxWidth() == 0
&& coordY % manhattanGrid.getBoxHeight() == 0) {
x = (int) (coordX / manhattanGrid.getBoxWidth());
y = (int) (coordY / manhattanGrid.getBoxHeight());
}
String currentCorner = x + "," + y;
if (!currentCorner.equals(lastCorner)
&& manhattenHashMap.containsKey(currentCorner)) {
lastCorner = currentCorner;
newManhattanChoice(manhattenHashMap.get(currentCorner));
}
}
}
/**
......
......@@ -116,10 +116,12 @@ public class TargetRandomMovement extends AbstractTarget {
*/
@Override
protected void localActionBeforeMove() {
if (this.isCurrentlyTracked())
newRandomChoice();
else if (getTime() == getDecisionFrequency())
newRandomChoice();
super.localActionBeforeMove();
if (this.isCurrentlyTracked())
newRandomChoice();
else if (getTime() == getDecisionFrequency())
newRandomChoice();
}
}
......@@ -28,7 +28,7 @@ public abstract class AbstractAutopilot {
protected AbstractSimulationArea area;
protected Random rand;
// //////////////////////////////////////////////////////////////////////
/**
......@@ -52,7 +52,7 @@ public abstract class AbstractAutopilot {
/*********************************************
*
* High-level methods of the autopilot to update the status
* High-level methods qof the autopilot to update the status
*
********************************************/
......@@ -247,10 +247,6 @@ public abstract class AbstractAutopilot {
return trajectory;
}
public void test() {
}
/**
* Returns the last point in the trajectory going from the current position
* to the given destination in nbSimulation Steps
......@@ -373,5 +369,5 @@ public abstract class AbstractAutopilot {
public AbstractSimulationArea getArea() {
return area;
}
}
......@@ -14,6 +14,8 @@ import org.uav.status.Status;
*/
public class TargetGraphRepresentation {
public enum TargetRepresentationType {TRACKED, UNTRACKED, INVISIBLE};
protected Node mainNode;
protected int id;
private int bodyLength;
......@@ -37,13 +39,20 @@ public class TargetGraphRepresentation {
* @param s
* an instance of {@link Status}
*/
public void refreshPositionOnGraph(Status s, boolean currentlyTracked) {
if (currentlyTracked)
mainNode.changeAttribute("ui.class", "important");
else
mainNode.changeAttribute("ui.class", "unimportant");
public void refreshPositionOnGraph(Status s, TargetRepresentationType type) {
switch(type) {
case TRACKED:
mainNode.changeAttribute("ui.class", "important");
break;
case UNTRACKED:
mainNode.changeAttribute("ui.class", "unimportant");
break;
case INVISIBLE:
mainNode.changeAttribute("ui.class", "invisible");
break;
}
double moveX = Math.cos(s.getHeadingValue()) * this.bodyLength;
double moveY = Math.sin(s.getHeadingValue()) * this.bodyLength;
......
......@@ -47,7 +47,7 @@ abstract public class AbstractUAV {
*/
private MovingDirection direction = null;
private Position lastPosition = null;
// //////////////////////////////////////////////////////////////////////
/**
......
......@@ -147,9 +147,12 @@ public class AbstractUAVFollowing extends AbstractUAVConnectedCoverage {
* If the target is in the coverage area and still not important
* (Not tracked)
*/
boolean detected = coverageArea.isTargetInsideArea(targetPos.getX(),targetPos.getY());
boolean visible = simulation.t[k].isVisible();
if (simulation.t[k].getFollowedByUAV() == null
&& coverageArea.isTargetInsideArea(targetPos.getX(),
targetPos.getY())) {
&& detected && visible) {
target = simulation.t[k];
/**
......@@ -203,26 +206,29 @@ public class AbstractUAVFollowing extends AbstractUAVConnectedCoverage {
* If the target is in the coverage area and still not important
* (Not tracked)
*/
if (coverageArea.isTargetInsideArea(targetPos.getX(),
targetPos.getY())
&& simulation.t_g[k].getMainNode().getAttribute(
"ui.class") == "unimportant"
|| simulation.t_g[k].getMainNode().getAttribute(
"ui.class") == null) {
target = simulation.t[k];
/**
* Check if the observed target is different from the UAV's
* target
*/
if (target.getTargetId() != this.getObservedTarget()
.getTargetId()) {
/**
* Announce the neighbour UAV's
*/
this.sendTargetNotControllable(new TargetInformation(
target, TargetParameter.TargetNotControllable));
}
boolean detected = coverageArea.isTargetInsideArea(targetPos.getX(),targetPos.getY());
boolean visible = simulation.t[k].isVisible();
if (detected && visible &&
(simulation.t_g[k].getMainNode().getAttribute("ui.class") == "unimportant"
|| simulation.t_g[k].getMainNode().getAttribute("ui.class") == null)
)
{
target = simulation.t[k];
/**
* Check if the observed target is different from the UAV's
* target
*/
if (target.getTargetId() != this.getObservedTarget()
.getTargetId()) {
/**
* Announce the neighbour UAV's
*/
this.sendTargetNotControllable(new TargetInformation(
target, TargetParameter.TargetNotControllable));
}
}
}
}
......
Supports Markdown
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