Skip to content
Snippets Groups Projects
Commit 24069150 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fixes #79 infinite loop in vision node

parent 353f01ef
No related branches found
No related tags found
No related merge requests found
Pipeline #11417 passed
...@@ -95,16 +95,20 @@ static void run(ftl::Configurable *root) { ...@@ -95,16 +95,20 @@ static void run(ftl::Configurable *root) {
Streamer *stream = ftl::create<Streamer>(root, "stream", net); Streamer *stream = ftl::create<Streamer>(root, "stream", net);
stream->add(source); stream->add(source);
stream->run();
net->start(); net->start();
LOG(INFO) << "Running...";
while (ftl::running && display->active()) { LOG(INFO) << "Running...";
cv::Mat rgb, depth; if (display->hasDisplays()) {
source->getFrames(rgb, depth); stream->run();
if (!rgb.empty()) display->render(rgb, depth, source->parameters()); while (ftl::running && display->active()) {
display->wait(10); cv::Mat rgb, depth;
source->getFrames(rgb, depth);
if (!rgb.empty()) display->render(rgb, depth, source->parameters());
display->wait(10);
}
} else {
stream->run(true);
} }
LOG(INFO) << "Stopping..."; LOG(INFO) << "Stopping...";
......
...@@ -43,6 +43,8 @@ class Display : public ftl::Configurable { ...@@ -43,6 +43,8 @@ class Display : public ftl::Configurable {
bool render(const cv::Mat &img, style_t s=STYLE_NORMAL); bool render(const cv::Mat &img, style_t s=STYLE_NORMAL);
bool active() const; bool active() const;
bool hasDisplays();
void wait(int ms); void wait(int ms);
......
...@@ -243,6 +243,10 @@ bool Display::render(const cv::Mat &img, style_t s) { ...@@ -243,6 +243,10 @@ bool Display::render(const cv::Mat &img, style_t s) {
return true; return true;
} }
bool Display::hasDisplays() {
return value("depth", false) || value("left", false) || value("right", false) || value("points", false);
}
void Display::wait(int ms) { void Display::wait(int ms) {
if (value("points", false)) { if (value("points", false)) {
#if defined HAVE_PCL #if defined HAVE_PCL
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment