-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
50 lines (43 loc) · 1019 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "test.hpp"
namespace acc
{
void
cin_runner(acc::UAV uav, int* main_loop) {
bool run = true;
std::string cmd;
double value;
while(run) {
std::cout << "Enter cmd and value: " << std::endl;
std::cin >> cmd >> value;
if (cmd == "exit") {
run = false;
} else if (cmd == "t") { // thrust
} else if (cmd == "p") { // thrust
uav.frame.pitch.write(static_cast<int>(value));
} else if (cmd == "?") { // thrust
std::cout << "??????" << std::endl;
}
}
*main_loop = 0;
}
};
int
main() {
using namespace acc;
int main_loop = 1;
std::string port = "/dev/tty.usbserial-A504DRSI";
UAV uav(port, B57600, CTRL_MODE::DIMC);
std::thread cin_thread(&cin_runner, uav, &main_loop);
while (main_loop == 1) {
sleep(1);
}
// testcase();
// testcase2();
// testcase3();
// testcase_read();
// testcase_motors_dynamics();
// testcase_motors_dynamics_engine();
// testcase_motors_start_stop();
cin_thread.join();
return 0;
}