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
3f979bff
Commit
3f979bff
authored
Apr 09, 2019
by
Julian Zobel
Browse files
Analyzing TODOs and adaptions in Topology Component / Peerfact ANalyuzer Intertface
parent
fd56073a
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/component/UAVStatisticAnalyzer.java
0 → 100644
View file @
3f979bff
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tud.kom.p2psim.impl.topology.component
;
public
interface
UAVStatisticAnalyzer
{
}
src/de/tud/kom/p2psim/impl/topology/component/UAVTopologyComponent.java
View file @
3f979bff
...
...
@@ -113,6 +113,9 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
public
void
setState
(
UAVstate
newState
)
{
this
.
state
=
newState
;
// TODO analyzer
}
public
void
setUAVComponent
(
OverlayComponent
uavOverlayComponent
)
{
...
...
@@ -145,9 +148,9 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
@Override
public
boolean
isActive
()
{
if
(
actuator
.
isOn
())
if
(
actuator
.
isOn
())
{
return
true
;
else
{
}
else
{
if
(
state
==
UAVstate
.
ACTION
||
state
==
UAVstate
.
RETURN
)
{
this
.
deactivate
();
}
...
...
@@ -158,7 +161,7 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
@Override
public
boolean
activate
()
{
if
(
actuator
.
turnOn
())
{
s
tate
=
UAVstate
.
ACTION
;
this
.
setS
tate
(
UAVstate
.
ACTION
);
return
true
;
}
else
{
...
...
@@ -170,18 +173,15 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
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"
);
if
(
this
.
position
.
getAltitude
()
!=
0
)
{
this
.
setState
(
UAVstate
.
CRASHED
);
uavOverlayComponent
.
shutdown
();
shutdownCommunication
();
}
else
{
state
=
UAVstate
.
OFFLINE
;
}
}
else
{
this
.
setState
(
UAVstate
.
OFFLINE
);
}
return
true
;
}
...
...
@@ -267,8 +267,8 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
}
@Override
public
void
returnToBase
(
ReachedLocationCallback
cb
)
{
this
.
state
=
UAVstate
.
RETURN
;
public
void
returnToBase
(
ReachedLocationCallback
cb
)
{
this
.
s
etS
tate
(
UAVstate
.
RETURN
);
ReachedLocationCallback
returnCallback
=
new
ReachedLocationCallback
()
{
...
...
@@ -284,8 +284,9 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
public
void
batteryReplacement
(
BatteryReplacementCallback
cb
)
{
if
(
state
!=
UAVstate
.
BASE_CONNECTION
)
if
(
state
!=
UAVstate
.
BASE_CONNECTION
)
{
throw
new
UnsupportedOperationException
(
"Cannot recharge if not connected to base!"
);
}
BaseTopologyComponent
base
=
UAVBasePlacement
.
base
;
base
.
getCharger
().
charge
(
this
,
cb
);
...
...
@@ -303,8 +304,7 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
if
(
cb
!=
null
)
cb
.
successfulConnection
();
this
.
state
=
UAVstate
.
BASE_CONNECTION
;
this
.
setState
(
UAVstate
.
BASE_CONNECTION
);
shutdownCommunication
();
}
...
...
@@ -318,7 +318,6 @@ public class UAVTopologyComponent extends AbstractTopologyComponent implements S
if
(
cb
!=
null
)
cb
.
successfulDisconnection
();
this
.
state
=
UAVstate
.
OFFLINE
;
}
private
void
shutdownCommunication
()
{
...
...
src/de/tud/kom/p2psim/impl/topology/movement/aerial/SimpleMulticopterMovement.java
View file @
3f979bff
...
...
@@ -127,8 +127,10 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
if
(
distanceToTargetPosition
<
0.1
||
distanceToTargetPosition
<
currentSpeed
)
{
target
=
route
.
removeFirst
();
if
(
route
.
isEmpty
())
{
if
(
route
.
isEmpty
())
{
// go to hover mode
topologyComponent
.
updateCurrentLocation
(
target
.
clone
());
currentSpeed
=
0
;
...
...
@@ -143,9 +145,16 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
}
else
{
motor
.
requestThrust
(
horizontalMaxVelocityRequiredTotalThrust
());
currentSpeed
=
horizontalMaxVelocity
();
// get to speed
if
(
targetedSpeed
>
0
&&
targetedSpeed
<
horizontalMaxVelocity
())
{
motor
.
requestThrust
(
estimateRequiredThrust
(
targetedSpeed
));
currentSpeed
=
targetedSpeed
;
}
else
{
motor
.
requestThrust
(
horizontalMaxVelocityRequiredTotalThrust
());
currentSpeed
=
horizontalMaxVelocity
();
}
long
timeUntilReachedLocation
=
(
long
)
(
distanceToTargetPosition
/
currentSpeed
)
*
Time
.
SECOND
;
target
=
route
.
getFirst
();
...
...
@@ -193,11 +202,6 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
topologyComponent
.
updateCurrentLocation
(
newPosition
);
}
}
}
...
...
@@ -400,6 +404,23 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
}
private
double
estimateRequiredThrust
(
double
velocity
)
{
if
(
velocity
==
0
)
{
return
motor
.
estimatePowerConsumptionWatt
(
hoverThrustRequired
());
}
else
if
(
velocity
>
horizontalMaxVelocity
())
{
return
-
1
;
}
else
if
(
velocity
<
minimumHorizontalVelocity
())
{
return
-
1
;
}
else
{
double
estimateAngle
=
estimatePitchAngleForVelocity
(
velocity
);
double
estimatedDrag
=
forwardDrag
(
velocity
,
estimateAngle
);
double
requiredThrust
=
Math
.
sqrt
(
hoverThrustRequired
()
*
hoverThrustRequired
()
+
estimatedDrag
*
estimatedDrag
);
return
requiredThrust
;
}
}
/**
* Estimate the pitch angle (angle of attack) required to get the target velocity.
...
...
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