diff --git a/src/C++/Driver/src/main.cpp b/src/C++/Driver/src/main.cpp index c8693b2..1a7b28d 100644 --- a/src/C++/Driver/src/main.cpp +++ b/src/C++/Driver/src/main.cpp @@ -281,12 +281,12 @@ void sendKobukiData(TKobukiData &data) { } } - void CapnSend() { - // Use OpenNI2 backend to access the Astra camera - VideoCapture cap(cv::CAP_OPENNI2); + // Use GStreamer pipeline to access the Astra camera with libcamera + std::string pipeline = "libcamerasrc ! video/x-raw,width=640,height=480,framerate=30/1 ! videoconvert ! appsink"; + VideoCapture cap(pipeline, cv::CAP_GSTREAMER); if (!cap.isOpened()) { - cerr << "Error: Could not open Astra camera with OpenNI2 backend" << endl; + cerr << "Error: Could not open camera with GStreamer pipeline" << endl; return; } @@ -304,8 +304,9 @@ void CapnSend() { auto* enc_msg = reinterpret_cast(buf.data()); // Publish the image data - client.publishMessage("kobuki/cam-", string(enc_msg, enc_msg + buf.size())); + client.publishMessage("kobuki/cam", string(enc_msg, enc_msg + buf.size())); cout << "Sent image" << endl; - std::this_thread::sleep_for(std::chrono::milliseconds(400)); // Send image every 1000ms + + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); // Send image every 1000ms } -} +} \ No newline at end of file