158 lines
6.4 KiB
Go
158 lines
6.4 KiB
Go
package _struct
|
||
|
||
import "encoding/xml"
|
||
|
||
// 飞向首航点模式
|
||
const (
|
||
Safely = "safely"
|
||
PointToPoint = "pointToPoint"
|
||
)
|
||
|
||
// 航线结束动作
|
||
const (
|
||
GoHome = "goHome"
|
||
AutoLand = "autoLand"
|
||
GotoFirstWaypoint = "gotoFirstWaypoint"
|
||
)
|
||
|
||
//失控是否继续执行航线
|
||
|
||
const (
|
||
GoContinue = "goContinue" //继续执行航线
|
||
ExecuteLostAction = "executeLostAction" //退出航线,执行失控动作
|
||
)
|
||
|
||
// 失控动作类型
|
||
const (
|
||
GoBack = "goBack" //返航。飞行器从失控位置飞向起飞点
|
||
Landing = "landing" //降落。飞行器从失控位置原地降落
|
||
Hover = "hover" //悬停。飞行器从失控位置悬停
|
||
)
|
||
|
||
// 预定义模板类型
|
||
const (
|
||
Waypoint = "waypoint" //航点飞行
|
||
Mapping2d = "mapping2d" //建图航拍
|
||
Mapping3d = "mapping3d" //倾斜摄影
|
||
MappingStrip = "mappingStrip" //航带飞行
|
||
)
|
||
|
||
// Placemark 结构表示 KML 的地点标记
|
||
type Placemark struct {
|
||
Point Point `xml:"Point"`
|
||
Index int `xml:"wpml:index"`
|
||
EllipsoidHeight float64 `xml:"wpml:ellipsoidHeight"`
|
||
Height float64 `xml:"wpml:height"`
|
||
UseGlobalSpeed int `xml:"wpml:useGlobalSpeed"`
|
||
UseGlobalHeadingParam int `xml:"wpml:useGlobalHeadingParam"`
|
||
UseGlobalTurnParam int `xml:"wpml:useGlobalTurnParam"`
|
||
UseStraightLine int `xml:"wpml:useStraightLine"`
|
||
//ActionGroup ActionGroup `xml:"wpml:actionGroup"`
|
||
}
|
||
|
||
// Point 结构表示地点坐标
|
||
type Point struct {
|
||
Coordinates string `xml:"coordinates"`
|
||
}
|
||
|
||
type PayloadParam struct {
|
||
PayloadPositionIndex int `xml:"wpml:payloadPositionIndex"`
|
||
ImageFormat string `xml:"wpml:imageFormat"`
|
||
}
|
||
|
||
type Doc struct {
|
||
Author string `xml:"wpml:author"`
|
||
UpdateTime int64 `xml:"wpml:updateTime"`
|
||
CreateTime int64 `xml:"wpml:createTime"`
|
||
MissionConfig MissionConfig `xml:"wpml:missionConfig"`
|
||
Folder interface{} `xml:"Folder"`
|
||
}
|
||
|
||
type PublicTemplate struct {
|
||
TemplateType string `xml:"wpml:templateType"`
|
||
TemplateId int `xml:"wpml:templateId"`
|
||
AutoFlightSpeed float64 `xml:"wpml:autoFlightSpeed"`
|
||
WaylineCoordinateSysParam struct {
|
||
CoordinateMode string `xml:"wpml:coordinateMode"`
|
||
HeightMode string `xml:"wpml:heightMode"`
|
||
GlobalShootHeight float64 `xml:"wpml:globalShootHeight"`
|
||
PositioningType string `xml:"wpml:positioningType"`
|
||
SurfaceFollowModeEnable int `xml:"wpml:surfaceFollowModeEnable"`
|
||
SurfaceRelativeHeight string `xml:"wpml:surfaceRelativeHeight"`
|
||
} `xml:"wpml:waylineCoordinateSysParam"`
|
||
}
|
||
|
||
type ActionGroup struct {
|
||
ActionGroupId int `xml:"wpml:actionGroupId"`
|
||
ActionGroupStartIndex int `xml:"wpml:actionGroupStartIndex"`
|
||
ActionGroupEndIndex int `xml:"wpml:actionGroupEndIndex"`
|
||
ActionGroupMode string `xml:"wpml:actionGroupMode"`
|
||
ActionTrigger struct {
|
||
ActionTriggerType string `xml:"actionTriggerType"`
|
||
} `xml:"actionTrigger"`
|
||
Action Action `xml:"action"`
|
||
}
|
||
|
||
type Action struct {
|
||
ActionId int `xml:"actionId"`
|
||
ActionActuatorFunc string `xml:"actionActuatorFunc"`
|
||
ActionActuatorFuncParam ActionActuatorFuncParam `xml:"actionActuatorFuncParam"`
|
||
}
|
||
|
||
type ActionActuatorFuncParam struct {
|
||
FileSuffix string `xml:"fileSuffix"`
|
||
PayloadPositionIndex string `xml:"payloadPositionIndex"`
|
||
}
|
||
|
||
type MissionConfig struct {
|
||
FlyToWaylineMode string `xml:"wpml:flyToWaylineMode"`
|
||
FinishAction string `xml:"wpml:finishAction"`
|
||
ExitOnRCLost string `xml:"wpml:exitOnRCLost"`
|
||
ExecuteRCLostAction string `xml:"wpml:executeRCLostAction"`
|
||
TakeOffSecurityHeight float64 `xml:"wpml:takeOffSecurityHeight"`
|
||
GlobalTransitionalSpeed float64 `xml:"wpml:globalTransitionalSpeed"`
|
||
GlobalRTHHeight float64 `xml:"wpml:globalRTHHeight"`
|
||
|
||
//TakeOffRefPoint xml.Name `xml:"wpml:takeOffRefPoint"`
|
||
//
|
||
//TakeOffRefPointAGLHeight xml.Name `xml:"wpml:takeOffRefPointAGLHeight"`
|
||
|
||
//DroneInfo struct {
|
||
// DroneEnumValue xml.Name `xml:"wpml:droneEnumValue"`
|
||
// DroneSubEnumValue xml.Name `xml:"wpml:droneSubEnumValue"`
|
||
//} `xml:"wpml:droneInfo"`
|
||
//PayloadInfo struct {
|
||
// PayloadEnumValue xml.Name `xml:"wpml:payloadEnumValue"`
|
||
// PayloadSubEnumValue xml.Name `xml:"wpml:payloadSubEnumValue"`
|
||
// PayloadPositionIndex xml.Name `xml:"wpml:payloadPositionIndex"`
|
||
//} `xml:"wpml:payloadInfo"`
|
||
}
|
||
|
||
type WayPointTemplate struct {
|
||
PublicTemplate
|
||
GlobalWaypointTurnMode string `xml:"wpml:globalWaypointTurnMode"` //全局航点类型(全局航点转弯模式)coordinateTurn:协调转弯,不过点,提前转弯 toPointAndStopWithDiscontinuityCurvature:直线飞行,飞行器到点停 toPointAndStopWithContinuityCurvature:曲线飞行,飞行器到点停 toPointAndPassWithContinuityCurvature:曲线飞行,飞行器过点不停
|
||
GlobalUseStraightLine int `xml:"wpml:globalUseStraightLine"` //全局航段轨迹是否尽量贴合直线
|
||
GimbalPitchMode string `xml:"wpml:gimbalPitchMode"` //云台俯仰角控制模式 manual:手动控制。飞行器从一个航点飞向下一个航点的过程中,
|
||
// 支持用户手动控制云台的俯仰角度。若无用户控制,则保持飞离航点时的云台俯仰角度。
|
||
//usePointSetting:依照每个航点设置。飞行器从一个航点飞向下一个航点的过程中,云台俯仰角均匀过渡至下一个航点的俯仰角。
|
||
GlobalHeight float64 `xml:"wpml:globalHeight"` //全局航线高度(相对起飞点高度
|
||
Placemark []Placemark `xml:"Placemark"`
|
||
//UseGlobalTransitionalSpeed string `xml:"wpml:useGlobalTransitionalSpeed"`
|
||
//TransitionalSpeed string `xml:"wpml:transitionalSpeed"`
|
||
//GlobalWaypointHeadingParam struct {
|
||
// WaypointHeadingMode string `xml:"wpml:waypointHeadingMode"`
|
||
// WaypointHeadingAngle string `xml:"wpml:waypointHeadingAngle"`
|
||
// WaypointPoiPoint string `xml:"wpml:waypointPoiPoint"`
|
||
// WaypointHeadingPathMode string `xml:"wpml:waypointHeadingPathMode"`
|
||
//} `xml:"wpml:globalWaypointHeadingParam"` //全局偏航角模式参数
|
||
}
|
||
|
||
// KML 结构表示完整的 KML 文件
|
||
type KML struct {
|
||
//XMLName xml.Attr `xml:"kml"`
|
||
XMLName xml.Name `xml:"http://www.opengis.net/kml/2.2 kml"`
|
||
XmlnsStream string `xml:"xmlns:wpml,attr"`
|
||
//Test []Test `xml:"test"`
|
||
Document Doc `xml:"Document"`
|
||
}
|