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
92b88c53
Commit
92b88c53
authored
Feb 16, 2019
by
Jose Ignacio Monreal Bailey
Browse files
Adding method to check that the traffic light id is a valid traffic light
parent
7e29528b
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 @
92b88c53
...
@@ -329,6 +329,24 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -329,6 +329,24 @@ public class TraciSimulationController implements VehicleController, SimulationS
execute
(
definitionCommand
);
execute
(
definitionCommand
);
}
}
@Override
public
boolean
isValidTrafficLightId
(
String
nextTL
)
{
boolean
isValid
=
false
;
SumoCommand
trafficLightCommand
=
Trafficlight
.
getIDList
();
Object
object
=
requestObject
(
trafficLightCommand
);
SumoStringList
trafficLightList
=
(
SumoStringList
)
object
;
for
(
String
trafficLightId
:
trafficLightList
)
{
if
(
trafficLightId
.
equalsIgnoreCase
(
nextTL
))
{
isValid
=
true
;
break
;
}
}
return
isValid
;
}
@Override
@Override
public
String
getDefinition
(
String
trafficLightId
)
{
public
String
getDefinition
(
String
trafficLightId
)
{
SumoCommand
definitionCommand
=
Trafficlight
.
getCompleteRedYellowGreenDefinition
(
trafficLightId
);
SumoCommand
definitionCommand
=
Trafficlight
.
getCompleteRedYellowGreenDefinition
(
trafficLightId
);
...
...
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/xml/XMLSimulationController.java
View file @
92b88c53
package
de.tud.kom.p2psim.impl.topology.movement.vehicular.sumo.simulation.controller.xml
;
package
de.tud.kom.p2psim.impl.topology.movement.vehicular.sumo.simulation.controller.xml
;
import
java.io.FileInputStream
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.xml.parsers.SAXParser
;
import
javax.xml.parsers.SAXParserFactory
;
import
de.tud.kom.p2psim.impl.topology.movement.vehicular.sumo.simulation.controller.VehicleInformationContainer
;
import
de.tud.kom.p2psim.impl.topology.movement.vehicular.sumo.simulation.controller.VehicleInformationContainer
;
import
de.tud.kom.p2psim.impl.topology.movement.vehicular.sumo.simulation.controller.csv.RoadSideUnitInformationHandler
;
import
de.tud.kom.p2psim.impl.topology.movement.vehicular.sumo.simulation.controller.csv.RoadSideUnitInformationHandler
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
...
@@ -24,6 +14,11 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.traf
...
@@ -24,6 +14,11 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.traf
import
de.tudresden.ws.container.SumoTLSController
;
import
de.tudresden.ws.container.SumoTLSController
;
import
de.tudresden.ws.container.SumoTLSProgram
;
import
de.tudresden.ws.container.SumoTLSProgram
;
import
javax.xml.parsers.SAXParser
;
import
javax.xml.parsers.SAXParserFactory
;
import
java.io.FileInputStream
;
import
java.util.*
;
public
class
XMLSimulationController
implements
VehicleController
,
SimulationSetupExtractor
,
Runnable
,
TrafficLightController
{
public
class
XMLSimulationController
implements
VehicleController
,
SimulationSetupExtractor
,
Runnable
,
TrafficLightController
{
private
String
_vehicleDataPath
;
private
String
_vehicleDataPath
;
private
String
_roadSideUnitDataPath
;
private
String
_roadSideUnitDataPath
;
...
@@ -120,6 +115,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet
...
@@ -120,6 +115,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet
}
}
@Override
public
boolean
isValidTrafficLightId
(
String
nextTL
)
{
return
false
;
}
public
VehicleInformationContainer
requestVehicleInformation
(
String
pVehicleID
)
{
public
VehicleInformationContainer
requestVehicleInformation
(
String
pVehicleID
)
{
return
_vehicleDataInformationHandler
.
getVehiclePositions
().
get
(
pVehicleID
);
return
_vehicleDataInformationHandler
.
getVehiclePositions
().
get
(
pVehicleID
);
}
}
...
...
src/de/tud/kom/p2psim/impl/vehicular/trafficlights/DefaultTrafficLightInformationComponent.java
View file @
92b88c53
...
@@ -173,6 +173,11 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
...
@@ -173,6 +173,11 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
controller
.
setCompleteRedYellowGreenDefinition
(
trafficLightId
,
sumoTLSProgram
);
controller
.
setCompleteRedYellowGreenDefinition
(
trafficLightId
,
sumoTLSProgram
);
}
}
@Override
public
boolean
isValidTrafficLightId
(
String
nextTL
)
{
return
controller
.
isValidTrafficLightId
(
nextTL
);
}
@Override
@Override
public
void
initialize
()
{
public
void
initialize
()
{
...
...
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