Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
e68ebafa
Commit
e68ebafa
authored
Nov 11, 2020
by
Julian Zobel
Browse files
Logging for crash. Provide the return location instead the base location
parent
75a053f5
Changes
1
Show whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/component/UAVTopologyComponent.java
View file @
e68ebafa
...
...
@@ -39,6 +39,7 @@ import de.tud.kom.p2psim.impl.energy.models.AbstractEnergyModel;
import
de.tud.kom.p2psim.impl.topology.placement.UAVBasePlacement
;
import
de.tud.kom.p2psim.impl.topology.util.PositionVector
;
import
de.tudarmstadt.maki.simonstrator.api.Monitor
;
import
de.tudarmstadt.maki.simonstrator.api.Monitor.Level
;
import
de.tudarmstadt.maki.simonstrator.api.component.ComponentNotAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.overlay.OverlayComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.IAttractionPoint
;
...
...
@@ -175,10 +176,14 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
if
(
this
.
position
.
getAltitude
()
!=
0
)
{
this
.
setState
(
UAVstate
.
CRASHED
);
PositionVector
l
=
getCurrentLocation
();
l
.
setAltitude
(
0
);
this
.
updateCurrentLocation
(
l
);
uavOverlayComponent
.
shutdown
();
shutdownCommunication
();
Monitor
.
log
(
this
.
getClass
(),
Level
.
WARN
,
"[UAVTopologyComponent] UAV "
+
getUAVComponent
().
getHost
().
getId
()
+
" crashed at "
+
getRealPosition
(),
""
);
}
else
{
this
.
setState
(
UAVstate
.
OFFLINE
);
}
...
...
@@ -244,6 +249,7 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
@Override
public
void
setTargetLocationRoute
(
LinkedList
<
PositionVector
>
route
,
ReachedLocationCallback
cb
)
{
if
(!
isActive
())
return
;
LinkedList
<
PositionVector
>
positionvectorlist
=
new
LinkedList
<>();
for
(
Location
loc
:
route
)
{
positionvectorlist
.
add
(
new
PositionVector
(
loc
));
...
...
@@ -275,7 +281,7 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
return
state
;
}
private
PositionVector
get
Over
BaseLocation
()
{
private
PositionVector
getBase
Return
Location
()
{
PositionVector
locationOverBase
=
baseLocation
.
clone
();
locationOverBase
.
setAltitude
(
10
);
...
...
@@ -284,13 +290,16 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
@Override
public
void
returnToBase
(
double
velocity
,
ReachedLocationCallback
cb
)
{
if
(!
isActive
())
return
;
movement
.
setTargetVelocity
(
velocity
);
movement
.
setTargetLocation
(
get
Over
BaseLocation
(),
cb
);
movement
.
setTargetLocation
(
getBase
Return
Location
(),
cb
);
}
@Override
public
boolean
landAtBase
(
BaseConnectionCallback
cb
)
{
if
(
overBaseLocation
())
{
if
(!
isActive
())
return
false
;
if
(
isOverBaseLocation
())
{
this
.
setState
(
UAVstate
.
RETURN
);
ReachedLocationCallback
landedCallback
=
new
ReachedLocationCallback
()
{
...
...
@@ -312,13 +321,13 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
@Override
public
boolean
startFromBase
(
ReachedLocationCallback
cb
)
{
if
(
this
.
getCurrentLocation
().
equals
(
this
.
getB
aseLocation
()
)
if
(
this
.
getCurrentLocation
().
equals
(
b
aseLocation
)
&&
state
==
UAVstate
.
BASE_CONNECTION_READY
&&
activate
())
{
disconnectFromBase
();
movement
.
setTargetVelocity
(
movement
.
getVerticalAscentMaxVelocity
());
movement
.
setTargetLocation
(
get
Over
BaseLocation
(),
cb
);
movement
.
setTargetLocation
(
getBase
Return
Location
(),
cb
);
return
true
;
}
...
...
@@ -326,9 +335,9 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
}
private
boolean
o
verBaseLocation
()
{
if
(
this
.
getCurrentLocation
().
getX
()
==
this
.
getB
aseLocation
()
.
getX
()
&&
this
.
getCurrentLocation
().
getY
()
==
this
.
getB
aseLocation
()
.
getY
())
{
private
boolean
isO
verBaseLocation
()
{
if
(
this
.
getCurrentLocation
().
getX
()
==
b
aseLocation
.
getX
()
&&
this
.
getCurrentLocation
().
getY
()
==
b
aseLocation
.
getY
())
{
return
true
;
}
else
return
false
;
...
...
@@ -439,7 +448,7 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
@Override
public
PositionVector
getBaseLocation
()
{
return
base
Location
.
clone
();
return
getBaseReturn
Location
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment