在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配置文件;

<launch>
    <node pkg="dji_sdk" type="dji_sdk_node" name="dji_sdk" output="screen">
    <!-- node parameters -->
    <param name="serial_name" type="string" value="/dev/ttyUSB1"/>
    <param name="baud_rate" type="int" value="230400"/>
    <param name="app_id" type="int" value="×××××××"/>
    <param name="app_version" type="int" value="1"/>
    <param name="align_time" type="bool" value="false"/>
    <param name="enc_key" type="string" value="a2870084××××××26726e5413×××××××2099fd652××××××fac53581c1c392"/>
    <param name="use_broadcast" type="bool" value="false"/>
    </node>
</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.

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值