Skip to content

Commit

Permalink
update manifold pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
lanyusea committed Dec 9, 2015
1 parent 65b4be2 commit 67eb516
Show file tree
Hide file tree
Showing 166 changed files with 378 additions and 41,370 deletions.
80 changes: 66 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
##DJI Onboard SDK ROS Packages
#DJI Onboard SDK ROS Packages

----

##Introduction

This is a ROS package for DJI OnBoard SDK.

It helps users handle the following commands and actions.
Expand All @@ -12,41 +14,91 @@ It helps users handle the following commands and actions.
* The take off procedure
* The landing procedure
* The go home procedure
* Example for the gimbal control
* Example for the attitude control
* The Gimbal control
* The attitude control
* The photo taking procedure
* The start/stop video recording procedure
* Local navigation (fly into a certain (X,Y,Z))
* GPS navigation (fly into a certain GPS coordinate)
* Waypoint navigation (fly through a series of GPS coordinates)
* Using WebSocket together with Baidu Map for navigation
* Using MAVLink protocol and QGroundStation (TODO)

We also provides a ROS package
* Using MAVLink protocol and QGroundStation

###How to use
##How to use
1. Install and configure your hardware correctly.
2. Enter the following info into *dji_sdk/launch/sdk_manifold.launch*.
2. Enter the following info into `dji_sdk/launch/sdk_manifold.launch`.
* APP ID
* APP Level
* Communication Key
* uart device name
* baudrate
* Uart Device Name
* Baudrate
3. Use `roslaunch dji_sdk sdk_manifold.launch` to start the core node.
4. Include the `dji_drone.h` from `dji_sdk/include/dji_sdk` into your package and run it. (there also provides a python version `dji_drone.py` in `dji_sdk/src/dji_sdk`)


###System Structure
##System Structure
* [dji_sdk](dji_sdk): the core package handling the communication with Matrice 100, which provides a header file `dji_drone.h` for future use
* [dji_sdk_demo](dji_sdk_demo): an example package of using `dji_drone.h` to control the Matrice 100
* [dji_sdk_web_groundstation](dji_sdk_web_groundstation): a WebSocket example using ROS-bridge-suite, where a webpage groundstatino is provided
* [dji_sdk_manifold_read_cam](dji_sdk_manifold_read_cam): a specifed X3 video reading package for Manifold, video stream will be published out in RGB, CATKIN_IGNOREd by defualt
* [dji_sdk_manifold_read_cam_nv](dji_sdk_manifold_read_cam_nv): same as the previous one, but use hardware decoding method and in Grayscale, CATKIN_IGNOREd by defualt
* [dji_sdk_manifold_read_cam](dji_sdk_manifold_read_cam): a X3 video decoding package for Manifold, CATKIN_IGNOREd by defualt
* [dji_sdk_dji2mav](dji_sdk_dji2mav): a protocol converter making M100 compatiable with all MAVLink-protocol-dependent softwares
* [dji_sdk_doc](dji_sdk_doc): all documents

![image](dji_sdk_doc/structure.jpg)
[click to see fullsize image](https://raw.githubusercontent.com/dji-sdk/Onboard-SDK-ROS/2.3/dji_sdk_doc/structure.jpg)

###System Environment
##System Environment
The below environment has been tested.
* Operating System: Ubuntu 14.04, Manifold
* ROS version: ROS Indigo

---

#DJI Onboard SDK ROS例程

##简介

此ROS例程实现了以下功能:

* 激活 Matrice100 (以下简称M100)
* 获取 M100 控制权
* 释放 M100 控制权
* 向 M100 发送起飞指令
* 向 M100 发送降落指令
* 向 M100 发送返航指令
* 对 M100 进行姿态控制
* 对 M100 进行云台角度控制
* 向 M100 发送相机控制指令
* 控制 M100 进行 (x,y,z) 坐标导航
* 控制 M100 进行 GPS 坐标导航
* 控制 M100 进行航点飞行任务
* 通过 WebSocket 向 M100 发送网页地图生成的航点指令
* 通过 MAVLink 和 QGroundControl 控制 M100

##如何使用

1. 按照文档配置好 M100
2. 将激活信息输入至launch file:`dji_sdk/launch/sdk_manifold.launch`
* APP ID (在官网注册key后得到)
* API Level (key对应的 API 权限等级)
* Communication Key(在官网注册key后得到)
* Uart Device Name(串口设备名称)
* Baudrate(比特率)
3. 运行 `roslaunch dji_sdk sdk_manifold.launch` 来启动核心包。
4.`dji_sdk/include/dji_sdk` 下的客户端头文件`dji_drone.h` 引用到你自己的 ROS 包中,并运行它(我们也提供了python版本的客户端`dji_drone.py`

##系统架构
* [dji_sdk](dji_sdk): 核心 ROS 包,处理所有与 M100 的串口通信并提供了 `dji_drone.h`的头文件供开发者引用。
* [dji_sdk_demo](dji_sdk_demo): 一个调用 `dji_drone.h` 控制 M100 的例子。
* [dji_sdk_web_groundstation](dji_sdk_web_groundstation): 基于 WebSocket 的网页版地面站,依赖 ROS-bridge-suite 。
* [dji_sdk_manifold_read_cam](dji_sdk_manifold_read_cam): Manifold专用 ROS 包,对禅思 X3 云台的视频信息进行解码输出视频流。默认通过`CATKIN_IGNORE`禁用,需要手动启用。
* [dji_sdk_dji2mav](dji_sdk_dji2mav): MAVLink 协议转接器,使得 M100 可以支持任意使用 MAVLink 为协议的地面站软件。
* [dji_sdk_doc](dji_sdk_doc): 所有的文档与图片信息。

![image](dji_sdk_doc/structure.jpg)
[点击查看大图](https://raw.githubusercontent.com/dji-sdk/Onboard-SDK-ROS/2.3/dji_sdk_doc/structure.jpg)

#系统环境
此 ROS 包在如下系统中进行测试;
* 操作系统:Ubuntu 14.04, DJI Manifold
* ROS 版本:ROS Indigo
210 changes: 11 additions & 199 deletions dji_sdk_manifold_read_cam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,215 +3,27 @@ project(dji_sdk_read_cam)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)

## is used, also find other catkin packages
catkin_package()
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
#opencv2
roscpp
rospy
sensor_msgs
std_msgs
image_transport
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)

find_package(OpenCV REQUIRED)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################

## To decbavformatlare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependencies might have been
## pulled in transitively but can be declared for certainty nonetheless:
## * add a build_depend tag for "message_generation"
## * add a run_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )

## Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# sensor_msgs# std_msgs
# )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES read_cam
# CATKIN_DEPENDS cv_bridge roscpp rospy sensor_msgs std_msgs
# DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(include ${OpenCV_INCLUDE_DIRS})
include_directories(
include
# /usr/local/include

include
${catkin_INCLUDE_DIRS}
# ${/usr/local/include}
)

add_executable(dji_sdk_read_cam src/nv_cam.cpp)
link_directories(/usr/local/lib /usr/lib/arm-linux-gnueabihf /usr/lib)
target_link_libraries(
dji_sdk_read_cam
dcam
${catkin_LIBRARIES})

## Declare a cpp library
# add_library(read_cam
# src/${PROJECT_NAME}/read_cam.cpp
# )



## Declare a cpp executable
add_executable(dji_sdk_read_cam src/CamMain.cpp src/djiCam.c src/usbHost.c include/libusb-gadget/src/usb-gadget.c include/libusb-gadget/src/usbstring.c)

## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
# add_dependencies(read_cam_node read_cam_generate_messages_cpp)

## Specify libraries to link a library or executable target against

##target_link_libraries(${PROJECT_NAME} ${LIBAVFORMAT_LIBRARY} ${LIBAVCODEC_LIBRARY} ${LIBAVUTIL_LIBRARY} ${catkin_LIBRARIES})
link_directories(/usr/local/lib /usr/lib/arm-linux-gnueabihf)
target_link_libraries(dji_sdk_read_cam
pthread
avdevice
avfilter
usb-1.0
avformat
avcodec
xcb-shm
xcb-xfixes
xcb-render
xcb-shape
xcb
X11
dl
vpx
vorbisenc
vorbis
theoraenc
theoradec
ogg
rtmp
gnutls
opencore-amrwb
opencore-amrnb
mp3lame
faac
bz2
z
swresample
swscale
avutil
m
SDLmain
SDL
jpeg
x264

${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
)
add_dependencies(dji_sdk_read_cam dji_sdk_read_cam_gencpp)

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS read_cam read_cam_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_read_cam.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
19 changes: 13 additions & 6 deletions dji_sdk_manifold_read_cam/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
##DJI Onboard SDK ROS Package for Video Decoding on Manifold

This package is a specified video decoding package for Manifold.
This video-decoding package is a specifically desiged package for Manifold to read the X3 video stream.

###How to use
1. Install the necessary library: it should be already there, try to run the project in the `demo` folder of your Manifold home directory. If not, please run the `install_lib.sh`
1. Install the necessary library: refer [here](https://github.com/dji-sdk/manifold_cam)
2. Delete the `CATKIN_IGNORE` file inside package and `catkin_make`.
3. `rosrun dji_sdk_manifold_read_cam dji_sdk_manifold_read_cam`
3. `sudo -s` first, then `rosrun dji_sdk_read_cam dji_sdk_read_cam`
4. The image will be published into topic `/dji_sdk/image_raw`


###Note:
1. This package is specially designed for Manifold.
2. The RC controller must be connected to Matrice 100 in order to get the video stream.
3. The DJI Go has a power-saving strategy, users should either enter the camera view or do not run DJI GO at first in order to get the video stream. The video will be freezed if uses stay in the main screen of DJI GO.
3. This package does not provice video transparent transmission. You cannot see the video on DJI Go while running this package.
4. This package uses FFMPENG for video decoding. while the _nv one uses hardware decoding method.
5. The image format is RGB, while the _nv one publishes Grayscale image.

![image](../dji_sdk_doc/readcam_nv.png)

The default video stream is in RGB format.
![image](../dji_sdk_doc/readcam_nv.png)

Comment the `#define RGB` in `nv_cam.cpp` if you prefer the grayscale.
![image](../dji_sdk_doc/readcam.png)


Note: frame size is 640x480, no matter RGB or Grayscale
Loading

0 comments on commit 67eb516

Please sign in to comment.