在TX2上安装大疆的Onboard-SDK并且实现ROS对DJI-M100简单仿真器demo控制的方法

0.准备物件:

一台windows系统电脑(mac也行,只要能安装DJI ASSISITANT 2就行)

一个安装有ubuntu16.04的TX2,(鼠标,显示屏,键盘等外设就不说了,关于TX2的开机测试及刷机参照https://blog.csdn.net/qq_41628231/article/details/81159740)

一个 USB-TTL串口,一跟micro-usb数据线

一台DJI-M100无人机

一个DJI-LightBridge(大疆M100那个遥控器)

1.OSDK平台的安装

参照官网http://developer.dji.com/onboard-sdk/documentation/sample-doc/sample-setup.html#ros-oes

1-Clone (or download as zip) the DJI OSDK from Github here. 
https://github.com/dji-sdk/Onboard-SDK/releases 
2-Open a terminal inside the onboardsdk folder and follow these steps to build the core OSDK library:

mkdir build
cd build
cmake ..
make djiosdk-core

3-Now, install the osdk-core library to your system so that the dji_sdk ROS node may find it and link against it:

sudo make install djiosdk-core

2.OSDK-ROS包安装

参照官网https://developer.dji.com/onboard-sdk/documentation/sample-doc/sample-setup.html#ros-onboard-computer

4-If you don’t have a catkin workspace, create one as follows:

mkdir catkin_ws
cd catkin_ws
mkdir src
cd src
catkin_init_workspace
  •  
  • 5-Clone (or download as zip) the DJI OSDK-ROS from Github here in the src folder. 

https://github.com/dji-sdk/Onboard-SDK-ROS/releases 
6-Build the dji_sdk ROS package and the dji_sdk_demo ROS package.

Configuration 
7-Remember to source your setup.bash:

source devel/setup.bash

8-Edit the launch file and enter your App ID, Key, Baudrate and Port name in the designated places:

rosed dji_sdk sdk.launch

注意 App ID ,key需要注册成为大疆开发者才能得到

对于dji-M100的配置如下:

 rosed dji_sdk sdk.launch配置文件;


    
    
    
    
    
    
    
    
    
    
  •  

串口号的获取:

 ls -l /dev | grep ttyUSB

如果没有查看到,说明不能识别,比如我的串口是CH340的需要安装CH340驱动参照

https://blog.csdn.net/qq_41628231/article/details/81210188

查询到USB后获取端口权限

sudo chmod 666 /dev/ttyUSB0

DJI ASSISITANT2 中SDK项设置波特率与配置文件一致(实际均为230400),勾选“使能API”;

DJI ASSISITANT2 中重新设置波特率后需要断电再上电重启一次控制器。

Running the Samples 
9-Start up the dji_sdk ROS node:

roslaunch dji_sdk sdk.launch
  • 注意:使用命令 roslaunch dji_sdk sdk.launch 之前,DJI ASSISITANT 2 需连接N3,同时DJI LightBridge II 模式开关需拨到F档

10-Open up another terminal and cd to your catkin_ws location, and start up a sample (e.g. flight control sample):

source devel/setup.bash
rosrun dji_sdk_demo demo_flight_control
  •  

11-Follow the prompt on screen to choose an action for the drone to do.

 

你可能感兴趣的:(在TX2上安装大疆的Onboard-SDK并且实现ROS对DJI-M100简单仿真器demo控制的方法)