Load Map text file with X and Y coordinates, want to plot those coordinates and plot the vehicle dimensions inside the plot
11 views (last 30 days)
Show older comments
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
2 Comments
Answers (1)
KSSV
on 17 Jun 2021
T = readtable('M1_layout.txt') ;
pos = [T.(2) T.(3)] ;
plot(pos(:,1),pos(:,2),'.r')
2 Comments
See Also
Categories
Find more on Get Started with Antenna Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!