资源简介

本资源提供自己创作的机器人焊接轨迹规划matlab仿真相关代码,包括直线焊接、圆弧点焊、空间移动等功能,提供10余个m文件,可供直接建立功能调用使用

资源截图

代码片段和文件信息

function [ p ] = calcCircleMotGlobalParameter( pmArcWelding )
%UNtitleD2 Summary of this function goes here
%   Detailed explanation goes here
quatFstPoint = angle2quat(mArcWelding.axisposPointS(4)mArcWelding.axisposPointS(5)mArcWelding.axisposPointS(6));
quatMidPoint = angle2quat(mArcWelding.axisposPointM(4)mArcWelding.axisposPointM(5)mArcWelding.axisposPointM(6));
quatEndPoint = angle2quat(mArcWelding.axisposPointE(4)mArcWelding.axisposPointE(5)mArcWelding.axisposPointE(6));

%%  这里好像有问题,当画整圆时候就变成不画了
if abs(abs(mArcWelding.lrArcRotatedDegreeSigned) - 2*pi) < 0.0001
    tmpDot = 0;
    angle1st = 0; 
    angle2nd = 0;
    circleOrientAngle = 0;
else
    %%  计算前两个姿态间夹角
    tmpDot = quatFstPoint(1)*quatMidPoint(1) + quatFstPoint(2)*quatMidPoint(2) + quatFstPoint(3)*quatMidPoint(3) + quatFstPoint(4)*quatMidPoint(4);
    if tmpDot > 1
        angle1st = 0;
    elseif tmpDot < -1
            angle1st = 360;
    else
            angle1st = 2 * acos(tmpDot) * 180/pi;
    end
    if abs(angle1st) < 0.0001
        angle1st = 0;
    end
    %%  计算后两个姿态间的夹角
    tmpDot = quatEndPoint(1)*quatMidPoint(1) + quatEndPoint(2)*quatMidPoint(2) + quatEndPoint(3)*quatMidPoint(3) + quatEndPoint(4)*quatMidPoint(4);
    if tmpDot >= 1
        angle2nd = 0;
    else if tmpDot <= -1
            angle2nd = 360;
        else
            angle2nd = 2*acos(tmpDot) *180/pi;
        end
    end
    if abs(angle2nd) < 0.0001
        angle2nd = 0;
    end
    circleOrientAngle = angle1st + angle2nd;
    %%  将姿态角度赋给P变量
    p.arrCirclePhyPara(15) = circleOrientAngle;
    
    %%  分发加减速规划算法
    p = IssueAccDecTime(pmArcWelding);
end
end

%%  速度加速度分发算法
function [ p ] = IssueAccDecTime( pmArcWelding )
if ~mArcWelding.bWelding
    p= AccDecNormalTime(pmArcWelding);
else
    switch mArcWelding.nWeldingMode
        case 0
            p = AccDecArcWeldingModeTime0(pmArcWelding);
          
        case 1
            p = AccDecArcWeldingModeTime1(pmArcWelding);
            
        case 2
            p = AccDecArcWeldingModeTime2(pmArcWelding);
            
        case 3
            p = AccDecArcWeldingModeTime3(pmArcWelding);
           
        case 4
            p = AccDecArcWeldingModeTime4(pmArcWelding);
            
        otherwise
            p = AccDecArcWeldingModeTime0(pmArcWelding);
    end
end
           
end

%%  正常状态下
function [ p ] = AccDecNormalTime( pmArcWelding )
%%  2.1先计算圆弧位置运动所需时间
circleVConstPos = p.lrVelIn;
circleAccPos = p.lrAccIn;
circleDecPos = p.lrDecIn;
posTimeSpan = calculateNormalMoveTime(p.arrCirclePhyPara(5)circleAccPoscircleVConstPoscircleDecPos);

%%  2.2再计算直线姿态运动所需时间
circleVConstOrient = p.lrVelOri;
circleAccOrient = p.lrAccOri;
circleDecOrient = p.lrDecOri;
orientTimeSpan = calculateNormalMoveTime(p.arrCirclePhyPara(15)circleAccOrientcircleVConstOrientcircleDecOrient);

%%  2.3统筹位置和姿态运动各段时间
if (sum(posTimeSpan) >= sum(orientTimeSpan))
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       9687  2018-10-16 15:35  Arc\calcCircleMotGlobalParameter.m

     文件       5683  2018-10-15 17:11  Arc\circleOrientInterp.m

     文件       2269  2018-10-16 14:32  Arc\circlePosInterp.m

     文件      13260  2018-10-16 08:30  Arc\GetSixAnglesIK.m

     文件      11067  2018-10-23 15:52  Arc\InvArc.m

     文件       2838  2018-10-16 14:33  Arc\IssueCalculateNextPos.m

     文件       1217  2018-09-07 10:58  Arc\IssueVel.m

     文件        436  2018-10-16 14:40  Arc\MoveArc.m

     文件       4872  2018-10-22 16:54  Arc\m_CalcCirCenterRadius.m

     文件        322  2018-10-22 17:43  Arc\test.m

     文件         95  2018-10-22 17:38  Arc\try.m

     目录          0  2019-08-27 20:03  Arc

----------- ---------  ---------- -----  ----

                51746                    12


评论

共有 条评论