MATLAB ヘルプ センター
Compute heading angle from XY-points of path
Since R2023a
heading = headingFromXY(path)
heading = headingFromXY(path) computes the heading angle heading based on the XY-points of the path path.
heading
path
example
collapse all
Create a binary occupancy map using the mapClutter function.
mapClutter
rng("default") map = mapClutter(5,MapSize=[20,20],MapResolution=1);
Create a plannerAStarGrid object using the map. Plan a path.
plannerAStarGrid
planner = plannerAStarGrid(map); pathXY = plan(planner,[1 1],[18 18],"world");
Compute the heading angle (orientation of the robot) from the path.
heading = headingFromXY(pathXY);
Visualize the heading angle on the path.
show(map) hold on plot(pathXY(:,1),pathXY(:,2),".-") quiver(pathXY(:,1),pathXY(:,2),cos(heading),sin(heading),0.2)
Path, specified as an N-by-2 matrix, where the first column represents the X-coordinate and the second column represents the Y-coordinate of each point on the path.
Data Types: single | double
single
double
Heading angle, returned as an N-element column vector, in radians. Element N is the same as the element (N-1).
expand all
Introduced in R2023a
velocityCommand
controllerTEB
mobileRobotPRM
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
ヨーロッパ
アジア太平洋地域
最寄りの営業オフィスへのお問い合わせ