-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
2 changes: 2 additions & 0 deletions
2
tests/complex/traci/pythonApi/moveToXY/multi_lane_sublane/input_routes.rou.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<routes> | ||
</routes> |
1 change: 1 addition & 0 deletions
1
tests/complex/traci/pythonApi/moveToXY/multi_lane_sublane/options.complex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tests/complex/traci/pythonApi/moveToXY/multi_lane_sublane/runner.py |
8 changes: 8 additions & 0 deletions
8
tests/complex/traci/pythonApi/moveToXY/multi_lane_sublane/output.complex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Retrying in 1 seconds | ||
2.0 lane=SC_0 right=[], [] left=[], [] accel=0.0 nextTLS=('C', 10, 71.95, 'G') leader=None | ||
3.0 lane=SC_0 right=[], [] left=['stay', 'strategic'], ['stay', 'strategic'] accel=10.0 nextTLS=('C', 10, 61.95, 'G') leader=None | ||
4.0 lane=SC_0 right=[], [] left=['stay', 'strategic'], ['stay', 'strategic'] accel=0.0 nextTLS=('C', 10, 51.95, 'G') leader=None | ||
5.0 lane=SC_1 right=[], [] left=['stay', 'strategic'], ['stay', 'strategic'] accel=7.1054273576e-15 nextTLS=('C', 10, 41.949999999999996, 'G') leader=None | ||
6.0 lane=SC_1 right=['right', 'strategic', 'urgent'], ['right', 'strategic', 'urgent'] left=[], [] accel=-1.42108547152e-14 nextTLS=('C', 10, 31.950000000000003, 'G') leader=None | ||
7.0 lane=SC_1 right=['right', 'strategic', 'urgent'], ['right', 'strategic', 'urgent'] left=[], [] accel=2.13162820728e-14 nextTLS=('C', 10, 21.94999999999999, 'G') leader=None | ||
8.0 lane=SC_1 right=['right', 'strategic', 'urgent'], ['right', 'strategic', 'urgent'] left=[], [] accel=-2.84217094304e-14 nextTLS=('C', 10, 11.950000000000003, 'G') leader=None |
85 changes: 85 additions & 0 deletions
85
tests/complex/traci/pythonApi/moveToXY/multi_lane_sublane/runner.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo | ||
# Copyright (C) 2008-2019 German Aerospace Center (DLR) and others. | ||
# This program and the accompanying materials | ||
# are made available under the terms of the Eclipse Public License v2.0 | ||
# which accompanies this distribution, and is available at | ||
# http://www.eclipse.org/legal/epl-v20.html | ||
# SPDX-License-Identifier: EPL-2.0 | ||
|
||
# @file runner.py | ||
# @author Jakob Erdmann | ||
# @date 2017-01-23 | ||
# @version $Id$ | ||
|
||
|
||
from __future__ import print_function | ||
from __future__ import absolute_import | ||
import os | ||
import sys | ||
|
||
if 'SUMO_HOME' in os.environ: | ||
tools = os.path.join(os.environ['SUMO_HOME'], 'tools') | ||
sys.path.append(tools) | ||
else: | ||
sys.exit("please declare environment variable 'SUMO_HOME'") | ||
|
||
import traci # noqa | ||
import sumolib # noqa | ||
|
||
sumoBinary = os.environ["SUMO_BINARY"] | ||
PORT = sumolib.miscutils.getFreeSocketPort() | ||
cmd = [sumoBinary, | ||
'-n', 'input_net2.net.xml', | ||
'--lateral-resolution', '0.8', | ||
'--no-step-log', | ||
# '-S', '-Q', | ||
] | ||
|
||
ANGLE_UNDEF = traci.constants.INVALID_DOUBLE_VALUE | ||
INVALID = traci.constants.INVALID_DOUBLE_VALUE | ||
|
||
vehID = "v0" | ||
|
||
|
||
def check(x, y, angle, exLane, exPos, exPosLat, comment): | ||
traci.vehicle.moveToXY(vehID, "", angle, x, y) | ||
traci.simulationStep() | ||
x2, y2 = traci.vehicle.getPosition(vehID) | ||
lane2 = traci.vehicle.getLaneID(vehID) | ||
pos2 = traci.vehicle.getLanePosition(vehID) | ||
posLat2 = traci.vehicle.getLateralLanePosition(vehID) | ||
if (abs(x - x2) > 0.1 or | ||
abs(y - y2) > 0.1 or | ||
(exLane != lane2 and exLane is not None) or | ||
(exPos is not None and abs(exPos - pos2) > 0.1) or | ||
(exPosLat is not None and abs(exPosLat - posLat2) > 0.1)): | ||
print(comment, ("failed: x=%s, x2=%s, y=%s, y2=%s, lane=%s, lane2=%s, pos=%s, pos2=%s " + | ||
"posLat=%s posLat2=%s") % (x, x2, y, y2, exLane, lane2, exPos, pos2, exPosLat, posLat2)) | ||
else: | ||
# (comment, "success") | ||
pass | ||
print(traci.simulation.getTime(), | ||
" lane=%s" % lane2, | ||
# " route=%s" % str(traci.vehicle.getRoute(vehID)), | ||
" right=%s, %s" % traci.vehicle.getLaneChangeStatePretty(vehID, -1), | ||
" left=%s, %s" % traci.vehicle.getLaneChangeStatePretty(vehID, 1), | ||
" accel=%s" % traci.vehicle.getAcceleration(vehID), | ||
" nextTLS=%s" % traci.vehicle.getNextTLS(vehID), | ||
" leader=%s" % traci.vehicle.getLeader(vehID, 500), | ||
) | ||
|
||
|
||
traci.start(cmd) | ||
traci.simulationStep() | ||
traci.route.add("SE", ["SC", "CE"]) | ||
traci.vehicle.add(vehID, "SE") | ||
check(104.95, 20, ANGLE_UNDEF, None, None, None, "correct lane") | ||
check(104.95, 30, ANGLE_UNDEF, None, None, None, "correct lane") | ||
check(104.95, 40, ANGLE_UNDEF, None, None, None, "correct lane") | ||
check(101.65, 50, ANGLE_UNDEF, None, None, None, "correct lane") | ||
check(101.65, 60, ANGLE_UNDEF, None, None, None, "correct lane") | ||
check(101.65, 70, ANGLE_UNDEF, None, None, None, "correct lane") | ||
check(101.65, 80, ANGLE_UNDEF, None, None, None, "correct lane") | ||
traci.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters