# DJI SDK DJI2MAV 0.2.1
##### A package for connecting onboard computer with ground control station using mavlink protocal
---
Version: 0.2.1
Author: Chris Liu
Updated Date: 2015/11/30
---
## Introduction
This package is designed as a library and can be included in various platforms. It is implemented in C++ and depended on mavlink library. A simple ROS node is provided to bringup the dji2mav package.
Dji2mav connects the onboard computer with ground control station using UDP. And it is required to call functions to send heartbeat and sensors data. All the mavlink status and message encode/decode will be handled inside the dji2mav package. So far it is tested on Ubuntu 14.0 with ROS indigo.
## Quick Start
Since a ROS node is provided inside this package, it is easy to put the dji2mav to use.
#### 1. Start Simulator
It is recommanded to do sufficient tests on simulator first.
Please turn on your drone, connect your drone to the PC and properly set the *API Control* to *Enable* on N1-Assistant. Remember to switch to "P" mode on RC. Then open DJISimulator, click *Start Simulation* and *Display simulator*. You should see M100 on the ground in simulator.
#### 2. Connection
Connect onboard computer with your ground control station. Any ground control station using mavlink protocol is fitted. Please do sufficient tests on simulator before a real flight. We will be appreciated if you put forward any bug.
Make sure the onboard computer and ground control station are in the same LAN and can successfully ping each other.
#### 3. Launch
Firstly, fire up dji sdk main launch:
```
roslaunch dji_sdk sdk_manifold.launch
```
Record the IP and port of ground control station, modified the corresponding param in *dji2mav_bringup.launch*.
Then run:
```
roslaunch dji_sdk_dji2mav dji2mav_bringup.launch
```
In the terminal that launched sdk_manifold, you should see the log information that the drone has been successfully activated and the control of the drone has got, as the picture shows below.

In the terminal that launched dji2mav_bringup, you should see it notifies that the connection to specific IP and port succeeds and all the modules is launched, as the picture shows below.

If the output of these ROS nodes prompt that every thing goes okay, please move to next step.
#### 4. Setup Ground Control Station
Now please turn on your mavlink-protocol-adapted ground control station. Let's take QGround Control v2.7.1 for win32 as an example. Before clicking *Connect*, please check the connection settings. The *Link Type* should be UDP, and the *Listening Port* should be consistent with the port number that is set on the launch file which is mentioned on step 2. A UDP setting example is shown below.

Then click *Connect*. If everything is ready, you can see your ground control station receives the heartbeat. On *Analyze* tag some sensors data from the vehicle are also displayed.
Now you can do some simple waypoint test on simulator.
#### 5. Waypoint Test
Before test waypoint module, please unlock the drone and takeoff using RC. On *Plan* tag inside QGround Station, you should see a marker on the map to show the current position of drone(You can set the initial location in DJISimulator).
Double click on the map to lay markers of the waypoint. On the dashboard, please set the type of waypoint to *Global/Abs. Alt*(global position with absolute altitude). And choose *NAV: Waypoint* to be the navigation type.
Check *lat*, *lon* and *alt* data of every waypoint. Be careful that there is a default value of *alt*. Make sure it is what you expect. You can also set desired yaw angle and stay time for every waypoint. An example of creating waypoint task is shown below.

After the confirmation of the waypoint data in dashboard, you should click *Set* to send the whole mission to onboard computer. And a downloading process will be automatically execute after the uploading. You should double check the waypoint data which are downloaded from onboard device. A double check is necessary because there is no "Stop" buttom on the QGround Station. Repeated uploading process is allowed and a newer mission will cover the old one.
To start the mission, click the first ckeck box of the waypoint list. This action will send a "set current target" command to the onboard computer. The vehicle will start from the current target to the end of the waypoint list. The picture shown below displays the results of downloading waypoint task from onboard computer. The "set current target" check box is on the right of every point.

## Functional Specification
In waypoint function module, users can set latitude, longitude, altitude, heading and staytime for the waypoint. Users can upload waypoint list to the vehicle. The vehicle will wait till a current target is set by the users in the ground control station. After that, the vehicle will directly go to that target waypoint and automatically carry out the rest of the waypoint list mission, as the picture shown below.

## Code Architecture
The dji2mav is designed to meet multi ground control stations and easy expansibility demands. Some classes are designed as lazy-mode singleton.

#### 1. Setup
It is easy to access dji2mav interface by getting instance of Config. There are two important methods in config:
```
/**
* @brief Set the mavlink system id and the size of GCS list
* @param mavSysid : The system id of this vehicle
* @param num : The number of Ground Control Stations
* @return True if succeed or false if fail
*/
bool setup(uint8_t mavSysid, uint16_t num);
/**
* @brief Establish the connection of specific GCS
* @param gcsIdx : The index of the GCS. Begin from 0
* @param gcsIP : The IP of GCS
* @param gcsPort : Connection port of GCS
* @param locPort : Localhost port
* @param senderListSize : Default 256
* @param sendBufSize : Default 1024
* @param recvBufSize : Default 4096
* @return True if succeed or false if fail
*/
bool start(uint16_t gcsIdx, std::string gcsIP,
uint16_t gcsPort, uint16_t locPort,
uint16_t senderListSize = DEFAULT_SENDER_LIST_SIZE,
uint16_t sendBufSize = DEFAULT_SEND_BUF_SIZE,
uint16_t recvBufSize = DEFAULT_RECV_BUF_SIZE);
```
These two methods must be called **BEFORE** any data transporting between ground control station and onboard computer. They can be called like this:
```
/* Set the ID of system "1". There is only one ground control system so the number of GCS is also "1" */
dji2mav::Config::getInstance()->setup(1, 1);
/* The index of first GCS is "0". Set the first GCS IP and port */
dji2mav::Config::getInstance()->start(0, targetIp1, (uint16_t)targetPort1, (uint16_t)srcPort);
```
#### 2. Send Heartbeat
To send heartbeat to all GCS(ground control station), use:
```
dji2mav::MavHeartbeat::getInstance()->sendHeartbeat();
```
To send heartbeat to specific GCS, use the corresponding GCS index:
```
dji2mav::MavHeartbeat::getInstance()->sendHeartbeat(gcsIdx);
```
The send buffer of heartbeat module is particular. So it is safe to be called in a thread that periodically send heartbeat and it is recommanded to do so.
#### 3. Update Sensors Data
The sending process of sensors data is similar to the heartbeat module. To update the data, plea
没有合适的资源?快使用搜索试试~ 我知道了~
(源码)基于DJI Onboard SDK的无人机控制与管理系统.zip

共251个文件
h:159个
cpp:14个
msg:13个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 122 浏览量
2024-11-19
12:47:39
上传
评论 1
收藏 3.4MB ZIP 举报
温馨提示
# 基于DJI Onboard SDK的无人机控制与管理系统 ## 项目简介 本项目基于DJI Onboard SDK,为ROS(Robot Operating System)用户提供了一个用于控制和管理DJI无人机的解决方案。项目包含多个ROS包,实现了无人机的飞行控制、导航、拍照、录像、云台控制等功能,并通过WebSocket和MAVLink协议与无人机进行通信。 ## 主要特性和功能 1. 飞行控制通过ROS接口实现对无人机的起飞、降落、返航等飞行动作的控制。 2. 导航功能支持本地和GPS导航,实现无人机的目标点导航和航点飞行任务。 3. 云台控制提供云台角度和速度的控制接口,实现对无人机的云台操作。 4. 相机控制支持拍照和录像功能的控制,包括控制相机快门、开始和停止录像等。 5. WebSocket通信使用WebSocket协议与无人机进行通信,支持网页地图生成的航点指令。
资源推荐
资源详情
资源评论































收起资源包目录





































































































共 251 条
- 1
- 2
- 3
资源评论


t0_54coder
- 粉丝: 4582
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 基于MATLABSimulink的变压器故障仿真与差动保护策略研究
- B747固定翼飞机线性和非线性控制系统PID模型解析:纵向与横航向控制器设计 · 飞行控制
- 动力学跟踪误差模型MPC算法路径跟踪仿真:Matlab与Simulink联合实现完美跟踪效果,多种道路模型可选,横纵向解耦控制,含干扰项C矩阵版本与不考虑版本代码打包优惠供应。 精选版
- 基于遗传算法的分布式电源选址定容研究——IEEE33节点网络多目标优化模型
- 思维进化算法优化二层BP神经网络的Matlab实现及其优势分析 2024版
- 2025年粉绿大气域名线路检测,测速网站导航源码,个性化导航测速网页
- 电力系统故障定位与类型甄别的GUI平台及智能算法应用
- Linux DevOps手册:加速你的工作流程
- 基于ADG算法的GPT隐写文本生成器项目-武汉大学国家网络安全学院信息隐藏课程2022年结课设计-提供完整的实验代码与模型-通过温度机制优化隐写文本生成效果-支持文本隐写与信息隐藏.zip
- 信息安全领域SM4算法的Verilog实现及其Vivado工程应用 - Verilog
- 地震与波浪作用下车桥耦合仿真的ABAQUS、ANSYS和SIMPACK联合应用指南
- d2hbook 深度学习相关知识
- Comso l脉冲激光诱导等离子体仿真模型:精准预测等离子体特性参数 - 科研工具 v4.0
- 基于ElasticSearch-8-0-Kibana-Head-ik-Logstash和Python-3-8构建的分布式全文搜索引擎与数据分析平台-包含非结构化文本数据存储-实时检.zip
- 基于多头注意力机制卷积双向长短期记忆神经网络的时序预测模型及其MATLAB实现
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
