mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 11:55:00 +00:00
changed function
This commit is contained in:
@@ -33,16 +33,13 @@ void setup()
|
||||
void checkKobukiConnection() {
|
||||
while (true) {
|
||||
bool connected = robot.isConnected();
|
||||
if (connected && !kobuki_connected) {
|
||||
cout << "Kobuki is connected" << endl;
|
||||
kobuki_connected = true;
|
||||
// Start de Kobuki automatisch
|
||||
robot.startCommunication("/dev/ttyUSB0", true, nullptr);
|
||||
} else if (!connected && kobuki_connected) {
|
||||
if (!connected && kobuki_connected) {
|
||||
cout << "Kobuki is disconnected" << endl;
|
||||
kobuki_connected = false;
|
||||
// Stop de Kobuki automatisch
|
||||
robot.sendNullMessage();
|
||||
} else if (connected && !kobuki_connected) {
|
||||
cout << "Kobuki is connecting..." << endl;
|
||||
// Start de Kobuki automatisch
|
||||
robot.startCommunication("/dev/ttyUSB0", true, nullptr);
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::seconds(5)); // Controleer elke 5 seconden
|
||||
}
|
||||
|
Reference in New Issue
Block a user