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
9ace5c4c
Commit
9ace5c4c
authored
Jun 09, 2022
by
Julian Zobel
Browse files
Multicopter Movement: Throw Error when calculation is not correct!
parent
c72bf07b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/aerial/StateMulticopterMovement.java
View file @
9ace5c4c
...
...
@@ -28,8 +28,6 @@ import javax.persistence.Column;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
org.apache.logging.log4j.Level
;
import
de.tud.kom.p2psim.api.topology.movement.UAVMovementModel
;
import
de.tud.kom.p2psim.api.uav.MulticopterModel
;
import
de.tud.kom.p2psim.impl.energy.components.ActuatorComponent
;
...
...
@@ -39,7 +37,6 @@ import de.tud.kom.p2psim.impl.util.db.metric.CustomMeasurement;
import
de.tudarmstadt.maki.simonstrator.api.Monitor
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.uavsupport.callbacks.ReachedLocationCallback
;
import
umontreal.ssj.util.BitMatrix.IncompatibleDimensionException
;
/**
* Complex thrust based movement model using specific models of a multicopter UAV for calculation.
...
...
@@ -302,9 +299,7 @@ public class StateMulticopterMovement implements UAVMovementModel {
Monitor
.
log
(
StateMulticopterMovement
.
class
,
Monitor
.
Level
.
WARN
,
"(Horizontal Flight) The Multicopter is not properly aligned to the target. Deviation: "
+
Math
.
toDegrees
(
horizontalAngleToPosition
(
currentTargetPosition
))+
"°"
,
positionVector
);
}
double
v
=
flightVelocity
();
if
(
v
!=
velocityVector
.
getLength
()
&&
Math
.
abs
(
v
-
velocityVector
.
getLength
())
>
MARGIN
)
{
Monitor
.
log
(
StateMulticopterMovement
.
class
,
Monitor
.
Level
.
WARN
,
...
...
@@ -347,6 +342,10 @@ public class StateMulticopterMovement implements UAVMovementModel {
constTime
=
(
double
)
constantPhaseTime
/
Time
.
SECOND
;
constDist
=
constTime
*
v
;
if
(
constDist
>
distanceToTarget
)
{
throw
new
UnsupportedOperationException
(
"Multicopter Movement: The approximated step distance exceeds the distance to the target"
);
}
directionVector
.
normalize
();
// should be valid anyways?
positionVector
=
positionVector
.
plus
(
directionVector
.
scale
(
constDist
));
...
...
@@ -405,6 +404,10 @@ public class StateMulticopterMovement implements UAVMovementModel {
vint
=
0
;
}
if
(
decDist
>
positionVector
.
distanceTo
(
currentTargetPosition
))
{
throw
new
UnsupportedOperationException
(
"Multicopter Movement: The approximated step distance exceeds the distance to the target"
);
}
directionVector
.
normalize
();
// should be valid anyways?
positionVector
=
positionVector
.
plus
(
directionVector
.
scale
(
decDist
));
velocityVector
=
directionVector
.
scale
(
vint
);
...
...
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