Open j-scharrenbach opened 2 years ago
Could you give me a quick tutorial on how to use set_path
or set_route
? I have a route that is provided in the same way the set_destination
creates a route for Agents, but I can't manage to match the C++ Signature
Could you give me a quick tutorial on how to use
set_path
orset_route
? I have a route that is provided in the same way theset_destination
creates a route for Agents, but I can't manage to match the C++ Signature
Hi Steffen,
I only used the set_route
function, so I only can give you detailed information about this. I use the function like this:
# get your instance of traffic_manager and the corresponding carla_actor
trafficmanager.set_route(carla_actor, ["Left", "Right", "Straight"])
In this case, the actor will turn left on the first intersection, turn right on the second one and then drives straight. Just pass a list with the desired actions to take. You can find all options here.
I also tried the set_path
function once but I don't know for sure if I used it correctly. As far as I remember I did the following:
from carla.libcarla import Location
# get your instance of traffic_manager and the corresponding carla_actor
path = [Location(x=0., y=1., z=0.), Location(x=3., y=4., z=0.)] # add all the points of the desired path to a list of Location() objs
traffic_manager.set_path(carla_actor, path)
I hope this helps!
Edit: As mentioned here remember to enable autopilot before calling both set_route
or set_path
!
Hey @j-scharrenbach, yeah, the docs are a bit being, as those features were just introduced in 0.9.13, and are working to add them.
As for how they work, everything you explains is correct. However, I'd like to add that those aren't meant to be route planners, but directions to take at a given junction. You can either use set_path
with a high level command such as "Left", "Straight"... or set_route
with CARLA locations
I have a problem where the vehicles I spawn do drive by autopilot but don't stick to the applied path, they sometimes even crash into a tree on the sidewalk. Why would CARLA do that? The code is rather simple I think.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi everybody,
not sure if this is on purpose or not. Feel free to close the issue if so.
I was trying to make a car always do a specific maneuver in a scenic scenario. I stumbled accross the
set_path
andset_route
functionality as definined here. Both functions are not mentioned in the Python API reference. It would be nice to add it to the documentation as others will find it more easily.Best regards, Jannik