From 71ec6129b4ec314b49865296ddf1e6791411641c Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Tue, 26 Mar 2019 10:49:02 +0100 Subject: [PATCH] ready for peters bluetooth uart interface --- .../openCVnaiveObstacleAvoidance.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cpp/openCVnaiveObstacleAvoidance/openCVnaiveObstacleAvoidance.cpp b/cpp/openCVnaiveObstacleAvoidance/openCVnaiveObstacleAvoidance.cpp index 6170396..fe72e4c 100644 --- a/cpp/openCVnaiveObstacleAvoidance/openCVnaiveObstacleAvoidance.cpp +++ b/cpp/openCVnaiveObstacleAvoidance/openCVnaiveObstacleAvoidance.cpp @@ -54,6 +54,11 @@ class MyListener : public IDepthDataListener const uint8_t confidence_threshold_ = 0; const double distance_threshold_ = 80; + const string bobbycar_stop = "s"; + const string bobbycar_forward = "f"; + const string bobbycar_left = "l"; + const string bobbycar_right = "r"; + public : @@ -266,16 +271,22 @@ private: assert(num_dist_columns_ == 4); if (free_paths[1] && free_paths[2]) { - std::cout << "GOSTRAIGHT" << std::endl; + //std::cout << "GOSTRAIGHT" << std::endl; + std::cout << bobbycar_forward << std::endl; } else if (free_paths[0]) { - std::cout << "GOLEFT" << std::endl; + std::cout << bobbycar_left << std::endl; + // std::cout << "GOLEFT" << std::endl; } else if (free_paths[3]) { - std::cout << "GORIGHT" << std::endl; + // std::cout << "GORIGHT" << std::endl; + std::cout << bobbycar_right << std::endl; } else { - std::cout << "STOP" << std::endl; + // std::cout << "STOP" << std::endl; + std::cout << bobbycar_stop << std::endl; } + } else { + std::cout << bobbycar_forward << std::endl; } } -- 1.7.10.4