dji-sdk / Guidance-SDK-ROS

The official ROS package of Guidance SDK for 32/64 bit Ubuntu and XU3
80 stars 87 forks source link

guidanceNode publishes only one message per topic (except image) upon startup #15

Closed asiron closed 8 years ago

asiron commented 8 years ago

We are having an issue, where guidanceNode doesn't continuously publish messages on all topic except image topics. Once we run the node, we get a single message on all topics and then we just receive images. I checked and the sdk callback is simply receiving frames with data_type == e_image.

We are running the latest firmware 1.4.0 with DIY mode switched on, enough bandwidth on the USB bus and the output frequencies in the DJI Guidance software (v1.3) set to:

IMU: 20Hz
Ultrasonic: 20Hz
Velocity: 10Hz
Obstacle: 20Hz 

Strange thing is that we disabled all the cameras in the DJI Guidance Software, but we are still getting images on the topics.

buqing2009 commented 8 years ago

I have the same problem @tangketan @madratman

madratman commented 8 years ago

I had the same problem as well some time back. Forgot to report earlier (p.s. I'm not affliated with DJI, I just added a simple node to use ROS stereo image proc as mentioned in the readme)

tangketan commented 8 years ago

This bug is fixed in commit e4e546105bcc1dd09ccf1beee51c91660f6f3cb9. I'll close it if no further bug reported.

asiron commented 8 years ago

e4e5461 is my commit and it fixes another problem with message type mismatch. The problem we have right now, however seems to be related with the library itself, since we do not receive callbacks with data other than images, we have to restart the node, which re-initializes the library.

buqing2009 commented 8 years ago

I found the bug, both Guidance-SDK and Guidance-SDK-ROS have the same bug. When change VBUS ID for changing camera it must run the function stop_transfer() and change ID or do something, then restart transfer. Here is the bug , when the Guidance stop transfer, it will not callback any messages, but when restart transfer, only receiving images without other messages. But the core code of Guidance is not open source, so the workaround is annotating this code:

else {// switch image direction
                err_code = stop_transfer();
                RETURN_IF_ERR(err_code);
                reset_config();

                if (key == 'q') break;
                if (key == 'w') CAMERA_ID = e_vbus1;
                if (key == 'd') CAMERA_ID = e_vbus2;
                if (key == 'x') CAMERA_ID = e_vbus3;
                if (key == 'a') CAMERA_ID = e_vbus4;       
                if (key == 's') CAMERA_ID = e_vbus5;

                select_greyscale_image(CAMERA_ID, true);
                select_greyscale_image(CAMERA_ID, false);
                select_depth_image(CAMERA_ID);

                err_code = start_transfer();
                RETURN_IF_ERR(err_code);
                key = 0;
            }

and you should assign CAMERA_ID to the vbus id you would like. Waiting for DJI to fix this bug as soon as possible. @tangketan

tangketan commented 8 years ago

The reason is, I only subscribe to image data when changing CAMERA_ID for simplicity. Since it caused confusion for you guys, I add all the data subscriptions back. Please check the commit dc03d8eab8cb776ec1301d6b62ce7e7de1d78382.

buqing2009 commented 8 years ago

It works, thanks.