Roadrunner wrong lane directions and anchors

3 views (last 30 days)
Hello,
I am trying to simulate a US highway, I80, in Roadrunner and MATLAB. I have drawn the road, of course the driving direction is right side, but when I choose forward direction in lane settings, its reverse, backwards is the correct direction. Also I can't put anchors to the left side of the road, but thats the only part where the extrusions are continuous. My code is as following:
rrApp = roadrunner('I80');
rrApp.openScene("I80.rrscene")
rrApp.openScenario("I80.rrscenario")
rrApi = roadrunnerAPI(rrApp);
scnro = rrApi.Scenario;
prj = rrApi.Project;
sedan = getAsset(prj,"Vehicles/Sedan.fbx","VehicleAsset");
ambulance = getAsset(prj,"Vehicles/Ambulance.fbx","VehicleAsset");
car1 = struct("Speed",40,"Waypoints",[0,0,0; 0,50,0],"Type",sedan);
ambulance1 = struct("Speed",30,"Waypoints",[20,0,0; 20,50,0],"Type",ambulance);
vehicles = {car1, ambulance1};
for i=1:length(vehicles)
vehicle = vehicles{i};
car = addActor(scnro, vehicle.Type, vehicle.Waypoints(1,:));
carPoint = car.InitialPoint;
rrRoute = carPoint.Route;
for j=1+1:size(vehicle.Waypoints,1)
roadPoint = addPoint(rrRoute,vehicle.Waypoints(j,:));
end
end
simulateScenario(rrApp)
I couldn't use anchors.
My final purpose is to simulate few cars, I am going to have the coordinates x and y, where x is the distance in feets to left side of the road and y is the distance to the starting position. I think if I figure out, with your help, how to fix the roads, anchors and how to program a car to follow the left side, I can code the rest.
Thanks in advance.

Accepted Answer

saish
saish on 8 Aug 2025
Edited: saish on 8 Aug 2025
Hello Barbaros,
I was able to reproduce the scene using the files and code provided by you.
The lane direction parameters, "forward" and "backward," are set to a fixed direction relative to the road's baseline.
Since the camera can be moved to any position in the 3D space, the direction notation for "forward" and "backward" remains constant, which may appear incorrect depending on the camera's orientation, as shown in the attached screenshot.
The same applies to the anchor direction, as illustrated in the attached screenshot.
I also tried placing the anchor on the left side in the scene editing tab but encountered the same issue.
To resolve this, you can use the ‘remapAnchor’ MATLAB function.
Please refer to the following code snippet for better understanding where i assumed that we Remap all dependencies from the anchor named "StartPoint" to
a new anchor at position [10, 5, 0]:
>> remapAnchor(rrApp, "StartPoint", [10, 5, 0]);
I have provided the documentation link for your reference.
  2 Comments
Barbaros Teoman Kosoglu
Barbaros Teoman Kosoglu on 8 Aug 2025
While waiting for an answer, I tought maybe automated driving toolbox may be easier, since my main purpose is just to visualize a few second of driving. What do you think for that?
saish
saish on 12 Aug 2025
Yes, the Automated Driving Toolbox can be a good choice if your main goal is to quickly visualize a few seconds of driving with relatively simple scenarios. It provides inbuilt functions for scenario creation and vehicle simulation, and is well suited for low fidelity visualizations.
However, if you require more complex road layouts, detailed environments, or higher fidelity visualizations (e.g., for advanced scenario testing, custom assets, or sensor simulation), RoadRunner would be the better choice.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!