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