mavlink / qgroundcontrol

Cross-platform ground control station for drones (Android, iOS, Mac OS, Linux, Windows)
http://qgroundcontrol.io
3.27k stars 3.6k forks source link

Joystick timing #4218

Open nanthony21 opened 7 years ago

nanthony21 commented 7 years ago

I was wondering if there is a good reason to do the timing of the joystick Manual Control messages in the current way rather than using a qtimer to repetitively call the Joystick::run function.

Currently it is done using a while loop with a delay to limit the frequency that the loop runs at. https://github.com/mavlink/qgroundcontrol/blob/9da1f5f8d4bfd48f2dfb8488489cf385179b1fe8/src/Joystick/Joystick.cc#L385

However I have noticed that when you switch between different tabs of QGC this function will often be delayed by 600-1000 ms.

DonLakeFlyer commented 7 years ago

Since joystick runs in it’s own thread changing to timer won’t really make it any different. The reason for the delay is that the manual_control messages actually go out on the ui thread. So when the ui thread gets busy they get delayed. Fixing that would require making message sending to the vehicle thread-safe which is not currently the case. Doable but a bunch of work.

On Nov 15, 2016, at 6:56 PM, nanthony21 notifications@github.com<mailto:notifications@github.com> wrote:

I was wondering if there is a good reason to do the timing of the joystick Manual Control messages in the current way rather than using a qtimer to repetitively call the Joystick::run function.

Currently it is done using a while loop with a delay to limit the frequency that the loop runs at. https://github.com/mavlink/qgroundcontrol/blob/9da1f5f8d4bfd48f2dfb8488489cf385179b1fe8/src/Joystick/Joystick.cc#L385

However I have noticed that when you switch between different tabs of QGC this function will often be delayed by 600-1000 ms.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mavlink/qgroundcontrol/issues/4218, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFmscwSQuyjhFw44mPRPagkfIO4wybvJks5q-nDfgaJpZM4KzSkq.