资源简介

这个代码是做了一个pure control demo,具体的文档见我的博客https://blog.csdn.net/caokaifa/article/details/91376997

资源截图

代码片段和文件信息

function [closestPoint distance] = closestPointOnLine(pt1 pt2 refPt)
    %This function is for internal use only. It may be removed in the future.

    %closestPointOnLine Find a point closest to refPt (i.e. projection point) on line
    % segment between pt1 and pt2. If the projected point is outside line
    % segment then the closest vertex is returned. This function is used in
    % robotics.algs.internal.PurePursuitbase class.

    %   Copyright 2016 The MathWorks Inc.

    %#codegen

    % Don‘t do any computation if points are equal
    if isequal(pt1 pt2)
        closestPoint = pt1;
        distance = norm(refPt-closestPoint);
        return;
    end

    % Vector from pt1 to pt2
    v12 = pt2 - pt1;
    % Vector from refPt to pt2
    vr2 = pt2 - refPt;

    % Projection of the vr2 on v12 normalized by norm(v12)
    alpha = v12*vr2‘/(v12*v12‘);

    % Find the closet point by interpolation
    if alpha > 1
        closestPoint = pt1;
    elseif alpha < 0
        closestPoint = pt2;
    else
        closestPoint = alpha.*pt1 + (1-alpha).*pt2;
    end

    distance = norm(refPt-closestPoint);

end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-06-10 15:43  pure control\
     文件       29657  2019-04-16 17:45  pure control\HelperPathAnalyzer.m
     文件       43394  2019-06-10 15:42  pure control\LateralControlPurePursuit.slx
     文件        5245  2019-06-10 15:43  pure control\LateralControlPurePursuit.slxc
     文件       37245  2019-04-26 11:47  pure control\LateralControlPurePursuitCodeGen.slx
     目录           0  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\
     文件         813  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit.bat
     文件       60206  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit.c
     文件       46758  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit.h
     文件       13123  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit.mk
     文件       29766  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit.obj
     文件         135  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit.rsp
     文件         384  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit_comp.rsp
     文件       30202  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit_data.c
     文件       15573  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit_data.obj
     文件        1924  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit_private.h
     文件           0  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit_ref.rsp
     文件        1977  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\LateralControlPurePursuit_types.h
     文件       39775  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\buildInfo.mat
     文件        1508  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\builtin_typeid_types.h
     文件       18626  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\codeInfo.mat
     文件      820224  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\codedescriptor.dmr
     文件         556  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\compileInfo.mat
     文件         213  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\defines.txt
     文件          78  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\mlEnv.txt
     文件          33  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\modelsources.txt
     文件       17345  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\multiword_types.h
     文件        3323  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\rtGetInf.c
     文件         841  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\rtGetInf.h
     文件        1993  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\rtGetInf.obj
     文件        2300  2019-05-19 15:16  pure control\LateralControlPurePursuit_grt_rtw\rtGetNaN.c
............此处省略670个文件信息

评论

共有 条评论