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
27422176
Commit
27422176
authored
Apr 24, 2018
by
ZZFTT7
Browse files
changes to enable getVehicleHeading
parent
aeac2c26
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/traci/TraciSimulationController.java
View file @
27422176
...
...
@@ -44,6 +44,7 @@ import de.tudresden.ws.container.SumoLink;
import
de.tudresden.ws.container.SumoLinkList
;
import
de.tudresden.ws.container.SumoPosition2D
;
import
de.tudresden.ws.container.SumoStringList
;
import
edu.emory.mathcs.backport.java.util.Collections
;
import
it.polito.appeal.traci.SumoTraciConnection
;
/**
...
...
@@ -145,6 +146,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
return
_positons
.
get
(
pVehicleID
).
getPosition
();
}
@Override
public
double
getVehicleHeading
(
String
pVehicleID
)
{
return
_positons
.
get
(
pVehicleID
).
getHeading
();
}
@Override
public
Location
getVehiclePosition
(
double
pStep
,
String
pVehicleID
)
{
if
(
pStep
==
_step
)
{
...
...
@@ -743,6 +749,8 @@ public class TraciSimulationController implements VehicleController, SimulationS
public
List
<
Location
>
getLaneShape
(
String
pLaneID
)
{
List
<
Location
>
positions
=
new
ArrayList
<>();
boolean
set
=
true
;
SumoCommand
laneShapeCommand
=
Lane
.
getShape
(
pLaneID
);
SumoGeometry
geometry
=
(
SumoGeometry
)
requestObject
(
laneShapeCommand
);
for
(
SumoPosition2D
location
:
geometry
.
coords
)
{
...
...
@@ -751,11 +759,17 @@ public class TraciSimulationController implements VehicleController, SimulationS
}
else
{
if
(
_startX
<=
location
.
x
&&
location
.
x
<=
_endX
&&
_startY
<=
location
.
y
&&
location
.
y
<=
_endY
)
{
positions
.
add
(
new
PositionVector
(
location
.
x
-
_startX
,
location
.
y
-
_startY
));
}
else
{
set
=
true
;
}
}
}
return
positions
;
if
(
set
)
{
return
positions
;
}
else
{
return
Collections
.
emptyList
();
}
}
@Override
...
...
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/xml/XMLSimulationController.java
View file @
27422176
...
...
@@ -210,4 +210,9 @@ public class XMLSimulationController implements VehicleController, SimulationSet
return
_vehicleDataInformationHandler
.
getVehiclePositions
().
get
(
pVehicleID
).
getSpeed
();
}
@Override
public
double
getVehicleHeading
(
String
pVehicleID
)
{
return
_vehicleDataInformationHandler
.
getVehiclePositions
().
get
(
pVehicleID
).
getHeading
();
}
}
src/de/tud/kom/p2psim/impl/vehicular/DefaultVehicleInformationComponent.java
View file @
27422176
/*
* Copyright (c) 2005-2010 KOM
–
Multimedia Communications Lab
* Copyright (c) 2005-2010 KOM Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
...
...
@@ -87,6 +87,32 @@ public class DefaultVehicleInformationComponent implements VehicleInformationCom
});
siSComponent
.
provide
().
nodeState
(
SiSTypes
.
HEADING
,
new
SiSDataCallback
<
Double
>()
{
@Override
public
Double
getValue
(
INodeID
pNodeID
,
SiSProviderHandle
pProviderHandle
)
throws
InformationNotAvailableException
{
if
(
pNodeID
==
getHost
().
getId
())
{
if
(
isValid
())
{
return
controller
.
getVehicleHeading
(
vehicleID
);
}
}
return
null
;
}
@Override
public
Set
<
INodeID
>
getObservedNodes
()
{
return
INodeID
.
getSingleIDSet
(
getHost
().
getId
());
}
@Override
public
SiSInfoProperties
getInfoProperties
()
{
return
new
SiSInfoProperties
();
}
});
if
(
pRouteKnown
)
{
siSComponent
.
provide
().
nodeState
(
SiSTypes
.
ROUTE
,
new
SiSDataCallback
<
RoadNetworkRoute
>()
{
...
...
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