机器人刚体动力学由以下方程控制!!!

startup_rvc
mdl_puma560
p560.dyn






提前计算出来这些"disturbance",然后在控制环路中将它"抵消"(有时候也叫前馈控制)

求出所需要的力矩,其中M项代表克服了机械臂的加速度惯量以及不同连杆之间的惯量影响所需力矩、C项代表了克服科里奥利力和离心力所需力矩、G项代表了克服地球引力力矩。
Inverse Dynamics叫做反向动力学,它的作用是输入想要的关节速度(qd)、关节加速度(qdd)、关节角度(q),输出为每个关节所需要的力矩(u)。当然也有正向动力学(forward dynamics),它的作用和反向动力学相反,输入关节角度(q)、关节速度(qd)、每个关节的力矩(u),输出为每个关节的加速度(qdd)
"前馈控制"的例子,它的作用是预先计算出所需的力矩,输入给控制器,"反馈"的存在是为了消除一些误差,例如摩擦力




J=[-sin(q1)-sin(q1+q2) -sin(q1+q2);
cos(q1)+cos(q1+q2) cos(q1+q2)];
d_J=[-dq1*cos(q1)-(dq1+dq2)*cos(q1+q2) -(dq1+dq2)*cos(q1+q2);
-dq1*sin(q1)-(dq1+dq2)*sin(q1+q2) -(dq1+dq2)*sin(q1+q2)];

function torque_out = fcn(u_matrix,q1,q2)
%% Robot Joint and mass parameters
g=9.81;
m1=0.3;
m2=1;
l1=0.2;
l2=0.2;
%% B = M Matrix
B=[ (m1+m2)*l1^2+m2*l2^2+2*m2*l2*l1*cos(q2) (m2*l2^2+m2*l1*l2*cos(q2)) ; (m2*l2^2+m2*l1*l2*cos(q2)) m2*l2^2];
torque_out= B* u_matrix ;
end

C=[-(m2*l1*l2*sin(q2)*(2*q1dot*q2dot+q2dot^2)) ; -m2*l1*l2*sin(q2)*q1dot^2];

G=[(m1+m2)*g*l1*cos(q1)+m2*l2*g*cos(q1+q2) ; +m2*g*l2*cos(q1+q2)];
Minv=[ (m2*l2^2)/(((m1+m2)*l1^2*l2^2*m2)-(m2^2*l1^2*l2^2*cos(q2))) -(m2*l2^2+m2*l1*l2*cos(q2))/(((m1+m2)*l1^2*l2^2*m2)-(m2^2*l1^2*l2^2*cos(q2))) ; -(m2*l2^2+m2*l1*l2*cos(q2))/(((m1+m2)*l1^2*l2^2*m2)-(m2^2*l1^2*l2^2*cos(q2))) ((m1+m2)*l1^2+m2*l2^2+2*m2*l2*l1*cos(q2))/(((m1+m2)*l1^2*l2^2*m2)-(m2^2*l1^2*l2^2*cos(q2)))];
参考文献:
平面2R机器人运动学与动力学建模基于平面2R机器人谈谈运动学和动力学建模的应用https://mp.weixin.qq.com/s/1gQTDHpyUkTMst_OdVFlnw
MATLAB 中的机械臂算法------动力学系列技术文章https://mp.weixin.qq.com/s/opQcpv02sysIcz8seg3lkQ