Skip to content
Zhexuan Liu edited this page Jun 21, 2018 · 1 revision

本文档描述此 Feature 的 JSON 数据格式,关于其调用方法,可到此处查看

Custom Feature 可以定义一系列步骤,让飞机按顺序自动执行。

JSON 格式

包含一个步骤(Step)序列,让飞机按顺序自动执行。Dict 的格式如下:

{
	"type": "customFeature",
	"data": {
		// Is this feature can be paused?
		"pausable": false,
		
		// Refer to section below
		"resumeAction": actionJSON,
	
		// Refer to step section below
		"steps": [
			{
				"type": "gimbalAttitude",
				"duration": 0.5, 
				"angleMode": "default"

				// Refer to section below
				"finishAction": actionJSON
			},
			...
		]
	}
}

finishAction

此字段对应的 data 为一个 Action 的 JSON,它将会在飞机执行完相应的步骤时被调用。每一个 Step 均可指定。

在 Timeline 被 Pause/Stop 或者执行完成时,对应的 Action 也会被停止。

ResumeAction

finishAction 类似,它将会在 Timeline 进行 Resume 的时候被调用。

在 Timeline 被 Pause/Stop 或者执行完成时,对应的 Action 也会被停止。

Steps

Step 指定飞机每一步执行的操作。目前可使用的 Step 类型以及定义方式如下:

1. TakeOff

飞机起飞

{
  "type": "takeOff"
}

2. GimbalAttitude

在指定时间内调整云台到指定角度

{
  "type": "gimbalAttitude",
  "duration": 0.5, // in seconds, with range [0.1, 25.5]
  "pitch": -90, // in degrees
  "roll": 0,
  "yaw": 0
}

3. Goto

让飞机飞到指定的位置,包括高度以及经纬度,当高度或者经纬度没有指定时,默认使用飞机当前的高度/经纬度

{
  "type": "goto",
  "speed": 8, // in m/s, with range [0, 15]
  "lat": xxx, // latitude
  "lng": xxx, // longitude
  "altitude": xxx, // in meters
}

4. Waypoint

执行一个 waypoint 任务

{
  "type": "waypoint",
  "mission": waypointDict // as describe before
}

5. Hotpoint

执行 hotpoint 任务

{
  "type": "hotpoint",
  "mission": hotpointDict, // as describe before
  "surroundingAngle": 180
}

surroundingAngle is The angular distance in degrees the aircraft will travel in the orbit of the hotpoint. The default is 360 degrees.

6. GoHome

让飞机返航

{
  "type": "goHome"
}

7. AircraftYaw

控制飞机在原地以给定的角速度,旋转到给定的角度

{
  "type": "aircraftYaw",
  "angle": 45,
  "velocity": 45
}

angle is a yaw angle relative to current heading, in degrees. velocity has a range of [0, 100] degrees/s and a default value of 20 degrees/s.

8. ShootPhoto

控制相机进行拍照

{
  "type": "shootPhoto",
  "mode": "single"
}

// or

{
  "type": "shootPhoto",
  "mode": "interval",
  "count": 10,
  "interval": 1
}

mode is the working mode of camera. single means camera shooting only one photo, while interval means camera shooting photos in interval. count means the number of photos that the camera should take when in interval mode. interval is time interval in seconds between shooting photos when in interval mode.

Clone this wiki locally