Load Map text file with X and Y coordinates, want to plot those coordinates and plot the vehicle dimensions inside the plot
조회 수: 10 (최근 30일)
이전 댓글 표시
MATLAB Version 9.7 (R2019b)
Hi,
working on an automonous vehicle project, where the vehicle will drive through the plotted area in the text file.
i have a text file with X and Y coordinates (M1_layout.txt), have the dimensions of a vehicle which will drive through the X and Y coordinates.
I Want to plot out a figure of X & Y coordinates (with dots or crosses), also to add the vehicle inside that plot as it will be driving through the X and Y coordinates.
So far i know how to load the text file, parse the text file and when attempting to plot the text file getting a blank figure.
M-file script code:
dx_snr = 0.0; % Longitudinal distance between the center of the vehicle and the t antenna center point
dy_snr= 2.125; % Lateral distance between the center of the vehicle and the t antenna center point
nominalR = 0.75; % Nominal wheel radius
dx_wheel = 3.85; % longitudinal distance of the wheel centre
dy_wheel = 2.266; % lateral distance of the wheel from centre
t_map ='M1_layout.txt';
Map = GroundMap();
Map.LoadMap( t_map );
MS = NurbsSet;
RS = MS.Route;
L = RS.Size;
%% Display T Map
me = Map.Export();
nn = length(me);
map_pos = reshape([me.pos],2,nn)';
figure('Name','T Map Locations');
plot(map_pos(:,1),map_pos(:,2),'r.'); %X axis is all column 1, Y axis all column 2, red dots
axis equal;
for ii = 1:L
NN = RS.GetMotion(ii);
pos = NN.GetPose(s);
hold on;
plot(pos(:,1),pos(:,2),'b-'); % X axis is all column 1, Y axis all column 2, blue dash
hold off;
end
답변 (1개)
KSSV
2021년 6월 17일
T = readtable('M1_layout.txt') ;
pos = [T.(2) T.(3)] ;
plot(pos(:,1),pos(:,2),'.r')
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Antenna Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!