addLoiter
Description
addLoiter(___,
sets
additional options specified by one or more name-value pair arguments in addition to all
input arguments from the previous syntax. For example,
Name=Value
)addLoiter(mission,center,radius,duration,Frame="LocalNED")
adds a
loiter mission item with the center coordinates specified in the local north-east-down (NED)
reference frame.
Examples
Create UAV Mission Manually
Create a UAV mission object with a home location at the origin of the local ENU coordinate frame and an initial speed of 5 meters per second.
m = uavMission(Frame="LocalENU",HomeLocation=[0 0 0],Speed=5)
m = uavMission with properties: HomeLocation: [0 0 0] InitialYaw: 0 Frame: "LocalENU" Speed: 5 NumMissionItems: 0
Add a takeoff mission item to the mission with an altitude of 25
meters, pitch of 15
degrees, and yaw of 0
degrees.
addTakeoff(m,20,Pitch=15,Yaw=0);
Add two waypoint mission items to the mission. Between the two waypoints, increase the speed of the UAV to 20
meters per second. After the second waypoint, reduce the speed of the UAV back to 5
meters per second.
addWaypoint(m,[10 0 30]); addChangeSpeed(m,20) addWaypoint(m,[20 0 40]); addChangeSpeed(m,5) addWaypoint(m,[30 0 50])
Add loiter and hover mission items to the mission, specifying for the UAV to loiter and hover around the second waypoint at a radius of 50
meters for 20
seconds each.
addLoiter(m,[40 0 60],10,20); addHover(m,[50 0 70],10,20);
Add a landing mission item to the mission to land the UAV.
addLand(m,[70 0 0],Yaw=0);
Show the mission item data table.
showdetails(m)
ans=9×17 table
Idx Timestamp MissionType ParameterName1 ParameterValue1 ParameterName2 ParameterValue2 ParameterName3 ParameterValue3 ParameterName4 ParameterValue4 ParameterName5 ParameterValue5 ParameterName6 ParameterValue6 ParameterName7 ParameterValue7
___ _________ _____________ ______________ _______________ ______________ _______________ ______________ _______________ ______________ _______________ __________________ _______________ ______________ _______________ ______________ _______________
1 NaN "Takeoff" "Altitude" 20 "Pitch" 15 "Yaw" 0 "" NaN "" NaN "" NaN "" NaN
2 NaN "Waypoint" "X" 10 "Y" 0 "Z" 30 "Yaw" NaN "AcceptanceRadius" NaN "" NaN "" NaN
3 NaN "ChangeSpeed" "Speed" 20 "" NaN "" NaN "" NaN "" NaN "" NaN "" NaN
4 NaN "Waypoint" "X" 20 "Y" 0 "Z" 40 "Yaw" NaN "AcceptanceRadius" NaN "" NaN "" NaN
5 NaN "ChangeSpeed" "Speed" 5 "" NaN "" NaN "" NaN "" NaN "" NaN "" NaN
6 NaN "Waypoint" "X" 30 "Y" 0 "Z" 50 "Yaw" NaN "AcceptanceRadius" NaN "" NaN "" NaN
7 NaN "Loiter" "X" 40 "Y" 0 "Z" 60 "Radius" 10 "Duration" 20 "" NaN "" NaN
8 NaN "Hover" "X" 50 "Y" 0 "Z" 70 "Radius" 10 "Duration" 20 "" NaN "" NaN
9 NaN "Land" "X" 70 "Y" 0 "Z" 0 "Yaw" 0 "" NaN "" NaN "" NaN
Remove the hover action at index 7
, and then add another waypoint at index 8
after the hover item moves to index 7
. Show the mission details table again to see the changes.
removeItem(m,7); addWaypoint(m,[65 0 70],InsertAtRow=8); showdetails(m)
ans=9×17 table
Idx Timestamp MissionType ParameterName1 ParameterValue1 ParameterName2 ParameterValue2 ParameterName3 ParameterValue3 ParameterName4 ParameterValue4 ParameterName5 ParameterValue5 ParameterName6 ParameterValue6 ParameterName7 ParameterValue7
___ _________ _____________ ______________ _______________ ______________ _______________ ______________ _______________ ______________ _______________ __________________ _______________ ______________ _______________ ______________ _______________
1 NaN "Takeoff" "Altitude" 20 "Pitch" 15 "Yaw" 0 "" NaN "" NaN "" NaN "" NaN
2 NaN "Waypoint" "X" 10 "Y" 0 "Z" 30 "Yaw" NaN "AcceptanceRadius" NaN "" NaN "" NaN
3 NaN "ChangeSpeed" "Speed" 20 "" NaN "" NaN "" NaN "" NaN "" NaN "" NaN
4 NaN "Waypoint" "X" 20 "Y" 0 "Z" 40 "Yaw" NaN "AcceptanceRadius" NaN "" NaN "" NaN
5 NaN "ChangeSpeed" "Speed" 5 "" NaN "" NaN "" NaN "" NaN "" NaN "" NaN
6 NaN "Waypoint" "X" 30 "Y" 0 "Z" 50 "Yaw" NaN "AcceptanceRadius" NaN "" NaN "" NaN
7 NaN "Hover" "X" 50 "Y" 0 "Z" 70 "Radius" 10 "Duration" 20 "" NaN "" NaN
8 NaN "Waypoint" "X" 65 "Y" 0 "Z" 70 "Yaw" NaN "AcceptanceRadius" NaN "" NaN "" NaN
9 NaN "Land" "X" 70 "Y" 0 "Z" 0 "Yaw" 0 "" NaN "" NaN "" NaN
Visualize the mission.
show(m);
axis equal
Input Arguments
mission
— UAV mission
uavMission
object
UAV mission, specified as a uavMission
object.
center
— Center coordinate
three-element row vector
Center coordinate, specified as a three-element row vector. The form of the vector depends on
the reference frame, as specified by either the uavMission
object mission
or the Frame
argument:
"Global"
— [latitude longitude altitude]"GlobalRelativeAlt"
— [latitude longitude relativeAltitude]. relativeAltitude is the altitude relative to the home location specified bymission
."LocalENU"
— [X Y Z]"LocalNED"
— [X Y Z]
Specify latitude and longitude in degrees, and altitude or relative altitude in meters. Local coordinates are in meters.
Example: [40 20 40]
radius
— Loiter radius
nonnegative numeric scalar
Loiter radius, specified as a nonnegative numeric scalar, in meters.
Example: 3
duration
— Loiter duration
nonnegative numeric scalar
Loiter duration, specified as a nonnegative numeric scalar, in seconds.
Example: 5
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: addLoiter(mission,[30 60
10],10,5,Frame="LocalNED")
Frame
— Mission waypoint reference frame
mission.Frame
(default) | "Global"
| "GlobalRelativeAlt"
| "LocalENU"
| "LocalNED"
Mission waypoint reference frame, specified as one of these values:
"Global"
— Global reference frame"GlobalRelativeAlt"
— Global reference frame with an altitude relative to the home location specified bymission
"LocalENU"
— Local east-north-up (ENU) reference frame"LocalNED"
— Local north-east-down (NED) reference frame
If you do not specify the Frame argument, addLoiter
uses the
reference frame of the uavMission
object
mission
.
Data Types: char
| string
Timestamp
— Timestamp
numeric scalar
Timestamp of this item, specified as a numeric scalar, in seconds.
If you do not specify the Timestamp
argument,
addLoiter
determines the timestamp automatically based on the
reference speed of the uavMission
object.
InsertAtRow
— Item position in mission order
positive integer
Item position in the mission order, specified as an positive integer.
If you do not specify the Timestamp
argument or you specify a
value that is greater than the total number of items in the mission, the item is
inserted after the last item as the next index value.
Version History
Introduced in R2022b
See Also
Objects
Functions
addChangeSpeed
|addHover
|addLand
|addTakeoff
|addWaypoint
|removeItem
|show
|showdetails
MATLAB Command
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.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)