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
d3c9857a
Commit
d3c9857a
authored
Apr 15, 2019
by
Julian Zobel
Browse files
Simple Movement now correctly takes the target speed as input
parent
68fb363a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/aerial/SimpleMulticopterMovement.java
View file @
d3c9857a
...
...
@@ -20,16 +20,11 @@
package
de.tud.kom.p2psim.impl.topology.movement.aerial
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedList
;
import
java.util.Map
;
import
javax.persistence.criteria.CriteriaBuilder.In
;
import
org.apache.commons.math3.geometry.euclidean.twod.Vector2D
;
import
org.joda.time.tz.ZoneInfoProvider
;
import
de.tud.kom.p2psim.api.topology.movement.UAVMovementModel
;
import
de.tud.kom.p2psim.impl.energy.components.StatelessMotorComponent
;
import
de.tud.kom.p2psim.impl.topology.component.UAVTopologyComponent
;
...
...
@@ -51,7 +46,7 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
private
double
currentAngleOfAttack
;
private
double
currentSpeed
;
private
double
target
ed
Speed
;
private
double
targetSpeed
;
private
LinkedList
<
PositionVector
>
route
=
new
LinkedList
<>();
private
Map
<
PositionVector
,
ReachedLocationCallback
>
locationCallbacks
=
new
LinkedHashMap
<>();
// TODO callback interface
...
...
@@ -146,9 +141,9 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
else
{
// get to speed
if
(
target
ed
Speed
>
0
&&
target
ed
Speed
<
horizontalMaxVelocity
())
{
motor
.
requestThrust
(
estimateRequiredThrust
(
target
ed
Speed
));
currentSpeed
=
target
ed
Speed
;
if
(
targetSpeed
>
0
&&
targetSpeed
<
horizontalMaxVelocity
())
{
motor
.
requestThrust
(
estimateRequiredThrust
(
targetSpeed
));
currentSpeed
=
targetSpeed
;
}
else
{
motor
.
requestThrust
(
horizontalMaxVelocityRequiredTotalThrust
());
...
...
@@ -182,8 +177,15 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
else
{
double
timefactor
=
timeBetweenMovementOperations
/
Time
.
SECOND
;
motor
.
requestThrust
(
horizontalMaxVelocityRequiredTotalThrust
());
currentSpeed
=
horizontalMaxVelocity
();
// get to speed
if
(
targetSpeed
>
0
&&
targetSpeed
<
horizontalMaxVelocity
())
{
motor
.
requestThrust
(
estimateRequiredThrust
(
targetSpeed
));
currentSpeed
=
targetSpeed
;
}
else
{
motor
.
requestThrust
(
horizontalMaxVelocityRequiredTotalThrust
());
currentSpeed
=
horizontalMaxVelocity
();
}
PositionVector
directionToTarget
=
new
PositionVector
(
target
);
directionToTarget
.
subtract
(
position
);
...
...
@@ -301,7 +303,7 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
@Override
public
void
setPreferredSpeed
(
double
v_pref
)
{
this
.
target
ed
Speed
=
v_pref
;
this
.
targetSpeed
=
v_pref
;
}
@Override
...
...
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