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
465f18d1
Commit
465f18d1
authored
Sep 27, 2018
by
Julian Zobel
Browse files
Static attraction point retrieval from ap generator (hack)
parent
2e075ebb
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/component/UAVTopologyComponent.java
View file @
465f18d1
...
...
@@ -23,6 +23,8 @@ package de.tud.kom.p2psim.impl.topology.component;
import
java.util.LinkedList
;
import
java.util.Set
;
import
org.apache.batik.bridge.AbstractSVGGradientElementBridge.Stop
;
import
de.tud.kom.p2psim.api.common.SimHost
;
import
de.tud.kom.p2psim.api.energy.ComponentType
;
import
de.tud.kom.p2psim.api.energy.EnergyModel
;
...
...
@@ -65,7 +67,7 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
private
ActuatorEnergyComponent
actuator
;
private
RechargeableBattery
battery
;
private
UAVstate
state
;
private
UAVstate
state
=
UAVstate
.
OFFLINE
;
private
PositionVector
baseLocation
;
private
UAVToBaseInterface
controllerInterface
;
...
...
@@ -162,22 +164,20 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
@Override
public
boolean
deactivate
()
{
actuator
.
turnOff
();
if
(
this
.
position
.
getAltitude
()
!=
0
)
{
state
=
UAVstate
.
CRASHED
;
System
.
err
.
println
(
"UAV was destroyed due to actuator deactivation during flight"
);
uavOverlayComponent
.
shutdown
();
for
(
SimNetInterface
net
:
getHost
().
getNetworkComponent
()
.
getSimNetworkInterfaces
())
{
net
.
goOffline
();
}
uavOverlayComponent
.
shutdown
();
shutdownCommunication
();
}
else
{
state
=
UAVstate
.
OFFLINE
;
}
return
true
;
}
...
...
@@ -299,10 +299,14 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
cb
.
successfulConnection
();
this
.
state
=
UAVstate
.
BASE_CONNECTION
;
shutdownCommunication
();
}
@Override
public
void
disconnectFromBase
(
BaseDisconnectedCallback
cb
)
{
startCommunication
();
BaseTopologyComponent
base
=
UAVBasePlacement
.
base
;
base
.
disconnectUAVFromBase
(
controllerInterface
);
...
...
@@ -312,7 +316,14 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
this
.
state
=
UAVstate
.
OFFLINE
;
}
private
void
shutdownCommunication
()
{
for
(
SimNetInterface
net
:
getHost
().
getNetworkComponent
().
getSimNetworkInterfaces
())
net
.
goOffline
();
}
private
void
startCommunication
()
{
for
(
SimNetInterface
net
:
getHost
().
getNetworkComponent
().
getSimNetworkInterfaces
())
net
.
goOnline
();
}
}
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/IAttractionGenerator.java
View file @
465f18d1
...
...
@@ -20,6 +20,7 @@
package
de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction
;
import
java.util.LinkedList
;
import
java.util.List
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint
;
...
...
@@ -32,6 +33,8 @@ import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Attraction
*/
public
interface
IAttractionGenerator
{
public
static
LinkedList
<
AttractionPoint
>
attractionPoints
=
new
LinkedList
<>();
public
List
<
AttractionPoint
>
getAttractionPoints
();
}
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/RandomAttractionGenerator.java
View file @
465f18d1
...
...
@@ -51,8 +51,6 @@ public class RandomAttractionGenerator implements IAttractionGenerator {
private
boolean
numberOfAPsSet
=
false
;
private
List
<
AttractionPoint
>
attractionPoints
;
@XMLConfigurableConstructor
({
"numberOfAttractionPoints"
})
public
RandomAttractionGenerator
(
int
numberOfAttractionPoints
)
{
this
.
rand
=
Randoms
.
getRandom
(
RandomAttractionGenerator
.
class
);
...
...
@@ -64,7 +62,7 @@ public class RandomAttractionGenerator implements IAttractionGenerator {
}
this
.
numberOfAPsSet
=
true
;
this
.
numberOfAttractionPoints
=
numberOfAttractionPoints
;
this
.
attractionPoints
=
new
LinkedList
<
AttractionPoint
>
();
attractionPoints
.
clear
();
createAttractionPoints
();
}
...
...
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