Plane.Sdk3/PlaneGcsSdk_Shared/Copters/FlightMode.cs
2020-09-20 11:43:27 +08:00

85 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
namespace Plane.Copters
{
#if PRIVATE
public
#else
internal
#endif
enum FlightMode
{
// 王海20150608不可将以下枚举项重命名。
STABILIZE = 0, // hold level position
ACRO = 1, // rate control // 王海, 20160205, 特技模式http://copter.ardupilot.cn/wiki/acro-mode/
ALT_HOLD = 2, // AUTO control
AUTO = 3, // AUTO control
GUIDED = 4, // AUTO control
LOITER = 5, // Hold a single location
RTL = 6, // AUTO control
CIRCLE = 7,
POSITION = 8, // 王海, 20160205, 位置模式http://copter.ardupilot.cn/wiki/POSITION-mode/
LAND = 9, // AUTO control
OF_LOITER = 10, // 王海, 20160205, 光流悬停模式http://copter.ardupilot.cn/wiki/loiter-mode/ 底部。
TOY = 11
}
internal static class FightModeExtensions
{
public static string GetModeString(this FlightMode flightMode)
{
switch (flightMode)
{
case FlightMode.ALT_HOLD:
return "ALT HOLD";
case FlightMode.POSITION:
return "POS HOLD";
default:
return Enum.GetName(typeof(FlightMode), flightMode);
}
}
public static bool NeedGps(this FlightMode flightMode)
{
switch (flightMode)
{
case FlightMode.AUTO:
case FlightMode.GUIDED:
case FlightMode.LOITER:
case FlightMode.RTL:
case FlightMode.CIRCLE:
case FlightMode.LAND:
case FlightMode.POSITION:
default:
return true;
case FlightMode.STABILIZE:
case FlightMode.ACRO:
case FlightMode.ALT_HOLD:
case FlightMode.OF_LOITER:
case FlightMode.TOY:
return false;
}
}
internal static PlaneCopter.ac2modes ToAC2Mode(this FlightMode flightMode)
{
return (PlaneCopter.ac2modes)flightMode;
}
}
}