How to use the roadrunner hdmap junction in matlab?

2 ビュー (過去 30 日間)
Lei
Lei 2025 年 3 月 31 日
編集済み: Zinea 2025 年 4 月 3 日
Hi, I think the same question was ask in 2023 but didn't get answered yet (https://www.mathworks.com/matlabcentral/answers/1909405-how-to-write-a-junction-in-roadrunner-hdmap-using-matlab?s_tid=srchtitle).
I tried to understand the documantation (https://ww2.mathworks.cn/help/driving/ref/roadrunner.hdmap.junction.html#) and create a simple junction by myself. But the juction doesn't show up in the Roadrunner. Can you please help me diagonise which step might be wrong in my example? Thanks!
rrMap = roadrunnerHDMap;
outer1 = [0 0; 4 0; 4 4; 0 4; 0 0];
outer2 = [5 5 0; 7 5 0; 7 7 0; 5 7 0; 5 5 0];
polygon1 = roadrunner.hdmap.Polygon( ...
'ExteriorRing', outer1, ...
'InteriorRings', {} ...
);
polygon2 = roadrunner.hdmap.Polygon( ...
'ExteriorRing', outer2, ...
'InteriorRings', {} ...
);
multiPoly = roadrunner.hdmap.MultiPolygon( ...
'Polygons', [polygon1;] ...
);
rrMap.Junctions(1) = roadrunner.hdmap.Junction(ID="Junction1", Geometry=multiPoly)

回答 (1 件)

Zinea
Zinea 2025 年 4 月 3 日
編集済み: Zinea 2025 年 4 月 3 日
Hi @Lei,
The junction is not visible in RoadRunner because a junction is only visible when lanes associated with them are present in the RoadRunnner HD Map. The following code snippet adds a lane alongwith a junction:
rrMap = roadrunnerHDMap;
outer1 = [0 0; 4 0; 4 4; 0 4; 0 0];
outer2 = [5 5 0; 7 5 0; 7 7 0; 5 7 0; 5 5 0];
polygon1 = roadrunner.hdmap.Polygon( ...
'ExteriorRing', outer1, ...
'InteriorRings', {} ...
);
polygon2 = roadrunner.hdmap.Polygon( ...
'ExteriorRing', outer2, ...
'InteriorRings', {} ...
);
multiPoly = roadrunner.hdmap.MultiPolygon( ...
'Polygons', [polygon1;] ...
);
rrMap.Junctions(1) = roadrunner.hdmap.Junction(ID="Junction1", Geometry=multiPoly)
rrMap.Lanes(1) = roadrunner.hdmap.Lane(ID="Lane1", Geometry=[0 0;25 0], LaneType= "Driving", TravelDirection="Forward");
rrMap.LaneBoundaries(2) = roadrunner.hdmap.LaneBoundary(ID="LaneBoundary2",Geometry=[0 2.5; 25 2.5]);
rrMap.LaneBoundaries(1) = roadrunner.hdmap.LaneBoundary(ID="LaneBoundary1",Geometry=[0 -2.5; 25 -2.5]);
rightBoundary(rrMap.Lanes(1),"LaneBoundary1",Alignment="Forward");
leftBoundary(rrMap.Lanes(1),"LaneBoundary2",Alignment="Forward");
rrMap.Junctions(1).Lanes(1) = roadrunner.hdmap.Reference(ID="Lane1");
write(rrMap, "sampleMap.rrhd")
Observe the grey rectangle in the image below which is the junction:
You can refer to the following documentation links for more information:
Hope it helps, best!

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by