Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Adding a stopped vehicle outside the network and setting a route

Hello,
1) I consider the current behavior of moveToXY as a bug: https://github.com/eclipse/sumo/issues/5383
2) you could temporarily set the vehicles vClass to "ignoring" so it can move across the intervening lanes. The tricky part is to figure out when to reset this so it doesn't drive along bicycle lanes the whole way
3) A better workaround would be to use a feature from the latest development version to determine the initial lane. You can call function traci.simulation.convertRoad(x, y, vClass="passenger") with the new vClass argument to find the closest allowed lane and then use traci.vehicle.moveTo(vehID, laneID) for the inial positioning.

regards,
Jakob

Am Mi., 27. März 2019 um 13:22 Uhr schrieb shawnaustin <shawnaustin685@xxxxxxxxx>:
Hi all,

I am a beginner using Sumo via libsumo/C++ and TraCI/Python for testing. I
am trying to add a stopped vehicle at a user-provided position, and later on
assign a route to a user-provided edge to that vehicle. Here is a minimal
code example:

# add a vehicle
traci.vehicle.add(vehID=vehicle_id, routeID="", typeID="veh_passenger")

# call until a route is provided:
traci.vehicle.moveToXY(vehicle_id, "", 0, initial_x, initial_y, keepRoute=0)

# once the target edge is provided:
edge = traci.vehicle.getRoadID(vehicle_id)
route = traci.simulation.findRoute(edge, target_edge)
traci.route.add(route_id, route.edges)
traci.vehicle.setRouteID(vehicle_id, route_id)

This seems to work fine when the initial position is on the road network.
When the initial position is outside the network or on a non-permitted lane,
the vehicle may get positioned on a non-permitted lane (e.g. a sidewalk).
Then when a route is set the vehicle is unable to reach the main network and
eventually gets teleported.

How would you recommend to handle this case? Is there any way to position
the vehicle initially on the nearest permitted lane? Or somehow allow it to
reach a permitted lane by driving (e.g. by crossing a sidewalk and a bike
lane)?

Thank you,
Shawn



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top