X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=cpp%2FopenCVnaiveObstacleAvoidance%2FopenCVnaiveObstacleAvoidance.cpp;h=5849e230eed226f0fd7943c2aee151569e7005be;hb=2797a0bcf45a0f16d07877723f4f60d76d7ed6e6;hp=61703965c4d1e0b8fb5802a5491b623ef3aef298;hpb=8da8ac91e283eace7660aaf8887de9d60026d099;p=201903hackathon.git diff --git a/cpp/openCVnaiveObstacleAvoidance/openCVnaiveObstacleAvoidance.cpp b/cpp/openCVnaiveObstacleAvoidance/openCVnaiveObstacleAvoidance.cpp index 6170396..5849e23 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; } } @@ -323,7 +334,7 @@ int main (int argc, char *argv[]) { // if no argument was given try to open the first connected camera royale::Vector camlist (manager.getConnectedCameraList()); - cout << "Detected " << camlist.size() << " camera(s)." << endl; + //cout << "Detected " << camlist.size() << " camera(s)." << endl; if (!camlist.empty()) { @@ -393,7 +404,9 @@ int main (int argc, char *argv[]) // set an operation mode - if (cameraDevice->setUseCase ("MODE_5_45FPS_500") != royale::CameraStatus::SUCCESS) + // if (cameraDevice->setUseCase ("MODE_5_45FPS_500") != royale::CameraStatus::SUCCESS) + // if (cameraDevice->setUseCase ("MODE_9_10FPS_1000") != royale::CameraStatus::SUCCESS) + if (cameraDevice->setUseCase ("MODE_9_5FPS_2000") != royale::CameraStatus::SUCCESS) { cerr << "Error setting use case" << endl; return 1;