@Pigmon
2017-11-06T09:21:36.000000Z
字数 1586
阅读 1621
作业
% ----------------------------
% ex_2_1
% In exercise2-assignment.pdf
% v is vu here
% w is omega here
% r is wheelRadius here
% l is halfWheelbase here
% /Phi(l) and /Phi(r) are LeftWheelVelocity and RightWheelVelocity here
% ----------------------------
LeftWheelVelocity = (vu - halfWheelbase * omega) / wheelRadius;
RightWheelVelocity = (vu + halfWheelbase * omega) / wheelRadius;
输出:
Congratulations! All checks successful, your implementation is most likely correct!
图片:
% exercise2-assignment.pdf 中的 beta
beta = - (lambda + thetag);
beta = normalizeAngle(beta);
...
% ----------------------------
% ex_2_2
% exercise2-assignment.pdf 中的公式 (3) (4)
% ----------------------------
vu = parameters.Krho * rho;% [m/s]
omega = parameters.Kalpha * alpha + parameters.Kbeta * beta;% [rad/s]
起初速度快,接近目标后速度变慢,路径如下:
% ex_2_3
% 1 正向,-1 反向
direction = 1;
if parameters.backwardAllowed && parameters.useConstantSpeed;
% 如果是反向
if abs(alpha) > pi() / 2
% 转方向到 backward
alpha = normalizeAngle(alpha - pi());
beta = normalizeAngle(beta - pi());
direction = -1;
% 更新 omega
omega = parameters.Kalpha * alpha + parameters.Kbeta * beta;
end
% 根据 vu 的缩放调整 omega
omega = omega * (parameters.constantSpeed / vu);
% 常数速度
vu = direction * parameters.constantSpeed;
end
路径与 ex_2_2 一致,匀速接近目标并很快找到目标。路径如下: