Contenu principal

adjustHeight

Adjust height of waypoints in trajectory object to match road height

Since R2025a

Description

adjustHeight(trajectory,rrMap) adjusts the height of the waypoints in the input trajectory object trajectory to match the height of the road in the input RoadRunner HD Map rrMap.

adjustHeight(trajectory,rrApp) adjusts the height of the waypoints in the input trajectory object trajectory to match the height of the road in the scene associated with the input RoadRunner application rrApp.

adjustHeight(trajectory,scenario) adjusts the height of the waypoints in the input trajectory object trajectory to match the height of the road in the input driving scenario scenario.

heightAdjustedTrajectory = adjustHeight(___) returns the height-adjusted Trajectory object heightAdjustedTrajectory using any combination of the input arguments from the previous syntaxes. The syntax does not update the trajectory in the input trajectory object trajectory.

Note

This function requires the Scenario Builder for Automated Driving Toolbox™ support package. You can install the Scenario Builder for Automated Driving Toolbox support package from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

example

Examples

collapse all

Load a MAT file containing an ego trajectory object and a RoadRunner HD Map object into the workspace.

load("adjustHeightData.mat","egoTrajectory","rrHDMap")

Display the trajectory in the loaded trajectory object overlaid on the road network in the loaded RoadRunner HD Map object.

plot(rrHDMap)
hold on
plot3(egoTrajectory.Position(:,1),egoTrajectory.Position(:,2),egoTrajectory.Position(:,3),"ro-")
hold off
legend("Lanes","Lane Boundaries","Raw Trajectory")

Adjust the height of the waypoints in the loaded trajectory object to match the height of the road in the loaded RoadRunner HD Map object.

heightAdjustedTrajectory = adjustHeight(egoTrajectory,rrHDMap);
Warning: Duplicate data points have been detected and removed - corresponding values have been averaged.

Display the raw trajectory and the height adjusted trajectory.

figure
plot3(egoTrajectory.Position(:,1),egoTrajectory.Position(:,2),egoTrajectory.Position(:,3),"ro-")
hold on
plot3(heightAdjustedTrajectory.Position(:,1),heightAdjustedTrajectory.Position(:,2),heightAdjustedTrajectory.Position(:,3),"bo-")
hold off
legend("Raw Trajectory","Height Adjusted Trajectory")
xlabel("X-axis")
ylabel("Y-axis")
zlabel("Z-axis")

Input Arguments

collapse all

Trajectory data, specified as a Trajectory object.

RoadRunner HD Map road data model, specified as a roadrunnerHDMap object. rrMap defines a simple data structure to represent road layouts using lanes, lane boundaries, lane markings, and junctions. This object provides functions that support reading, writing, and plotting HD map data.

RoadRunner application associated with a project, specified as a roadrunner object. This object provides functions for performing common RoadRunner tasks such as opening, closing, and saving scenes and projects. rrApp provides functions that support importing data from files and exporting scenes to other formats from RoadRunner.

Driving scenario, specified as a drivingScenario object.

Output Arguments

collapse all

Height-adjusted trajectory data, returned as a Trajectory object.

Version History

Introduced in R2025a