车辆轨迹跟踪画出小车


前言

使MATLAB出的图里有车辆轮廓

一、车辆是什么?

阿克曼转向的车辆

二、使用步骤

1.

输入车辆中心坐标和航向角

newfile

function [x,y] = plot_Car(x,y,fi)
L=4;
H=1.6;
d=0.5*(L^2+H^2)^0.5;
a=atan(H/L);
x1=[x+d*cos(fi-a),y+d*sin(fi-a)];
x2=[x+d*cos(fi+a),y+d*sin(fi+a)];
x3=[x+d*cos(fi-a+pi),y+d*sin(fi-a+pi)];
x4=[x+d*cos(fi+a+pi),y+d*sin(fi+a+pi)];
X=[x1(1),x2(1),x3(1),x4(1),x1(1)];
Y=[x1(2),x2(2),x3(2),x4(2),x1(2)];
plot(X,Y);
end

2.

当要画出轨迹图时就可以调用上面的函

clear ;
close all ;
clc ;


dt=.1;
%基线
t=0:dt:60;
path(:,1)=t;
path(:,2)=10*sin(0.1*t);
path(:,3)=atan(cos(0.1*t));

figure(1);  

v = VideoWriter('newfile.avi');
open(v)
for i=1:length(path)
 
   plot(path(:,1),path(:,2),'k');
   hold on
   lunk(i,:)=plot_Car(path(i,1),path(i,2),path(i,3));   
    
    axis ([0 60   -30 30]);  
   
    pause(0.01);
    
    hold off
F(i) = getframe;
 
    
end
writeVideo(v,F);
close(v);

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值