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
be5718ff
Commit
be5718ff
authored
Jul 08, 2022
by
Julian Zobel
Browse files
AP: Radius error at init
Movement: after 100 tries just use the location without a distance
parent
c806e8e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/ModularMovementModel.java
View file @
be5718ff
...
...
@@ -49,6 +49,7 @@ import de.tudarmstadt.maki.simonstrator.api.Binder;
import
de.tudarmstadt.maki.simonstrator.api.Event
;
import
de.tudarmstadt.maki.simonstrator.api.EventHandler
;
import
de.tudarmstadt.maki.simonstrator.api.Monitor
;
import
de.tudarmstadt.maki.simonstrator.api.Monitor.Level
;
import
de.tudarmstadt.maki.simonstrator.api.Randoms
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.IAttractionPoint
;
...
...
@@ -265,8 +266,10 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
// Check constraints
if
(!
checkBoundaries
(
destination
))
{
destination
=
null
;
if
(
tries
>
100
)
{
throw
new
AssertionError
(
"Unable to find a valid target destination within <100 tries."
);
if
(
tries
>
100
)
{
Monitor
.
log
(
getClass
(),
Level
.
WARN
,
"Unable to find a valid target destination offset (radius:"
+
apRadius
+
") within <100 tries."
,
newAssignment
);
destination
=
attractionCenter
;
break
;
}
}
tries
++;
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/AttractionPoint.java
View file @
be5718ff
...
...
@@ -67,12 +67,14 @@ public class AttractionPoint extends BasicAttractionPoint {
public
AttractionPoint
(
String
name
,
double
x
,
double
y
,
double
radius
)
{
this
(
name
,
new
PositionVector
(
x
,
y
));
this
.
radius
=
radius
;
this
.
radius
=
radius
;
this
.
setRadius
(
radius
);
}
public
AttractionPoint
(
String
name
,
PositionVector
posVec
,
double
radius
)
{
this
(
name
,
posVec
);
this
.
radius
=
radius
;
this
.
radius
=
radius
;
this
.
setRadius
(
radius
);
}
public
AttractionPoint
(
String
name
,
PositionVector
posVec
,
double
weight
,
double
radius
,
long
pauseTimeMin
,
long
pauseTimeMax
)
{
...
...
@@ -84,10 +86,7 @@ public class AttractionPoint extends BasicAttractionPoint {
this
.
weight
=
weight
;
this
.
radius
=
radius
;
this
.
setPauseTime
(
pauseTimeMin
,
pauseTimeMax
);
if
(
radius
>
0
)
{
this
.
area
=
Math
.
PI
*
Math
.
pow
(
radius
,
2
);
}
this
.
setRadius
(
radius
);
}
@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