-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from lanyusea/2.3
2.3
- Loading branch information
Showing
328 changed files
with
78,878 additions
and
25,937 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) 的代码来查询详细调用方法。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.