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
46aee7f6
Commit
46aee7f6
authored
Jul 05, 2017
by
Tobias Meuser
Browse files
Fixed bug preventing rerouting on internal edges
parent
58641b7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/traci/TraciSimulationController.java
View file @
46aee7f6
...
...
@@ -290,21 +290,42 @@ public class TraciSimulationController implements VehicleController, SimulationS
return
new
ArrayList
<>(
map
.
keySet
());
}
public
RoadNetworkEdge
getCurrentEdge
(
String
pVehicleID
)
{
obtainRoadNetwork
();
SumoCommand
roadIDCommand
=
Vehicle
.
getRoadID
(
pVehicleID
);
String
currentRoadID
=
(
String
)
requestObject
(
roadIDCommand
);
RoadNetworkEdge
edge
=
_roadNetwork
.
getEdge
(
currentRoadID
);
while
(
edge
.
isInternal
())
{
if
(
edge
.
getAccessibleEdges
().
size
()
==
1
)
{
edge
=
edge
.
getAccessibleEdges
().
get
(
0
);
}
else
{
break
;
}
}
return
edge
;
}
@Override
public
RoadNetworkRoute
getCurrentRoute
(
String
pVehicleID
)
{
obtainRoadNetwork
();
SumoCommand
routeCommand
=
Vehicle
.
getRoute
(
pVehicleID
);
Object
object
=
requestObject
(
routeCommand
);
SumoStringList
streetList
=
(
SumoStringList
)
object
;
SumoCommand
roadIDCommand
=
Vehicle
.
getRoadID
(
pVehicleID
);
String
currentRoadID
=
(
String
)
requestObject
(
roadIDCommand
);
RoadNetworkEdge
currentEdge
=
getCurrentEdge
(
pVehicleID
);
obtainRoadNetwork
();
if
(
currentEdge
==
null
)
{
return
null
;
}
List
<
RoadNetworkEdge
>
streets
=
new
ArrayList
<>();
boolean
add
=
false
;
for
(
String
street
:
streetList
)
{
if
(
street
.
equals
(
current
RoadID
))
{
if
(
street
.
equals
(
current
Edge
.
getEdgeID
()
))
{
add
=
true
;
}
if
(
add
)
{
...
...
@@ -314,9 +335,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
if
(
streets
.
size
()
==
0
)
{
for
(
String
street
:
streetList
)
{
streets
.
add
(
_roadNetwork
.
getEdge
(
street
));
}
return
new
RoadNetworkRoute
(
new
ArrayList
<>());
}
return
new
RoadNetworkRoute
(
streets
);
...
...
@@ -418,6 +437,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
public
RoadNetworkRoute
findNewRoute
(
String
pVehicle
)
throws
NoAdditionalRouteAvailableException
{
List
<
RoadNetworkRoute
>
routes
=
new
ArrayList
<>();
RoadNetworkRoute
route
=
getCurrentRoute
(
pVehicle
);
if
(
route
.
getRoute
().
isEmpty
())
{
return
null
;
}
routes
.
add
(
route
);
RoadNetworkRoute
findRoute
=
_algorithm
.
findRoute
(
_roadNetwork
,
route
.
getStart
(),
route
.
getDestination
(),
routes
);
if
(
findRoute
==
null
)
{
...
...
@@ -431,6 +455,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
if
(
pKeepDestination
)
{
List
<
RoadNetworkRoute
>
routes
=
new
ArrayList
<>();
RoadNetworkRoute
route
=
getCurrentRoute
(
pVehicle
);
if
(
route
.
getRoute
().
isEmpty
())
{
return
null
;
}
routes
.
add
(
route
);
RoadNetworkRoute
findRoute
=
_algorithm
.
findRoute
(
_roadNetwork
,
route
.
getStart
(),
route
.
getDestination
(),
routes
,
pEdgesToAvoid
);
...
...
@@ -440,6 +469,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
return
findRoute
;
}
else
{
RoadNetworkRoute
route
=
getCurrentRoute
(
pVehicle
);
if
(
route
.
getRoute
().
isEmpty
())
{
return
null
;
}
List
<
RoadNetworkEdge
>
routeList
=
route
.
getRoute
();
RoadNetworkEdge
lastEdge
=
null
;
...
...
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