Contour of KPI on Driving Path

6 Ansichten (letzte 30 Tage)
Parth Patel
Parth Patel am 26 Jun. 2023
Kommentiert: Parth Patel am 17 Jul. 2023
Hello,
I am working on a reinforcement learning problem in which my agent is learning to regulate a vehicle controller. For validation on road tracks, I want to evaluate the values of my KPI such as lateral acceleration, to demonstrate like at what point on the route the agent falls back in performance than ideal case and where it performs well. So, I want to create a contour plot of the distance or time v/s KPI on road profile as in the attached figure. Such that I can very clearly highlight the value in range across the road. I have imported a driving scenario which is in the format of '.xodr'. Is it possible to create a contour on this road profile with the data of the KPI's already measured?

Antworten (1)

Cyrus Monteiro
Cyrus Monteiro am 13 Jul. 2023
Yes, it is possible to create a contour plot on a road profile using the data of the Key Performance Indicators (KPIs) that you have measured. Here's a general approach to achieve this:
1. Import the road profile from the '.xodr' file and extract the necessary information such as the coordinates of the road points.
2. Measure the KPIs at specific points along the road profile. You can use your vehicle controller or any other method to obtain these measurements.
3. Create a grid of points along the road profile where you want to visualize the contour plot. This grid can be evenly spaced or based on specific intervals depending on your requirements.
4. Interpolate the measured KPI values onto the grid points using interpolation techniques such as linear interpolation or spline interpolation. This will allow you to estimate the KPI values at any point along the road profile.
5. Plot the contour plot using the grid points and the interpolated KPI values. You can use MATLAB's `contour` or `contourf` functions to create the contour plot. Specify the road profile coordinates as the x and y values, and the interpolated KPI values as the z values.
Here's a high-level example of how you can implement these steps:
% Import the road profile from the .xodr file
roadProfile = importRoadProfile('road.xodr');
% Measure the KPIs at specific points along the road profile
kpiValues = measureKPIs(roadProfile);
% Create a grid of points along the road profile
gridPoints = linspace(0, roadProfile.length, 100);
% Interpolate the measured KPI values onto the grid points
interpolatedKPI = interp1(roadProfile.distance, kpiValues, gridPoints);
% Plot the contour plot
contour(roadProfile.distance, gridPoints, interpolatedKPI);
% Add labels and title to the plot
xlabel('Distance along road profile');
ylabel('Grid points');
title('Contour Plot of KPI on Road Profile');
In this example, `importRoadProfile` is a function that imports the road profile from the '.xodr' file and returns the necessary information such as road coordinates and length. `measureKPIs` is a function that measures the KPIs at specific points along the road profile and returns the KPI values. The `interp1` function is used to interpolate the KPI values onto the grid points. Finally, the `contour` function is used to create the contour plot.
You can customize this example to suit your specific requirements and data format. Additionally, you may need to adjust the interpolation method and grid spacing based on your data and visualization preferences.
  1 Kommentar
Parth Patel
Parth Patel am 17 Jul. 2023
Hello,
I appreciate your response.
are 'importRoadProfile' and 'measureKPIs' really inbuilt functions from matlab? I do not find them anywhere else.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Geographic Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by