13 Commits

Author SHA1 Message Date
b86528595e change camera 2024-12-11 16:51:01 +01:00
eef4f9c79c revert video format change 2024-12-11 16:39:45 +01:00
3c23d37be1 change video format 2024-12-11 16:37:01 +01:00
c2886d32c9 use libcamera with picam 2024-12-11 16:30:14 +01:00
8158c85d6e use astra backend 2024-12-11 16:12:16 +01:00
e682969ec8 code revert 2024-12-11 16:07:26 +01:00
0dfc3b5c13 attempt with gstreamer 2024-12-11 15:43:05 +01:00
7f786d5197 change camera logic 2024-12-11 15:37:31 +01:00
60ba177dc2 add pipeline for picam 2024-12-11 15:34:53 +01:00
e9f998b3e7 set V4L2 backend 2024-12-11 15:28:21 +01:00
7eeaba482e removed attempt for camera detection 2024-12-11 14:50:02 +01:00
e8db00120f update video camera logic 2024-12-11 14:47:29 +01:00
c65f310e81 cleanup 2024-12-11 14:46:58 +01:00

View File

@@ -30,9 +30,6 @@ void setup()
int main()
{
// Unset the http_proxy environment variable
setup();
std::thread image (CapnSend);
std::thread safety([&]() { robot.robotSafety(&message); });
@@ -41,6 +38,7 @@ int main()
while(true){
parseMQTT(readMQTT());
}
sendMqtt.join();
safety.join();
image.join();
@@ -63,7 +61,7 @@ void parseMQTT(std::string message)
{
if (message == "up")
{
robot.forward(1024);
robot.forward(350);
}
else if (message == "left")
{
@@ -75,7 +73,7 @@ void parseMQTT(std::string message)
}
else if (message == "down")
{
robot.forward(-800);
robot.forward(-350);
}
else if (message == "stop")
{
@@ -283,9 +281,8 @@ void sendKobukiData(TKobukiData &data) {
}
}
void CapnSend() {
VideoCapture cap(1); // Open the default camera
VideoCapture cap("/dev/media3");
if (!cap.isOpened()) {
cerr << "Error: Could not open camera" << endl;
return;
@@ -305,8 +302,9 @@ void CapnSend() {
auto* enc_msg = reinterpret_cast<unsigned char*>(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
}
}
}