3 Star 6 Fork 1

涂志明 / UGV-Path-Tracking-Algorithm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
calc_nearest_point.m 831 Bytes
一键复制 编辑 原始数据 按行查看 历史
NUDT_UGV_GROUP 提交于 2020-04-30 16:12 . add all files
function [error, target_index] = calc_nearest_point(Reference, Vehicle_State)
cx = Reference.cx;cy = Reference.cy;cyaw = Reference.cyaw;s = Reference.s;
x = Vehicle_State(1);y = Vehicle_State(2);Odometer = Vehicle_State(4);
sequence = find(abs(s-Odometer)<5);
distance = sqrt((cx(sequence)-x).^2 + (cy(sequence)-y).^2);
[~,minindex] = min(distance);
target_index = minindex + sequence(1)-1;
theta_path = cyaw(target_index);
path_vector = [cos(theta_path+pi/2) sin(theta_path+pi/2)];
ref_point = [cx(target_index) cy(target_index)];
error = dot(ref_point-[x,y],path_vector);
% p0 = Vehicle_State(1:3);
% p1 = [cx(target_index),cy(target_index),cyaw(target_index)];
% p2 = [cx(target_index+1),cy(target_index+1),cyaw(target_index+1)];
% ref_point = calc_proj_pose(p0,p1,p2);
Matlab
1
https://gitee.com/zhi_ming_tu/UGV-Path-Tracking-Algorithm.git
git@gitee.com:zhi_ming_tu/UGV-Path-Tracking-Algorithm.git
zhi_ming_tu
UGV-Path-Tracking-Algorithm
UGV-Path-Tracking-Algorithm
master

搜索帮助