connect
Connect poses with UAV Dubins connection path
Syntax
Description
[
connects the start and goal poses using the specified pathSegObj
,pathCost
] = connect(connectionObj
,start
,goal
)uavDubinsConnection
object.
The path segment object with the lowest cost is returned.
[
returns all possible path segments as a cell array with their associated costs.pathSegObj
,pathCost
] = connect(connectionObj
,start
,goal
,'PathSegments','all')
Examples
Connect Poses of All Valid UAV Dubins Paths
This example shows how to calculate all valid UAV Dubins path segments and connect poses using the uavDubinsConnection
object.
Calculate All Possible Path Segments
Create a uavDubinsConnection
object.
connectionObj = uavDubinsConnection;
Define start and goal poses as [x
, y
, z
, headingAngle
] vectors.
startPose = [0 0 0 0]; % [meters, meters, meters, radians]
goalPose = [0 0 20 pi];
Calculate all possible path segments and connect the poses.
[pathSegObj,pathCosts] = connect(connectionObj,startPose,goalPose,'PathSegments','all');
Path Validation and Visualization
Check the validity of all the possible path segments and display the valid paths along with their motion type and path cost.
for i = 1:length(pathSegObj) if ~isnan(pathSegObj{i}.Length) figure show(pathSegObj{i}) fprintf('Motion Type: %s\nPath Cost: %f\n',strjoin(pathSegObj{i}.MotionTypes),pathCosts(i)); end end
Motion Type: L S L N Path Cost: 214.332271
Motion Type: R S R N Path Cost: 214.332271
Motion Type: R L R N Path Cost: 138.373157
Motion Type: L R L N Path Cost: 138.373157
Input Arguments
connectionObj
— Path connection type
uavDubinsConnection
object
Path connection type, specified as a uavDubinsConnection
object. This object defines the parameters of the connection.
start
— Initial pose of UAV
four-element numeric vector or matrix
Initial pose of the UAV at the start of the path segment, specified as a four-element numeric vector or matrix [x, y, z, headingAngle].
x, y, and z specify the position in meters. headingAngle specifies the heading angle in radians. The heading angle is measured clockwise from north to east. Each row of the matrix corresponds to a different start pose.
The pose follows the north-east-down coordinate system.
The start
and goal
pose inputs can be any
of these combinations:
Single start pose with single goal pose.
Multiple start poses with single goal pose.
Single start pose with multiple goal poses.
Multiple start poses with multiple goal poses.
goal
— Goal pose of UAV
four-element numeric vector or matrix
Goal pose of the UAV at the end of the path segment, specified as a four-element numeric vector or matrix [x, y, z, headingAngle].
x, y, and z specify the position in meters. headingAngle specifies the heading angle in radians. The heading angle is measured clockwise from north to east. Each row of the matrix corresponds to a different goal pose.
The pose follows the north-east-down coordinate system.
The start
and goal
pose inputs can be any
of these combinations:
Single start pose with single goal pose.
Multiple start poses with single goal pose.
Single start pose with multiple goal poses.
Multiple start poses with multiple goal poses.
Output Arguments
pathSegObj
— Path segments
cell array of uavDubinsPathSegment
objects
Path segments, returned as a cell array of uavDubinsPathSegment
objects. The type of object depends on the input connectionObj
. The
size of the cell array depends on whether you use single or multiple
start
and goal
poses.
By default, the function returns the path with the lowest cost for each
start
and goal
pose.
When calling the connect
function using the
'PathSegments','all'
name-value pair, the cell array contains all
valid path segments between the specified start
and
goal
poses.
pathCost
— Cost of path segment
positive numeric scalar | positive numeric vector | positive numeric matrix
Cost of path segments, returned either as a positive numeric scalar, vector, or
matrix. Each element of the cost vector corresponds to a path segment in
pathSegObj
.
By default, the function returns the path with the lowest cost for each
start
and goal
pose.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2019b
See Also
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)