dji-sdk / guidance-sdk Goto Github PK
View Code? Open in Web Editor NEWThe official Guidance SDK package for Windows, Ubuntu and XU3.
The official Guidance SDK package for Windows, Ubuntu and XU3.
In DJI_guidance_example
if ( e_imu == data_type && NULL != content )
{
imu *imu_data = (imu*)content;
printf( "imu:%f %f %f,%f %f %f %f\n", imu_data->acc_x, imu_data->acc_y, imu_data->acc_z, imu_data->q[0], imu_data->q[1], imu_data->q[2], imu_data->q[3] );
printf("imu:%d\n", imu_data->time_stamp);
printf( "frame index:%d,stamp:%d\n", imu_data->frame_index, imu_data->time_stamp );
}
The output of imu data is always seven zeros
I am writing an application using OnboardSDK and I want to take some readings from Guidance, I assume by using the Guidance SDK. How do I include Guidance SDK in my application?
Hi there, in Guidance-SDK/demo/obstacle_bypass , we have a fully autonomous flight. I read and understood code. How do I test it in simulator with dji assistant?
And weather that we can use m100 to goto from one point to one point in NON-GPS use Guidance?
Thanks very much about helpful !!!
Please build shared libraries for 64b ARM platforms. This will add to the range of mobile computers that can be used with the onboard SDK and increase the computational resources available to users.
I got error while trying to compile Guidance SDK USB example for Linux.
I followed this guide: https://developer.dji.com/guidance-sdk/documentation/quick-start/run-examples.html
System information:
> uname -srvmpio
Linux 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Steps to reproduce:
> git clone https://github.com/dji-sdk/Guidance-SDK.git
Cloning into 'Guidance-SDK'...
remote: Counting objects: 1228, done.
remote: Total 1228 (delta 0), reused 0 (delta 0), pack-reused 1228
Receiving objects: 100% (1228/1228), 11.78 MiB | 1.47 MiB/s, done.
Resolving deltas: 100% (537/537), done.
Checking connectivity... done.
> cd Guidance-SDK/examples/usb_example/DJI_guidance_example
> mkdir build
> cd build
> cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /opt/ros/kinetic (found version "3.2.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/eero/temp/test/Guidance-SDK/examples/usb_example/DJI_guidance_example/build
> make
Scanning dependencies of target dji_guidance_usb
[ 33%] Building CXX object CMakeFiles/dji_guidance_usb.dir/main.cpp.o
[ 66%] Building CXX object CMakeFiles/dji_guidance_usb.dir/DJI_utility.cpp.o
[100%] Linking CXX executable dji_guidance_usb
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_get_device_descriptor'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_init'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_detach_kernel_driver'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_open'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_get_device_list'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_exit'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_get_device'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_get_active_config_descriptor'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_bulk_transfer'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_free_device_list'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_claim_interface'
/home/eero/temp/test/Guidance-SDK/so/x64/libDJI_guidance.so: undefined reference to `libusb_free_config_descriptor'
collect2: error: ld returned 1 exit status
CMakeFiles/dji_guidance_usb.dir/build.make:163: recipe for target 'dji_guidance_usb' failed
make[2]: *** [dji_guidance_usb] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dji_guidance_usb.dir/all' failed
make[1]: *** [CMakeFiles/dji_guidance_usb.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Quick question, I don't have my Guidance unit with me to test but I would like to have an official answer on this.
I'm assuming the stereo image pairs are internally synchronized, how do you go about matching the left and right image from a camera module, will they have the same frame_index or the same timestamp? Or both?
Hi,
I'm trying to write a wrapper around your SDK. Unfortunately set_sdk_event_handler
only accepts a function pointer making it unusable with any member function of a class.
Could you possibly overload the function to accept class member functions? As an example you can see here.
Thanks!
Hi.
We are using the guidance as standalone device (without connection to a drone). After subscribing to motion data, by calling select_motion(), a callback function never run. At the same time other subscriptions, like IMU, velocity, work fine.
where we are wrong?!
I've got my guidance connected to my DJI manifold via UART.
I've confirmed guidance works as expected, and I've enabled the UART API in the guidance software.
I've built the Makefile under examples/uart_example.
When I run 'sudo ./uart_example' I get the following:
open uart ok!
set UART port paramster done!
And then the program just hangs and does nothing. Using some debug statements I've narrowed the line that it hangs at. It in on line 148 of linux/serial.cpp
int n = read(g_sdk_uart_fd, buf + read_len, len);
This appears to be an issue with reading from the serial, although it opens the connection fine. I've tried all the UART ports with the same thing happening.
Any ideas would be greatly appreciated.
I am trying to port the UART code in this example to run on an Arduino or STM32 board. : https://github.com/dji-sdk/Guidance-SDK/blob/master/examples/uart_example/main.cpp
I basically only need the ultrasonic sensor data. Does anyone have any reference code for this or can point me in the right direction?
When I run the usb_example, error occurs after run start_transfer, and the error code is 4. What's the problem?
There is a parameter in ultrasonic_data called reliability. It varies from 0 to 65535. I want to know is the bigger one more reliable? or the other way around? And I get 5 direction data, sometimes 2 of the reliability are 1, 1 is of the reliability is 0, the other 2 could be 10000+. Is there any problem?
Hi Guidance Team,
In the source code, Guidance-SDK/demo/obstacle_bypass/discontinuity-balance_strategy/src/dji_sdk/src/dji_sdk_node.cpp, from line 279 to 283. The variable neighbor_count was defined and initialized as zero but never used before line 282. However, it act as a Denominator in line 282. Is this a bug? I think we should add else {neighbor_count++ }
after 279, am I right? Looking forward to your confirmation.
279 if(1.0 - (a_x*b_x + a_y*b_y)/(pow(b_x, 2) + pow(b_y, 2)) > OF_MARGIN) neighbor_diff++;
280 }
281 }
282 if((double)neighbor_diff/(double)neighbor_count > DISC_MARGIN)
283 {
Greetings. Given the following description of our attempt at setting up the Guidance SDK, we have failed to get beyond:
llibusb_get_device_list ret = 10 !!!
Waiting for board ready...
Error: e_stereo_cali_not_ready at 149,main.cpp
----Procedure Used----
Below is my entire process for building and running the USB example code that ships with the DJI Guidance SDK. The steps I follow come from the Developer Guide.
The following was performed on a brand new installation of Ubuntu 14.04.
I download and extract Version 1.0.9 from the libusb website. I extract the files into my /home
directory. I then go into the new directory containing the libusb files and install libusb like so:
$ cd ~/libusb-1.0.9/
$ ./configure
$ make
$ sudo make install
I install g++
and libopencv-dev
:
$ sudo apt-get install g++
$ sudo apt-get install libopencv-dev
I clone the Guidance SDK repository to my /home
directory:
$ cd
$ git clone https://github.com/dji-sdk/Guidance-SDK.git
I then copy the appropriate .so
file to both /usr/local/lib
and the directory containing the USB example code. The .so
files are located in ~/Guidance-SDK/so
. I'm using an x64 machine, so I use the x64 .so
:
$ cd ~/Guidance-SDK/so/x64/
$ sudo cp libDJI_guidance.so /usr/local/lib
$ cp libDJI_guidance.so ~/Guidance-SDK/examples/usb_example/DJI_guidance_example/
$ cd ~/Guidance-SDK/examples/usb_example/DJI_guidance_example/
$ make
I set the following device rule per DJI's instructions. This allows me to use the DJI Guidance without sudo
:
$ sudo sh -c 'echo "SUBSYSTEM==\"usb\", ATTR{idVendor}==\"fff0\", ATTR{idProduct}==\"d009\", MODE=\"0666\"" > /etc/udev/rules.d/51-guidance.rules'
After building the USB example code, I power on the DJI Guidance using a power supply giving 12.2 volts. After the green lights on the Guidance come on, I plug it in via USB and try to run the following:
sudo ./guidance_example
Each time, I get the following output:
llibusb_get_device_list ret = 10 !!!
Waiting for board ready...
Error: e_stereo_cali_not_ready at 149,main.cpp
Any help would be greatly appreciated
Regards
为了省去每次运行Guidance SDK程序都要输入sudo的麻烦,
* 建设*
在 /etc/udev/rules.d 下添加一个规则文件,即 doc/51-guidance.rules. 或者也可以从终端输入下面的这行
应该是建议= =!
Official updates will be handled by DJI SDK staff. If an issue/bug is found in our documents, developers are welcome to correct the error and submit a pull request.
Developers must alert the DJI SDK staff of a pull request through a related discussion, such as on forum.dji.com, bbs.dji.com, github issues or email record. If the pull request is valid, the SDK staff will acknowledge the issue being fixed and accept the pull request.
Pull requests that do not follow this guide will not be accepted.
This section covers document formatting and syntax. You can refer to Github's Mastering Markdown Guides for additional reference.
#
We structure markdown documents through the use of #
symbol to create headers. Multiple #
symbols in a row will format smaller headers. Here is a suggested usage example:
Code
# Document Title
## Main Heading 1
### 1. Subheading 1
## Main Heading 2
### 1. Subheading 1
### 2. Subheading 2
Result
Document Title
Main Heading 1
1. Subheading 1
Main Heading 2
1. Subheading 1
2. Subheading 2
It is important that you follow the example shown above, with a single '#' being used for the document title, '##' being used for section headings, and '###' being used for subheadings. This allows us to generate and organize reading interfaces based on these headings.
Please do not adjust the number of '#' symbols used for the aesthetic purpose of adjusting the side of headings, as shown here:
Code
# Document Title
## Main Heading 1
### 1. Subheading 1
## Main Heading 2
### 1. Subheading 1
### 2. Subheading 2
Result
Document Title
Main Heading 1
1. Subheading 1
Main Heading 2
1. Subheading 1
2. Subheading 2
Markdown allows you to create tables, separating the header with the first row with hyphens '-', and separating each column with a pipe symbol '|'.
Here's an example:
Code
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
Result
First Header | Second Header |
---|---|
Content Cell | Content Cell |
Content Cell | Content Cell |
You can also choose to align cell contents:
Code
| Left Aligned | Center Aligned | Right Aligned |
|:-------------|:----------------:| -------------:|
| Left | Center | Right |
| Left Aligned | Center Aligned | Right Aligned |
Result
Left Aligned | Center Aligned | Right Aligned |
---|---|---|
Left | Center | Right |
Left Aligned | Center Aligned | Right Aligned |
We control text alignment through the colons ':'. The left and right most pipes |
are purely aesthetic, and can be omitted. Blank spaces serve no functional purpose besides code readability.
All images should be stored in the Images
folder. Images should be refered to by their relative path name, rather than an absolute path name.
For example, you should use ![N1UI](Images/N1UI.png)
instead of ![N1UI](https://github.com/dji-sdk/Onboard-SDK/blob/master/Onboard_API_Doc/en/Images/N1UI.png)
Inline code blocks should be wrapped in backticks:
Code
'var example = true'
Result
var example = true
To insert multiple lines of code, used a Fenced Code Block. Surround code with three tildes '~' to format it:
Code
~~~
void get_control_callback(const void* p_data, unsigned int n_size) { }
~~~
Result
void get_control_callback(const void* p_data, unsigned int n_size) { }
Including the name of the language after the opening triple tilde will allow for syntax highlighting:
Code
~~~c
void get_control_callback(const void* p_data, unsigned int n_size) { }
~~~
Result
void get_control_callback(const void* p_data, unsigned int n_size) { }
I tried to obtain depth images and greyscale images of all five sensors using your usb_example with vs2010.
Although the depth image, left-eye image and right-eye image of only one sensor can be obtained successfully, I failed when trying to get all images of all five sensors.
So I wonder if it is possible to obtain and show all images of all sensors in the same time.
Or it failed just due to my poor programming ability.
If it is possible, could you give me any hint to realize it?
Thanks!
Attempting to make /usb_example/DJI_guidance_example on raspbian with g++-4.9.2
After fixing issue #13 in main.cpp...
make -f Makefile_noOpenCV
returns
g++ -g -Wall -I/usr/local/include -I../../../include -c main.cpp DJI_utility.h
g++ -g -Wall -I/usr/local/include -I../../../include -c DJI_utility.cpp DJI_utility.h
g++ -o guidance_example main.o DJI_utility.o -Wl,-rpath,./ -lpthread -lrt -L./ -L/usr/local/lib/ -lDJI_guidance -lusb-1.0
main.o: In function main': /home/pi/Guidance-SDK/examples/usb_example/DJI_guidance_example/main.cpp:178: undefined reference to
select_disparity_image(e_vbus_index)'
/home/pi/Guidance-SDK/examples/usb_example/DJI_guidance_example/main.cpp:185: undefined reference to select_motion()' /home/pi/Guidance-SDK/examples/usb_example/DJI_guidance_example/main.cpp:189: undefined reference to
get_device_type(e_device_type_)'
/home/pi/Guidance-SDK/examples/usb_example/DJI_guidance_example/main.cpp:192: undefined reference to get_image_size(int_, int_)' /home/pi/Guidance-SDK/examples/usb_example/DJI_guidance_example/main.cpp:251: undefined reference to
set_exposure_param(exposure_param)'
/home/pi/Guidance-SDK/examples/usb_example/DJI_guidance_example/main.cpp:273: undefined reference to `select_disparity_image(e_vbus_index)'
collect2: error: ld returned 1 exit status
Makefile_noOpenCV:12: recipe for target 'guidance_example' failed
make: *** [guidance_example] Error 1
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_get_device_descriptor’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_init’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_detach_kernel_driver’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_open’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_get_device_list’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_exit’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_get_device’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_get_active_config_descriptor’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_bulk_transfer’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_free_device_list’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_claim_interface’未定义的引用
/home/kitty/Guidance-SDK-master/demo/catkin_ws/src/include/libDJI_guidance.so:对‘libusb_free_config_descriptor’未定义的引用
collect2: error: ld returned 1 exit status
CMakeFiles/dji_sdk_node.dir/build.make:519: recipe for target '/home/kitty/Guidance-SDK-master/demo/catkin_ws/devel/lib/dji_sdk/dji_sdk_node' failed
make[2]: *** [/home/kitty/Guidance-SDK-master/demo/catkin_ws/devel/lib/dji_sdk/dji_sdk_node] Error 1
CMakeFiles/Makefile2:707: recipe for target 'CMakeFiles/dji_sdk_node.dir/all' failed
make[1]: *** [CMakeFiles/dji_sdk_node.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
I tried to compile the guidance example as described here: https://developer.dji.com/guidance-sdk/documentation/quick-start/run-examples.html, however, I receive the following linking error:
/usr/bin/ld: skipping incompatible /home/ubuntu/DJI/Guidance-SDK/so/TX1/libDJI_guidance.so when searching for -lDJI_guidance
/usr/bin/ld: cannot find -lDJI_guidance
My Jeston TX1 is flashed with the latest L4T image. The Jetson TX1 L4T image I'm using is 24.2.1.
Would it be possible to have a new library .so built for the TX1 for the latest L4T image? If not, would it be possible to download the library and compile/install it instead?
$ make -f Makefile_noOpenCV
g++ -g -Wall -I/usr/local/include -I../../../include -c main.cpp DJI_utility.h main.cpp: In function ‘std::ostream& operator<<(std::ostream&, e_sdk_err_code)’: main.cpp:52:30: error: ‘strcpy’ was not declared in this scope main.cpp: In function ‘int main(int, const char**)’: main.cpp:230:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses] make: *** [main.o] Error 1
In Guidance-SDK/examples/usb_example/DJI_guidance_example/main.cpp
Line 2 reads: #include <string>
and must be changed to: #include <string.h>
for program to compile correctly.
when I run the Obstacle Bypass demo ,it displays follows:
root@tegra-ubuntu:~/Guidance-SDK/demo/obstacle_bypass/balance_strategy# ./devel/lib/dji_sdk/dji_sdk_node
Test SDK Protocol demo
[INIT] SET serial_port : /dev/ttyUSB0
[INIT] SET baud_rate : 230400
[INIT] ACTIVATION INFO :
[INIT] app_id 1010572
[INIT] app_api_level 2
[INIT] app_version 1
[INIT] app_bundle_id 12345678901234567890123456789012��
[INIT] enc_key ca5aed46d675076dd100ec73a8d3b8d3dbeea66392c77af62ac65cf9b5be8520
SerialOpen,24:ERROR
llibusb_get_device_list ret = 6 !!!
Waiting for board ready...
Running Mission...
[ACTIVATION] send acticition msg: 1010572 2 1 49
And it stops here ...So how can I solve the problem? I connect the Guidance with ManiFold through USB.
init_transfer fails with error_code 8 on ubuntu 14.04 x86_64.
I've already calibrated all stereo cameras using guidance assistant on windows.
I cannot guess what's going on inside guidance...
what should i do? what should i check?
hello!
I have succeeded in reading data from Guidance .but I found that the data refresh rate on the window are so fast that my eyes couldn't react with it .I don't know that where to make changes in program to make the data show down .Could you help with me ? thank you !
Is it possible to stream multiple cameras at the same time? Based on what i'm seeing in the API doc, one would have to select one sensor at a time.
We developed a kind of SVO algorithm by applying Feature-Matching and PNP Algorithm, there is a strange phenomenon that our algorithm can give out the trajectory of MAV well if the MAV keeps going straight ahead. But the algorithm can not adapt with turning movement, that is, when the MAV turn around, the algorithm give out a wrong position. We wonder if there is something obviously wrong with rotation matrix. Is there anyone experienced this problem? thanks.
I'm trying to compile and run the sample program, but I getting the error ignoring file /usr/local/include/libDJI_guidance.so, file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x01 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): /usr/local/include/libDJI_guidance.so
when using the x64 or x32 version of the so files.
Anyone a solution for this?
While trying to run the usb_example code on 3 different Linux systems I encountered multiple and completely random errors. I have troubleshot my specific problems to the syntax error described below:
Line 230 shows this if (key > 0)
and then immediately moves into another if statement on Line 231 if(key=='j' || key=='k' || key=='m' || key=='n'){
.
If you notice, Line 230 does not have a {
at the end of the line. When this code is executed and no key is pressed, the if
statement on Line 231 is ignored, but the else
statement on Line 252 is then executed. When running this code on a NVIDIA Jetson TK1, Line 254 destroyAllWindows();
was continuously running through every loop and blocking the system. The same thing was happening with the Raspberry Pi 2.
The quick fix is to put a {
at the end of Line 230 and add a line after Line 276 with a }
.
While I was optimizing the code, I also changed Line 252 else {// switch image direction
to else if(key=='q' || key=='w' || key=='d' || key=='x' || key=='a' || key=='s') {//switch image direction
so that code would only execute when the user pressed one of the 'option' keys.
The program seemed to gain quite a bit of speed and allowed all of the 'options' to be used.
I give an error when I run uart_example
*** stack smashing detected ***: ./uart_example terminated
Aborted
How to fix it?
I want to take some samples from guidance and process it. The executable file is ended after for loop ends and I can not execute functions after for loop. for loop means(for(int i = 0; i < 1000; ++i))
I'm trying to obtain depth images from 4 camera sets. Currently guidance is only capable of outputing 2 depth/disparity maps. Thus I'll have to use on board processing to generate the remaining 2 depth maps. I would like to know what parameters are used for the guidance to generate the depth maps, so I can generate similar maps with opencv stereoBM (to keep data consistent across the cameras).
Also I was reading to through the documentation of get_stereo_cali and noticed that get_stereo_cali does not provide distortion coefficients as the images are rectified. Assuming the cameras are calibrated with the Guidance assistant, are the left and right gray scale images obtained already rectified?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.