Roadrunner wrong lane directions and anchors
Show older comments
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
More Answers (0)
Categories
Find more on Scenario Simulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
