Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] TraCIException: MoveToXY vehicle should obtain: edgeID, lane, x, y, angle and optionally keepRouteFlag.

Dear all,

Please I am trying to use Traci's MovetoXY function and I come across this error.

traci.exceptions.TraCIException: MoveToXY vehicle should obtain: edgeID, lane, x, y, angle and optionally keepRouteFlag. I tried implementing the code found in the github repository below but I still get the same error. Could someone please help out? Thank you.

https://github.com/eclipse-sumo/sumo/blob/3ee22d763ebde82ce5f965e4e0b2fc5327251bde/tests/complex/traci/pythonApi/moveToXY/extreme_elevation/runner.py#L48


My code is shown below:

if __name__ == "__main__":
options = get_options()
sumoBinary = '/home/akua/opt/carla-simulator/Co-Simulation/Sumo/examples/sumo-gui'

# traci starts sumo as a subprocess and then this script connects and runs
sumoCmd = [sumoBinary, "-c", "Town05.sumocfg"]
traci.start(sumoCmd, port=8813, label="sim1")
conn1 = traci.getConnection("sim1")
conn1.setOrder(1)
step = 0
while traci.simulation.getMinExpectedNumber() > 0:
conn1.simulationStep()
if step == 2:
phi = 0
pos = traci.vehicle.getPosition("1")
x = pos[0]
y = pos[1]
pos2 = (pos[0] + 2, pos[1])
traci.vehicle.moveToXY('1', "45.0.00", -1, pos2[0], pos2[1], 0, keepRoute=1)
step += 1
conn1.close()

Back to the top