Skip to content

Commit

Permalink
Merge pull request #41 from lanyusea/2.3
Browse files Browse the repository at this point in the history
2.3
  • Loading branch information
lanyusea committed Mar 2, 2016
2 parents 78eea1e + 9c3309a commit ee3ec8c
Show file tree
Hide file tree
Showing 328 changed files with 78,878 additions and 25,937 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ Onboard_SDK_Lib/build-DJI_onboardSDK-Desktop_Qt_5_4_2_MinGW_32bit-Debug/
sample/STM32/MDK/Objects/
sample/STM32/MDK/Listings/
sample/Windows/Windows12/DJIonboardSDK/DJIonboardSDK/Debug/
sample/PureQT/build-onboardSDK-Desktop_Qt_5_4_2_MinGW_32bit-Debug/
sample/PureQT/build-onboardSDK-Desktop_Qt_5_4_2_MinGW_32bit-Release/
sample/PureQT/build-onboardSDK-Desktop_Qt5_5_1_MSVC12_64bit-Debug/
sample/PureQT/build-onboardSDK-Desktop_Qt5_5_1_MSVC12_64bit-Release/
sample/PureQT/build-onboardSDK-Desktop_Qt_5_5_1_MSVC2013_64bit-Debug/
sample/PureQT/build-onboardSDK-Desktop_Qt_5_5_1_MSVC2013_64bit-Release/
sample/PureQT/build-onboardSDK-Desktop_Qt_5_5_1_MSVC2012_32bit-Debug/
sample/PureQT/build-onboardSDK-5_5_1Mingw-Release/
sample/PureQT/build-onboardSDK-msvc2013-Release/
sample/PureQT/build-onboardSDK-5_5_1Mingw-Debug/
sample/PureQT/build-onboardSDK-msvc2013-Debug/
sample/commandline/build-conboardSDK-5_5_1Mingw-Debug/
sample/commandline/build-conboardSDK-5_5_1Mingw-Release/
sample/commandline/build-conboardSDK-msvc2013-Release/
sample/commandline/build-conboardSDK-msvc2013-Debug/
sample/STM32/MDK/DJISDK.uvguix.oneno

lib/DJI_onboardSDK/
=======
sample/Linux-Cmdline/output/DJI_Onboard_API_Cmdline_Test
Expand Down
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ Please comply with the local regulations during the development process and the

### Compile & Run Example Section:

- [Linux Command Line example](sample/Linux-Cmdline)
- [Linux Command Line example](sample/commandline)

- [Linux ROS example](https://github.com/dji-sdk/Onboard-SDK-ROS)

- [Windows QT example](sample/Windows-QT)
- [Windows QT example](sample/PureQT)

- [STM32 example](sample/STM32)

Expand All @@ -155,12 +155,6 @@ Please comply with the local regulations during the development process and the

- [FAQ][FAQ]

### Articles contributed by external developers:

- [Onboard Device Selection Tips](http://bbs.dji.com/forum.php?mod=viewthread&tid=21106&extra=page%3D1%26filter%3Ddigest%26digest%3D1) (Chinese)

- [Onboard SDK & M100 FAQ (Unofficial)](http://bbs.dji.com/forum.php?mod=viewthread&tid=15991&extra=page%3D1%26filter%3Ddigest%26digest%3D1%26typeid%3D182) (Chinese)


[0]:doc/en/OPENProtocol.md
[1]:doc/en/Appendix.md
Expand Down Expand Up @@ -291,11 +285,11 @@ Onboard SDK能够允许开发者选用任意合适的机载设备(需另购)

### 编译与运行示例:

- [Linux Command Line example](sample/Linux-Cmdline)
- [Linux Command Line example](sample/commandline)

- [Linux ROS example](https://github.com/dji-sdk/Onboard-SDK-ROS)

- [Windows QT example](sample/Windows-QT)
- [Windows QT example](sample/PureQT)

- [STM32 example](sample/STM32)

Expand All @@ -310,12 +304,6 @@ Onboard SDK能够允许开发者选用任意合适的机载设备(需另购)
- [FAQ][cnFAQ]


### 由外部开发者提供的文档:

- [可以在M100上使用的机载设备及机载外部设备](http://bbs.dji.com/forum.php?mod=viewthread&tid=21106&extra=page%3D1%26filter%3Ddigest%26digest%3D1)

- [关于M100 & Onboard SDK的问题FAQ (非官方)](http://bbs.dji.com/forum.php?mod=viewthread&tid=15991&extra=page%3D1%26filter%3Ddigest%26digest%3D1%26typeid%3D182)

[cn0]:doc/cn/开放协议.md
[cn1]:doc/cn/附录.md
[cn2]:doc/cn/数据透传.md
Expand Down
Binary file modified doc/cn/Images/QtExample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions doc/cn/开放协议.md
Original file line number Diff line number Diff line change
Expand Up @@ -865,42 +865,42 @@

<tr>
<td>59</td>
<td>24</td>
<td>GPS 位置, 海拔高度, 相对地面高度</td>
<td>25</td>
<td>GPS 位置, 海拔高度, 相对地面高度,健康度</td>
</tr>

<tr>
<td>83</td>
<td>12</td>
<td>84</td>
<td>6</td>
<td>磁感计数值</td>
</tr>

<tr>
<td>95</td>
<td>10</td>
<td>90</td>
<td>12</td>
<td>遥控器通道值</td>
</tr>

<tr>
<td>105</td>
<td>102</td>
<td>12</td>
<td>云台姿态</td>
</tr>

<tr>
<td>117</td>
<td>114</td>
<td>1</td>
<td>飞行状态</td>
</tr>

<tr>
<td>118</t8d>
<td>115</t8d>
<td>1</td>
<td>剩余电池百分比</td>
</tr>

<tr>
<td>119</td>
<td>116</td>
<td>1</td>
<td>控制设备</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions doc/cn/附录.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@
<ul>1:速度数据有效</ul>
<li>bit 1:4 :数据来源</li>
<ul>0b011:GPS</ul>
<ul>0b110:单目摄像头识别</ul>
<ul>0b111:双目摄像头识别</ul>
<ul>0b100:单目摄像头识别</ul>
<ul>0b101:双目摄像头识别</ul>
<li>bit 5:7 :保留</li>
</ul></td>
<td>---</td>
Expand Down
4 changes: 2 additions & 2 deletions doc/en/Appendix.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ By specifying the `control_mode_byte`, 14 control modes can be constructed :
<ul>1:valid</ul>
<li>bit 1:4 :data source</li>
<ul>0b011:GPS</ul>
<ul>0b110:MVO (Mono Video Odometer)</ul>
<ul>0b111:SVO (Stereo Video Odometer)</ul>
<ul>0b100:MVO (Mono Video Odometer)</ul>
<ul>0b101:SVO (Stereo Video Odometer)</ul>
<li>bit 5:7 :reserved</li>
</ul></td>
<td>---</td>
Expand Down
Binary file modified doc/en/Images/QtExample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions doc/en/OPENProtocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -860,42 +860,42 @@ More info about Flight Data, please refer to [Flight Data part in Appendix](Appe

<tr>
<td>59</td>
<td>24</td>
<td>25</td>
<td>GPS position, altitude, height and healthiness</td>
</tr>

<tr>
<td>83</td>
<td>12</td>
<td>84</td>
<td>6</td>
<td>Magnetometer data</td>
</tr>

<tr>
<td>95</td>
<td>10</td>
<td>90</td>
<td>12</td>
<td>Remote controller channels</td>
</tr>

<tr>
<td>105</td>
<td>102</td>
<td>12</td>
<td>Roll, pitch and yaw of Gimbal </td>
</tr>

<tr>
<td>117</td>
<td>114</td>
<td>1</td>
<td>Flight status</td>
</tr>

<tr>
<td>118</td>
<td>115</td>
<td>1</td>
<td>Battery percentage</td>
</tr>

<tr>
<td>119</td>
<td>116</td>
<td>1</td>
<td>Control device</td>
</tr>
Expand Down
15 changes: 15 additions & 0 deletions lib/DJIscript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#DJI Script

DJI Script is a minimal implementation of Onboard SDK library.

You can modify it directly as an easy client, which is the way our cmdline example works.

Check the code of [cmdline example](../../sample/commandline) for the detial usage.

# DJI 脚本

DJI 脚本是 Onboard SDK 库文件的最小实现。

你可以将其当成最小系统来编辑,实现自己所需的控制逻辑,这也是终端例程的实现方式。

参阅 [终端例程](../../sample/commandline) 的代码来查询详细调用方法。
32 changes: 32 additions & 0 deletions lib/DJIscript/inc/DJI_Interpreter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef DJI_INTERPRETER_H
#define DJI_INTERPRETER_H

#include "DJI_Script.h"

namespace DJI
{
namespace onboardSDK
{

typedef struct ScriptName
{
char* name;
Task task;
}ScriptName;

class Interpreter
{
public:
Interpreter(CoreAPI *controlAPI);

private:
Script *script;

public:
ScriptName *list;
};

} // namespace onboardSDK
} // namespace DJI

#endif // DJI_INTERPRETER_H
125 changes: 125 additions & 0 deletions lib/DJIscript/inc/DJI_Script.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#ifndef DJI_SCRIPT_H
#define DJI_SCRIPT_H

#include <DJI_API.h>
//! @todo replace Flight and VRC to DJI-Drone
#include <DJI_Flight.h>
#include <DJI_Camera.h>
#include <DJI_Follow.h>
#include <DJI_HotPoint.h>
#include <DJI_WayPoint.h>
#include <DJI_VirtualRC.h>

#define TASK_ITEM(x, r) \
{ \
(UserData) #x, x, r \
}
namespace DJI
{
namespace onboardSDK
{
class Script;
class Interpreter;
typedef bool (*Task)(DJI::onboardSDK::Script *, DJI::onboardSDK::UserData);

class TaskList
{
public:
TaskList(Task t = 0, UserData Data = 0, int Repeat = 0, time_ms Timeout = 0,
TaskList *Pre = 0, TaskList *Next = 0);

void run(Script *s);

TaskList *getNext() const;
TaskList *tail();
void insert(TaskList *list);
void setNext(TaskList *value);

Task getTask() const;
void setTask(const Task &value);

private:
TaskList(const TaskList &); //! @note TaskList can not be copied

private:
Task task;
time_ms start; //! @note for time management and allocation
time_ms timeout;
UserData data;
TaskList *next;
int repeat;
};

typedef struct TaskSetItem
{
UserData name;
Task task;
int repeat;
} TaskSetItem;

class Script
{
/*! @note
* class Script only offers a platform frame for scriptional flight control,
* like command line.
* */
public:
Script(CoreAPI *controlAPI = 0, TaskSetItem *set = 0, size_t SetSize = 0);

void addTaskList(TaskList *list, TaskList *pre = 0);
void addTask(Task t, UserData Data = 0, int Repeat = 0, time_ms Timeout = 0);
bool addTask(UserData name, UserData Data = 0, time_ms Timeout = 0);

void If(Task condition, TaskList *True = 0, TaskList *False = 0);
void Loop(Task condition, TaskList *Loop);

//! @note run must poll in a independent thread.
void run();

virtual TaskSetItem match(UserData name);
virtual bool quitCurrent();

public:
static void run(Script *script);

static TaskList *addIf(Task condition, TaskList *True = 0, TaskList *False = 0);
static TaskList *addLoop(Task condition, TaskList *Loop);

static bool emptyTask(Script *script, UserData data __UNUSED);

public:
ActivateData adata;

void setApi(CoreAPI *value);
void setFlight(Flight *value);
void setFollow(Follow *value);
void setCamera(Camera *value);
void setHotpoint(HotPoint *value);
void setVirtualRC(VirtualRC *value);
void setWaypoint(WayPoint *value);

CoreAPI *getApi() const;
Flight *getFlight() const;
Follow *getFollow() const;
HotPoint *getHotpoint() const;
VirtualRC *getVirtualRC() const;
Camera *getCamera() const;
WayPoint *getWaypoint() const;

private:
TaskList *taskTree;
TaskSetItem *taskSet;
size_t setSize;
CoreAPI *api;

VirtualRC *virtualRC;
HotPoint *hotpoint;
WayPoint *waypoint;
Flight *flight;
Camera *camera;
Follow *follow;
};
} // namespace onboardSDK
} // namespace DJI

#endif // DJI_SCRIPT_H
Loading

0 comments on commit ee3ec8c

Please sign in to comment.