필터 지우기
필터 지우기

How angular velocity is determined in the example "Path Following with Obstacle Avoidance in Simulink"

조회 수: 13 (최근 30일)
The example "Path Following with Obstacle Avoidance in Simulink" contains a matlab function block that calculates linear and angular velocity adjustments given a desired heading. Here is the example function:
function w = exampleHelperComputeAngularVelocity(steeringDir, wMax)
% W = exampleHelperComputeAngularVelocity(STEERINGDIR, WMAX)
% returns the angular velocity W for a differential drive robot in radians
% per second for a given steering direction STEERINGDIR in the robot's
% coordinate frame in radians and maximum angular velocity WMAX in
% radians per second. The output angular velocity is saturated based on
% the WMAX.
%
% Example:
%
% w = exampleHelperComputeAngularVelocity(0.2, 1);
% Copyright 2015 The MathWorks, Inc.
%#codegen
%#ok<*EMCA>
% Allow variable input arguments
if nargin == 1
wMax = inf;
end
validateattributes(steeringDir, {'double'},{'real'},...
'exampleHelperComputeAngularVelocity', 'STEERINGDIR', 1);
validateattributes(wMax, {'double'},{'real', 'positive'},...
'exampleHelperComputeAngularVelocity', 'WMAX', 2);
% Computing in robot's coordinate frame
curPose = [0 0 0];
% The following computation is similar to robotics.PurePursuit
lookaheadPoint = [cos(steeringDir), sin(steeringDir)];
slope = atan2((lookaheadPoint(2) - curPose(2)), ...
(lookaheadPoint(1) - curPose(1)));
alpha = angdiff(curPose(3), slope);
% Angular velocity command for a differential drive robot is
% equal to the desired curvature to be followed by the robot.
w = (2*sin(alpha));
% Pick a constant rotation when robot is facing in the opposite
% direction of the path
if abs(abs(alpha) - pi) < 1e-12
w = sign(w)*1;
end
if abs(w) > wMax
w = sign(w)*wMax;
end
end
My question is how does the line:
w = (2*sin(alpha));
Compute the required angular velocity of the robot to meet the desired heading?

답변 (1개)

Yiping Liu
Yiping Liu 2020년 1월 17일
편집: David 2020년 1월 17일
There are multiple similification here.
kai - desired curvature
L - wheelbase
d = desired steering angle
d = atan(kai*L)
atan(x) is a monotonic increasing function of x and is close to y=x function when x is in [-1,1],
so desired streering angle at the instant is simplied to just kai*L
You in general want the steering velocity to be proportional to the steering angle value (i.e. the larger steering angle is needed, the faster you want to turn the steering wheel), and L is just a constant scalar here, so eventually, w is simplified to just kai.
Such a series of simplification is probably not generally applicable, but in this example helper it gets the job done.
  댓글 수: 1
Farid Sahebsara
Farid Sahebsara 2022년 1월 25일
Can you suggest me some references? I need to derive the expression or read something to see how the matlab code finally ends up with:
w = (2*sin(alpha));
Thanks,

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Robotics에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by