How can I import X, Y data points to driving scenario designer app?

7 次查看(过去 30 天)
Hello,
I am trying to simulate a car's path that is real and its data was collected while it drove. I wanted to take a sample of the data and try out to simulate the path using the desinger app. The problems I faced are that 1- the designer app doesn't provide me enough deceimals which makes the path more like a straight line. Also, I have been inputting points manually. Which proving to be a tedious time consuming task. Would there be a way to fix these two problems allowing me to import data points faster and have more decimals to accurately simulate ?

回答(1 个)

Jinal
Jinal 2023-10-5
Hello Ahmed,
As per my understanding, you wish to directly import the sample data of a car’s path coordinates in “Driving Scenario Designer” App. You also want to be able to provide high precision values for the path coordinates.
A possible workaround for importing car’s path coordinates:
The “readtable” function can be used to create a table for the X-coordinates and Y-coordinates by reading column-oriented data from a text file, spreadsheet file, XML file, HTML file, or a Microsoft Word document. After obtaining the table, its variables can be used to set the trajectory of the vehicle.
Refer to the following sample code to modify exported MATLAB Function of Scenario:
function [scenario, egoVehicle] = LeftTurnScenarioNoSensors(carpathfilename)
T = readtable(carpathfilename,ReadRowNames=true);
...
waypoints = [T.Xcoord, T.Ycoord, zeros(100,1)];
...
end
For more information about creating “Driving Scenario Variations” programmatically please refer the following link:
For more information about “readtable” please refer the following link:
A possible workaround for providing high precision coordinates for car’s path:
The “digits” function can be used to set the precision used by “vpa” to d significant decimal digits. The default precision of “vpa” is 32 digits.
An example code snippet to increase pi’s precision to 100 digits is given below:
digitsOld = digits(100);
pi100 = vpa(pi)
%restore precision value
digits(digitsOld)
For more information about changing variable precision please refer the following link:
I hope this helps resolve your issue.
Best Regards,
Jinal Patel

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by