Skip to content

Commit dcd6db6

Browse files
author
alireza@general
committed
feat: merge from 4.1
1 parent d1c14d4 commit dcd6db6

50 files changed

Lines changed: 2585 additions & 972 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ add_message_files(
7373
FILES
7474

7575
FCTimeInUTC.msg
76+
JoystickParams.msg
7677
GPSUTC.msg
7778
Gimbal.msg
7879
Waypoint.msg
@@ -105,7 +106,11 @@ add_message_files(
105106
MissionHotpointTask.msg
106107
FlightAnomaly.msg
107108
VOPosition.msg
108-
RelPosition.msg
109+
BatteryState.msg
110+
BatteryWholeInfo.msg
111+
SmartBatteryState.msg
112+
SmartBatteryDynamicInfo.msg
113+
HMSPushInfo.msg
109114
)
110115

111116
## Generate services in the 'srv' folder
@@ -115,25 +120,36 @@ add_service_files(
115120
GetDroneType.srv
116121
GetM300StereoParams.srv
117122
FlightTaskControl.srv
123+
SetJoystickMode.srv
124+
JoystickAction.srv
125+
ObtainControlAuthority.srv
126+
KillSwitch.srv
127+
EmergencyBrake.srv
118128
GimbalAction.srv
119129
CameraEV.srv
120130
CameraShutterSpeed.srv
121131
CameraAperture.srv
122132
CameraISO.srv
123133
CameraFocusPoint.srv
124134
CameraTapZoomPoint.srv
135+
CameraSetZoomPara.srv
125136
CameraZoomCtrl.srv
126137
CameraStartShootSinglePhoto.srv
127138
CameraStartShootBurstPhoto.srv
128139
CameraStartShootAEBPhoto.srv
129140
CameraStartShootIntervalPhoto.srv
130141
CameraStopShootPhoto.srv
131142
CameraRecordVideoAction.srv
143+
GetWholeBatteryInfo.srv
144+
GetSingleBatteryDynamicInfo.srv
132145
MFIO.srv
133146
SetGoHomeAltitude.srv
134-
SetNewHomePoint.srv
147+
GetGoHomeAltitude.srv
148+
SetCurrentAircraftLocAsHomePoint.srv
149+
SetHomePoint.srv
135150
SetupCameraH264.srv
136-
AvoidEnable.srv
151+
SetAvoidEnable.srv
152+
GetAvoidEnable.srv
137153
InitWaypointV2Setting.srv
138154
UploadWaypointV2Mission.srv
139155
UploadWaypointV2Action.srv
@@ -145,6 +161,7 @@ add_service_files(
145161
GenerateWaypointV2Action.srv
146162
SetGlobalCruisespeed.srv
147163
GetGlobalCruisespeed.srv
164+
GetHMSData.srv
148165
SubscribeWaypointV2Event.srv
149166
SubscribeWaypointV2State.srv
150167

ReadMe.md

Lines changed: 57 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,68 @@
1-
# DJI Onboard SDK ROS 4.0.1
1+
# DJI Onboard SDK ROS 4.1.0
22

33
## Latest Update
44

5-
OSDK-ROS 4.0.1 was released on 24 August 2020.You need to read newest update below to get update information. Please see the [release notes](https://developer.dji.com/onboard-sdk/downloads/) and [ROS sample setup](https://developer.dji.com/cn/onboard-sdk/documentation/development-workflow/environment-setup.html#linux-with-ros) for more information.And We will update [ROS Wiki](http://wiki.ros.org/dji_sdk/) later.
5+
OSDK-ROS 4.1.0 was released on 20 January 2021.You need to read newest update below to get update information. Please see the [release notes](https://developer.dji.com/onboard-sdk/downloads/) and [ROS sample setup](https://developer.dji.com/cn/onboard-sdk/documentation/development-workflow/environment-setup.html#linux-with-ros) for more information.And We will update [ROS Wiki](http://wiki.ros.org/dji_sdk/) later.
66

77
### 1. feature
8-
This 4.0.1 version releases a feature package: dji_osdk_ros. The package contains two different framework's interface. OSDK-ROS-obsoleted kept ros3.8.1's interface.
8+
This 4.1.0 version releases a feature package: dji_osdk_ros. The package contains two different framework's interface. OSDK-ROS-obsoleted kept ros3.8.1's interface.
99
(__note:We will cancel support for the OSDK-ROS-obsoleted's interface in the next version.__)
1010

11-
| **OSDK-ROS4.0.1 interface** | **OSDK-ROS-obsoleted interface** |
11+
| **OSDK-ROS4.1.0 interface** | **OSDK-ROS-obsoleted interface** |
1212
|--------------------------------------|---------------------------------------------|
1313
|files below in dji_osdk_ros folder | files below in dji_osdk_ros_obsoleted folder|
1414

15-
This update mainly includes:
16-
1. Data subscription interface and sample;
17-
2. Mobile device interface and sample;
18-
3. Payload device interface and sample;
19-
4. Add the top obstacle avoidance enable interface;
20-
5. Waypoint1.0/2.0 interface and sample;
21-
6. Advanced sensing interface and sample perfection;
22-
include:
23-
> camera-h264
24-
> camera-stream
25-
> stereo-vision-depth-perception(rectified stereo images.disparity mapfiltered disparity map (Optional).point cloud)
26-
(__note: If you roslaunch dji_vehicle_node.launch to get m300_stereo_param.yaml, the yaml file will be prouduced in .ros folder(/home/${user}/.ros).And you need to copy it to the directory which you need to rosrun.__)
27-
7. we also kept all services and topics of osdk-ros 3.8.1. If you want to use these interfaces,you need to run dji_sdk_node and use it's services and topics.
15+
This update mainly includes:
16+
1. Battery information interface and sample;
17+
2. hms interface and sample;
18+
3. update flight-control interface and sample:
19+
include:
20+
>set_joystick_mode
21+
>joystick_action
22+
>get/set_go_home_altitude
23+
>set_home_point
24+
>rename 'set_current_point_as_home' to 'set_current_aircraft_point_as_home'
25+
>rename 'enable_avoid' to 'set_horizon_avoid_enable'
26+
>rename 'enable_upwards_avoid' to 'set_upwards_avoid_enable'
27+
>get_acoid_enable_status
28+
>kill_switch
29+
>emergency_brake
30+
>update flight_task_control,include:
31+
a.add velocity and yaw rate control action
32+
b.add turn on/off motor action
33+
c.add force landing and confirm landing action
34+
d.add cancel landing and cancel go home action
35+
36+
4. fixed telemetry_node problem:displayMode and rcConnection is zero.
37+
38+
5. we also kept all services and topics of osdk-ros 3.8.1. If you want to use these interfaces,you need to run dji_sdk_node and use it's services and topics.
2839
(__note: These interfaces are not fully compatible with onboard-sdk4.0.1.And they will not be supported in next osdk-ros version.__)
2940

3041
| **nodes** | **services's name** | **topics's name** |
3142
|--------------------------------------|--------------------------------------------------|---------------------------------------|
3243
|dji_vehicle_node |get_drone_type | |
3344
|flight_control_node |flight_task_control | |
3445
| |set_go_home_altitude | |
35-
| |set_current_point_as_home | |
36-
| |enable_avoid | |
37-
| |enable_upwards_avoid | |
46+
| |get_go_home_altitude | |
47+
| |set_current_aircraft_point_as_home | |
48+
| |set_horizon_avoid_enable | |
49+
| |set_upwards_avoid_enable | |
50+
| |set_local_pos_reference | |
51+
| |joystick_action | |
52+
| |set_joystick_mode | |
53+
| |set_home_point | |
54+
| |get_avoid_enable_status | |
55+
| |obtain_release_control_authority | |
56+
| |kill_switch | |
57+
| |emergency_brake | |
3858
|gimbal_camera_control_node |gimbal_task_control | |
3959
| |camera_task_set_EV | |
4060
| |camera_task_set_shutter_speed | |
4161
| |camera_task_set_aperture | |
4262
| |camera_task_set_ISO | |
4363
| |camera_task_set_focus_point | |
4464
| |camera_task_tap_zoom_point | |
65+
| |camera_task_set_zoom_para | |
4566
| |camera_task_zoom_ctrl | |
4667
| |camera_start_shoot_single_photo | |
4768
| |camera_start_shoot_aeb_photo | |
@@ -78,7 +99,10 @@ This update mainly includes:
7899
| | |dji_osdk_ros/stereo_240p_front_depth_images|
79100
| | |dji_osdk_ros/stereo_vga_front_left_images |
80101
| | |dji_osdk_ros/stereo_vga_front_right_images |
81-
|time_sync_node | | |
102+
|time_sync_node | |dji_osdk_ros/time_sync_nmea_msg |
103+
| | |dji_osdk_ros/time_sync_gps_utc |
104+
| | |dji_osdk_ros/time_sync_fc_time_utc |
105+
| | |dji_osdk_ros/time_sync_pps_source |
82106
|mission_node |dji_osdk_ros/mission_waypoint_upload | |
83107
| |dji_osdk_ros/mission_waypoint_action | |
84108
| |dji_osdk_ros/mission_waypoint_getInfo | |
@@ -112,6 +136,9 @@ This update mainly includes:
112136
| |dji_osdk_ros/waypointV2_getGlobalCruisespeed | |
113137
| |dji_osdk_ros/waypointV2_subscribeMissionEvent |dji_osdk_ros/waypointV2_mission_event |
114138
| |dji_osdk_ros/waypointV2_subscribeMissionState |dji_osdk_ros/swaypointV2_mission_state |
139+
|battery_node |get_whole_battery_info | |
140+
| |get_single_battery_dynamic_info | |
141+
|hms_node |get_hms_data | |
115142
### 2. Prerequisites
116143
The system environment we have tested is in the table below.
117144

@@ -120,13 +147,13 @@ The system environment we have tested is in the table below.
120147
| **system version** | ubuntu 16.04 |
121148
| **processor architecture** | x86(mainfold2-c),armv8(mainfold2-g) |
122149
#### Firmware Compatibility
123-
OSDK-ROS 4.0.1's firmware compatibility depends on onboard-sdk 4.0.1's. you can get more information [here](https://developer.dji.com/cn/document/0c2b2d75-d019-480c-9241-8c8e7209692d);
150+
OSDK-ROS 4.1.0's firmware compatibility depends on onboard-sdk 4.1.0's. you can get more information [here](https://developer.dji.com/cn/document/0c2b2d75-d019-480c-9241-8c8e7209692d);
124151
#### Ros
125152
you need to install ros first.Install instruction can be found at: http://wiki.ros.org/ROS/Installation. We just tested ROS kinetic version.
126153
#### C++11 Compiler
127154
We compile with C + + 11 Standard.
128155
#### onboard-sdk
129-
you need to download onboard-sdk4.0.1,and install it.
156+
you need to download onboard-sdk4.1.0,and install it.
130157
>$mkdir build
131158
>$cd build
132159
>$cmake ..
@@ -140,6 +167,8 @@ __note:we only test on kinetic,but it should be support on other version.__
140167
> $sudo apt install ffmpeg
141168
#### libusb-1.0-0-dev
142169
> $sudo apt install libusb-1.0-0-dev
170+
#### libsdl2-dev
171+
> $sudo apt install libsdl2-dev
143172
#### opencv3.x
144173
We use OpenCV to show images from camera stream. Download and install instructions can be found at: http://opencv.org. Tested with OpenCV 3.3.0.Suggest using 3.3.0+.
145174
#### stereo-vision function
@@ -158,7 +187,7 @@ You will need to add an udev file to allow your system to obtain permission and
158187
>$sudo vi DJIDevice.rules
159188
160189
Then add these content into DJIDevice.rules.
161-
>$SUBSYSTEM=="usb", ATTRS{idVendor}=="2ca3", MODE="0666"
190+
>SUBSYSTEM=="usb", ATTRS{idVendor}=="2ca3", MODE="0666"
162191
163192
At last,you need to reboot your computer to make sure it works.
164193

@@ -170,8 +199,8 @@ If you don't have a catkin workspace, create one as follows:
170199
>$mkdir src
171200
>$cd src
172201
>$catkin_init_workspace
173-
#### add osdk-ros 4.0.1
174-
Download osdk-ros 4.0.1 and put it into src.
202+
#### add osdk-ros 4.1.0
203+
Download osdk-ros 4.1.0 and put it into src.
175204
#### Build the dji_osdk_ros ROS package
176205
>$cd ..
177206
>$catkin_make
@@ -182,7 +211,7 @@ Download osdk-ros 4.0.1 and put it into src.
182211
2.Edit the launch file and enter your App ID, Key, Baudrate and Port name in the designated places.
183212
(__note:there are two launch file.
184213
dji_sdk_node.launch is for dji_sdk_node.(3.8.1's interface)
185-
dji_vehicle_node is for dji_vehicle_node(4.0.1's interface)__)
214+
dji_vehicle_node is for dji_vehicle_node(4.1.0's interface)__)
186215
> $rosed dji_osdk_ros dji_sdk_node.launch
187216
> $rosed dji_osdk_ros dji_vehicle_node.launch
188217
@@ -191,7 +220,7 @@ dji_vehicle_node is for dji_vehicle_node(4.0.1's interface)__)
191220
>dji_vehicle_node.launch does not need UserConfig.txt.
192221
#### Running the Samples
193222
1.Start up the dji_osdk_ros ROS node.
194-
if you want to use OSDK ROS 4.0.1's services and topics:
223+
if you want to use OSDK ROS 4.1.0's services and topics:
195224
>$roslaunch dji_osdk_ros dji_vehicle_node.launch
196225
197226
if you want to adapt to OSDK ROS 3.8.1's services and topics:

include/dji_osdk_ros/common_type.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
// Header include
3232
#include <dji_type.hpp>
33+
#include <vector>
3334

3435
// Declaration
3536
namespace dji_osdk_ros
@@ -53,6 +54,50 @@ namespace dji_osdk_ros
5354
double yaw_threshold;
5455
};
5556

57+
struct JoystickMode
58+
{
59+
uint8_t horizontalLogic;
60+
uint8_t verticalLogic;
61+
uint8_t yawLogic;
62+
uint8_t horizontalCoordinate;
63+
uint8_t stableMode;
64+
};
65+
66+
struct JoystickCommand
67+
{
68+
DJI::OSDK::float32_t x; /*!< Control with respect to the x axis of the
69+
DJI::OSDK::Control::HorizontalCoordinate.*/
70+
DJI::OSDK::float32_t y; /*!< Control with respect to the y axis of the
71+
DJI::OSDK::Control::HorizontalCoordinate.*/
72+
DJI::OSDK::float32_t z; /*!< Control with respect to the z axis, up is positive. */
73+
DJI::OSDK::float32_t yaw; /*!< Yaw position/velocity control w.r.t. the ground frame.*/
74+
};
75+
76+
#pragma pack(1)
77+
/*! the type of error code list in HMS's raw pushing data*/
78+
typedef struct ErrList{
79+
uint32_t alarmID; /*! error code*/
80+
uint8_t sensorIndex; /*! fault sensor's index*/
81+
uint8_t reportLevel; /*! fault level ,0-4,0 is no error,4 is highest*/
82+
} ErrList;
83+
84+
/*! the type of HMS's raw pushing data*/
85+
typedef struct HMSPushData {
86+
uint8_t msgVersion; /*! version of message.default:0*/
87+
uint8_t globalIndex; /*! cycle message sequence number*/
88+
uint8_t msgEnd : 1; /*! end flag bit of message subcontract push. last package of subcontracting push is 1.*/
89+
uint8_t msgIndex : 7; /*! Message serial number*/
90+
std::vector<ErrList> errList; /*! error code list in each pushing*/
91+
} HMSPushData;
92+
#pragma pack()
93+
94+
/*! the type of HMS's pushing data with a time stamp*/
95+
typedef struct HMSPushPacket
96+
{
97+
HMSPushData hmsPushData; /*! HMS's raw pushing data*/
98+
uint32_t timeStamp; /*! timestamp of the packet*/
99+
} HMSPushPacket;
100+
56101
struct RotationAngle
57102
{
58103
DJI::OSDK::float32_t roll;

0 commit comments

Comments
 (0)