(三)抛物线过渡的线性函数规划

前面说到,无论是三次还是五次多项式进行规划存在以下缺点:

  • 位移往返
  • 没有匀速段

这一节中,我们的研究对象是初速度和末速度都为0关节运动。

一、无过渡线性函数

假设时刻 t t t和角度 θ \theta θ是线性关系,其系数为 v v v,有:
θ ( t ) = v ∗ t \theta(t)=v*t θ(t)=vt
在整一段运动中,其速度恒定为 v v v,假设在这段运动前的速度为 v p r e v_{pre} vpre,如果速度差 Δ v = v − 0 = v ≠ 0 \Delta v=v-0=v\not=0 Δv=v0=v=0,根据加速度计算公式,在一个极短的时间 Δ t \Delta t Δt有:
a = Δ v / Δ t = ∞ a=\Delta v/\Delta t=\infty a=Δv/Δt=

在这里插入图片描述

二、抛物线拟合的线性函数

为了避免端点处加速度的"冲击",在运动的起末两点采用用两段抛物线进行平滑地改变速度大小。记两端待求抛物线的时间为 t b t_b tb,总持续时间为 t t t,加速度为 a a a,速度从零变化到匀速 v v v,起末角为 θ 0 \theta_0 θ0 θ f \theta_f θf,作出关节的角速度曲线:
在这里插入图片描述
红色面积代表运动的角度变化量即 θ f − θ 0 \theta_f-\theta_0 θfθ0,有梯形面积公式有: S r e d = ( t − 2 t b + t ) ⋅ a ⋅ t b / 2 S_{red}=(t-2t_b+t)\cdot a\cdot t_b/2 Sred=(t2tb+t)atb/2,整理得:
a ⋅ t b 2 − a ⋅ t ⋅ t b + θ f − θ 0 = 0 a\cdot t_b^2-a\cdot t\cdot tb+\theta_f-\theta_0=0 atb2attb+θfθ0=0
二次方程有解的条件是: Δ = a 2 t 2 − 4 a ( θ f − θ 0 ) ≥ 0 \Delta=a^2t^2-4a(\theta_f-\theta_0)\ge0 Δ=a2t24a(θfθ0)0,即加速度需要满足 a ≥ 4 ( θ f − θ 0 ) / t 2 a\ge4(\theta_f-\theta_0)/t^2 a4(θfθ0)/t2,对应的解 t b = t / 2 − ( a 2 t 2 − 4 a ( θ f − θ 0 ) ) / 2 a t_b=t/2-\sqrt{(a^2t^2-4a(\theta_f-\theta_0))}/2a tb=t/2(a2t24a(θfθ0)) /2a

三、Matlab验证程序

% Velocity plan according accelerate 
% duration: total time of the motion

function [real_a,line_v,line_duration]=plan(set_a,delta_x,duration)
    while(1)
        min_acc=4*delta_x/(duration^2); %minimun acc
        if set_a<min_acc
            duration=duration+0.5;
            
        else
            real_a=set_a;
            break;
        end
    end
    tb=duration/2-sqrt(real_a^2*duration^2-4*real_a*(delta_x))/(2*real_a);
    line_duration=duration-2*tb;
    line_v=real_a*tb;
end

function x=move(start_x,end_x,ts,te,t,set_a)
    duration=te-ts;
    delta_x=end_x-start_x;
    [real_a,line_v,line_durasion]=plan(set_a,delta_x,duration);
    
    acc_duration=(duration-line_durasion)/2;
    tt=t-ts;
    if tt>=0&&tt<=acc_duration
        dx=1/2*real_a*tt^2;
    elseif tt>acc_duration&&tt<line_durasion+acc_duration
        dx=1/2*real_a*acc_duration^2+line_v*(tt-acc_duration);
    else
        dx=1/2*real_a*acc_duration^2+line_v*line_durasion+(line_v*(tt-acc_duration-line_durasion)-1/2*real_a*(tt-acc_duration-line_durasion)^2);
    end
    x=start_x+dx;
end

clear;
clc;
close all;

ts=5;
te=10;
theta1=5;
theta2=185;

h = figure(1);
axis tight manual % this ensures that getframe() returns a consistent size
filename = 'testAnimated.gif';
for set_a=50:50:1500
    theta=[]
    for t=ts:0.01:te
        theta=[theta,move(theta1,theta2,ts,te,t,set_a)];
    end
   % figure(1);
    t=ts:0.01:te;
    subplot(3,1,1);
    plot(t,theta,'r','LineWidth',1.2);
    ylabel('position')
    subplot(3,1,2);
    plot(t(1:end-1),diff(theta/0.01),'g','LineWidth',1.2);
    ylabel('velocity')
    subplot(3,1,3);
    plot(t(1:end-2),diff(diff(theta/0.01)),'b','LineWidth',1.2);
    ylabel('acceleration') 
    xlabel('time(t/s)')
 
    drawnow
    % Capture the plot as an image
    frame = getframe(h);
    im = frame2im(frame);
    [imind,cm] = rgb2ind(im,256);
    % Write to the GIF File
    if set_a==50
        imwrite(imind,cm,filename,'gif', 'Loopcount',inf);
    else
        imwrite(imind,cm,filename,'gif','WriteMode','append');
    end
end

仿真的结果如下:
在这里插入图片描述

随着加速度的增加,角位移的曲线逐渐变成线性,同时所需要的加速度也随之增加。

总结

为了防止起始和末端点速度的“冲击”,我们在两端添加两段抛物线进行过渡,抛物线加速度有最小值 4 ( θ f − θ 0 ) / t 2 4(\theta_f-\theta_0)/t^2 4(θfθ0)/t2,对于确定的加速度 a a a对应的过渡时间 t b tb tb也相应确定,其大小为: t b = t / 2 − ( a 2 t 2 − 4 a ( θ f − θ 0 ) ) / 2 a t_b=t/2-\sqrt{(a^2t^2-4a(\theta_f-\theta_0))}/2a tb=t/2(a2t24a(θfθ0)) /2a,相对于多项式插补,梯形规划方式既有匀速段且位置没有往返。


[1] M. G , Rodd. Introduction to robotics: Mechanics and control: John J. Craig[J]. Automatica, 1987.

  • 5
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值