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
be48ff82
Commit
be48ff82
authored
Jun 04, 2019
by
Julian Zobel
Browse files
Config Attraction Point gegerator
parent
32541a7c
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/aerial/SimpleMulticopterMovement.java
View file @
be48ff82
...
...
@@ -76,26 +76,7 @@ public class SimpleMulticopterMovement implements UAVMovementModel {
@Override
public
void
move
(
long
timeBetweenMovementOperations
)
{
if
(
false
)
{
System
.
out
.
println
(
hoverThrustRequired
());
System
.
out
.
println
(
motor
.
getMaxThrust
());
System
.
out
.
println
(
horizontalMaxVelocity
());
for
(
int
i
=
0
;
i
<=
horizontalMaxVelocity
();
i
++)
{
double
J
=
motor
.
estimatePowerConsumptionWatt
(
estimateRequiredThrust
(
i
));
System
.
out
.
println
(
"v = "
+
i
+
" ==> "
+
J
+
" J => "
+
((
topologyComponent
.
getMaximumBatteryCapacity
()
/
Battery
.
uJconverison
)
/
J
/
60
)
+
" minutes"
);
}
first
=
false
;
}
if
(
motor
.
isOn
()
&&
!
route
.
isEmpty
())
{
PositionVector
position
=
new
PositionVector
(
topologyComponent
.
getRealPosition
());
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/BasicAttractionPoint.java
View file @
be48ff82
...
...
@@ -2,6 +2,7 @@ package de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction;
import
de.tud.kom.p2psim.impl.topology.util.PositionVector
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint
;
import
de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor
;
/**
* A basic attraction point, as simple as it can get. Really just a named location
...
...
@@ -18,7 +19,11 @@ public class BasicAttractionPoint extends PositionVector implements AttractionPo
this
.
name
=
name
;
}
@XMLConfigurableConstructor
({
"name"
,
"x"
,
"y"
})
public
BasicAttractionPoint
(
String
name
,
double
x
,
double
y
)
{
this
(
name
,
new
PositionVector
(
x
,
y
));
}
@Override
public
String
getName
()
{
return
name
;
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/ConfigAttractionGenerator.java
View file @
be48ff82
...
...
@@ -19,10 +19,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
;
/**
...
...
@@ -33,15 +30,14 @@ import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Attraction
*/
public
class
ConfigAttractionGenerator
implements
IAttractionGenerator
{
private
final
List
<
AttractionPoint
>
points
=
new
LinkedList
<>();
@Override
public
List
<
AttractionPoint
>
getAttractionPoints
()
{
return
p
oints
;
return
attractionP
oints
;
}
public
void
setAttractionPoint
(
AttractionPoint
point
)
{
this
.
p
oints
.
add
(
point
);
attractionP
oints
.
add
(
point
);
}
}
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/CsvAttractionGenerator.java
View file @
be48ff82
...
...
@@ -47,7 +47,7 @@ public class CsvAttractionGenerator implements IAttractionGenerator {
private
final
String
SEP
=
";"
;
private
List
<
AttractionPoint
>
attractionPoints
;
private
double
radius
=
0
;
/**
*
...
...
@@ -58,12 +58,17 @@ public class CsvAttractionGenerator implements IAttractionGenerator {
this
.
worldDimensions
=
Binder
.
getComponentOrNull
(
Topology
.
class
)
.
getWorldDimensions
();
this
.
file
=
placementFile
;
readData
();
}
public
void
setRadius
(
double
radius
)
{
this
.
radius
=
radius
;
}
@Override
public
List
<
AttractionPoint
>
getAttractionPoints
()
{
if
(
attractionPoints
==
null
)
{
attractionPoints
=
new
LinkedList
<>();
if
(
attractionPoints
==
null
)
{
readData
();
}
return
attractionPoints
;
...
...
@@ -93,8 +98,37 @@ public class CsvAttractionGenerator implements IAttractionGenerator {
+
y
);
continue
;
}
attractionPoints
.
add
(
new
AttractionPointImpl
(
"AP"
+
i
,
new
PositionVector
(
x
,
y
)));
AttractionPoint
ap
=
new
AttractionPointImpl
(
"AP"
+
i
,
new
PositionVector
(
x
,
y
));
ap
.
setRadius
(
radius
);
attractionPoints
.
add
(
ap
);
i
++;
entrySuccessfullyRead
=
true
;
}
catch
(
NumberFormatException
e
)
{
// Ignore leading comments
if
(
entrySuccessfullyRead
)
{
// System.err.println("CSV ParseError " + line);
}
}
}
else
if
(
parts
.
length
==
3
)
{
try
{
Double
x
=
Double
.
parseDouble
(
parts
[
0
]);
Double
y
=
Double
.
parseDouble
(
parts
[
1
]);
Double
r
=
Double
.
parseDouble
(
parts
[
2
]);
if
(
x
>
worldDimensions
.
getX
()
||
y
>
worldDimensions
.
getY
()
||
x
<
0
||
y
<
0
)
{
System
.
err
.
println
(
"Skipped entry "
+
x
+
";"
+
y
);
continue
;
}
AttractionPoint
ap
=
new
AttractionPointImpl
(
"AP"
+
i
,
new
PositionVector
(
x
,
y
));
ap
.
setRadius
(
r
);
attractionPoints
.
add
(
ap
);
i
++;
entrySuccessfullyRead
=
true
;
}
catch
(
NumberFormatException
e
)
{
...
...
@@ -104,6 +138,7 @@ public class CsvAttractionGenerator implements IAttractionGenerator {
}
}
}
}
else
{
throw
new
AssertionError
(
"To many columns in CSV."
);
}
...
...
src/de/tud/kom/p2psim/impl/topology/util/PositionVector.java
View file @
be48ff82
...
...
@@ -54,9 +54,9 @@ import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location;
* assertions. Replace does now fully replace the position vector entries. PVs are now
* always at least 3D (with 0 altitude)
*
* - 14.03.2019 Louis Neumann:
a
dded timestamp when creating a PositionVector and adjusted ageOfLocation()
* - 14.03.2019 Louis Neumann:
A
dded timestamp when creating a PositionVector and adjusted ageOfLocation()
*
* -
18.04
.2019
Louis Neumann: added setAgeofLoca
tion
()
* -
04.06
.2019
Julian Zobel: Clone function also clones the timestamp from the cloned posi
tion
.
*
* @author Bjoern Richerzhagen, Julian Zobel, Louis Neumann
* @version 1.2, 10.09.2018
...
...
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