shadow1runner/qgroundcontrol

CA Algorithm should stop as soon as it triggers the collisionImmanent event

Closed this issue · 4 comments

Features to #21

OwnFlowWorker.cpp starts to emit double frames (the same frame twice), starting from frame mavlink#76, if

        QMetaObject::invokeMethod(&_converter, "convertImage", Q_ARG(cv::Mat, currentFrame));

instead of

        // _converter.convertImage(currentFrame);

the method is invoked properly

And the really weird thing:
OwnFlow emits these frames itself :o

OF: # 67 QDateTime(2016-05-27 08:41:49.216 UTC Qt::TimeSpec(UTC))
OF: # 68 QDateTime(2016-05-27 08:41:49.338 UTC Qt::TimeSpec(UTC))
OF: # 69 QDateTime(2016-05-27 08:41:49.470 UTC Qt::TimeSpec(UTC))
OF: # 70 QDateTime(2016-05-27 08:41:49.555 UTC Qt::TimeSpec(UTC))
OF: # 71 QDateTime(2016-05-27 08:41:49.664 UTC Qt::TimeSpec(UTC))
OF: # 0 QDateTime(2016-05-27 08:41:49.764 UTC Qt::TimeSpec(UTC))
OF: # 1 QDateTime(2016-05-27 08:41:49.847 UTC Qt::TimeSpec(UTC))
OF: # 2 QDateTime(2016-05-27 08:41:49.921 UTC Qt::TimeSpec(UTC))
OF: # 3 QDateTime(2016-05-27 08:41:50.021 UTC Qt::TimeSpec(UTC))
OF: # 4 QDateTime(2016-05-27 08:41:50.108 UTC Qt::TimeSpec(UTC))
OF: # 5 QDateTime(2016-05-27 08:41:50.212 UTC Qt::TimeSpec(UTC))

The reasons why this happens is the following: OwnFlow gets a reset() signal and resets its frame counter - the converterThread, however, is not yet stopped (Note the Resetting OwnFlowWorker line)

DP: # of UI frames ready:  65
FP - : # 17 QDateTime(2016-05-27 08:41:49.239 UTC Qt::TimeSpec(UTC))
FP - : # 18 QDateTime(2016-05-27 08:41:49.266 UTC Qt::TimeSpec(UTC))
Measured FoE: ( 91 ,  71 ),     Inliers:  860  /  200000    0.43 %
Collision level lowered by 1 to  2
OF: # 68 QDateTime(2016-05-27 08:41:49.338 UTC Qt::TimeSpec(UTC))
Frame # 69
DP: # of UI frames ready:  66
Resetting OwnFlowWorker on Thread 0x7fffa7014700
Pausing OwnFlowWorker on Thread 0x7fffa7014700
Measured FoE: ( 90 ,  75 ),     Inliers:  984  /  200000    0.492 %
Collision level raised by 1 to  3
OF: # 69 QDateTime(2016-05-27 08:41:49.470 UTC Qt::TimeSpec(UTC))
Frame # 70

And the stack trace causing OwnFlowWorker::reset() is:

1  OwnFlowWorker::pause                                                       OwnFlowWorker.cpp     116 0x7e8a90       
2  OwnFlowWorker::reset                                                       OwnFlowWorker.cpp     145 0x7e8cd5       
3  OwnFlowWorker::start                                                       OwnFlowWorker.cpp     111 0x7e8a20   
...