mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-04 04:14:58 +00:00
making a loop so it doesnt stop
This commit is contained in:
@@ -15,32 +15,30 @@ int main() {
|
|||||||
unsigned char *null_ptr(0);
|
unsigned char *null_ptr(0);
|
||||||
robot.startCommunication("/dev/ttyUSB0", true, null_ptr);
|
robot.startCommunication("/dev/ttyUSB0", true, null_ptr);
|
||||||
usleep(1 * 1000 * 1000);
|
usleep(1 * 1000 * 1000);
|
||||||
std::cout << "choose between forward and rotate" << endl;
|
|
||||||
thread mv(command);
|
thread mv(command);
|
||||||
usleep(30 * 1000 * 1000);
|
usleep(30 * 1000 * 1000);
|
||||||
mv.join(); // only exit once thread one is done running
|
mv.join(); // only exit once thread one is done running
|
||||||
|
|
||||||
while (true) {
|
|
||||||
command();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int checkCenterCliff() {
|
int checkCenterCliff() {
|
||||||
while (true) {
|
while (true) {
|
||||||
std::cout << "cliffsensordata:" << robot.parser.data.CliffSensorCenter << std::endl;
|
std::cout << "cliffsensordata:" << robot.parser.data.CliffSensorCenter
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int checkWheelDrop() {
|
int checkWheelDrop() {
|
||||||
while (true) {
|
while (true) {
|
||||||
std::cout << "wheeldropdata:" << robot.parser.data.WheelDropLeft << std::endl;
|
std::cout << "wheeldropdata:" << robot.parser.data.WheelDropLeft
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int command() {
|
int command() {
|
||||||
char input;
|
char input;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
std::cout << "choose between forward and rotate" << endl;
|
||||||
std::cout << "What must the robot do?";
|
std::cout << "What must the robot do?";
|
||||||
std::cin >> input;
|
std::cin >> input;
|
||||||
|
|
||||||
@@ -64,3 +62,4 @@ int command() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user