[关闭]
@Pigmon 2017-11-06T01:21:36.000000Z 字数 1586 阅读 1482

机器人作业2_袁胜_2016M8009073008

作业


练习 2_1

公式推导过程









即 calculateWheelSpeeds.m 中的 LeftWheelVelocity;而 即为 RightWheelVelocity.

calculateWheelSpeeds.m 的 TODO 部分程序:

  1. % ----------------------------
  2. % ex_2_1
  3. % In exercise2-assignment.pdf
  4. % v is vu here
  5. % w is omega here
  6. % r is wheelRadius here
  7. % l is halfWheelbase here
  8. % /Phi(l) and /Phi(r) are LeftWheelVelocity and RightWheelVelocity here
  9. % ----------------------------
  10. LeftWheelVelocity = (vu - halfWheelbase * omega) / wheelRadius;
  11. RightWheelVelocity = (vu + halfWheelbase * omega) / wheelRadius;

运行结果:

输出:

  1. Congratulations! All checks successful, your implementation is most likely correct!

图片:
ex2_1.png-50.7kB

练习 2_2

calculateControlOutput.m 中增加的程序

  1. % exercise2-assignment.pdf 中的 beta
  2. beta = - (lambda + thetag);
  3. beta = normalizeAngle(beta);
  4. ...
  5. % ----------------------------
  6. % ex_2_2
  7. % exercise2-assignment.pdf 中的公式 (3) (4)
  8. % ----------------------------
  9. vu = parameters.Krho * rho;% [m/s]
  10. omega = parameters.Kalpha * alpha + parameters.Kbeta * beta;% [rad/s]

运行结果

起初速度快,接近目标后速度变慢,路径如下:
ex2_2.png-209kB

练习 2_3

calculateControlOutput.m 的 后半部分

  1. % ex_2_3
  2. % 1 正向,-1 反向
  3. direction = 1;
  4. if parameters.backwardAllowed && parameters.useConstantSpeed;
  5. % 如果是反向
  6. if abs(alpha) > pi() / 2
  7. % 转方向到 backward
  8. alpha = normalizeAngle(alpha - pi());
  9. beta = normalizeAngle(beta - pi());
  10. direction = -1;
  11. % 更新 omega
  12. omega = parameters.Kalpha * alpha + parameters.Kbeta * beta;
  13. end
  14. % 根据 vu 的缩放调整 omega
  15. omega = omega * (parameters.constantSpeed / vu);
  16. % 常数速度
  17. vu = direction * parameters.constantSpeed;
  18. end

运行结果

路径与 ex_2_2 一致,匀速接近目标并很快找到目标。路径如下:
ex2_3.png-195.7kB

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注