fcu_motor_test.cpp
Go to the documentation of this file.
1 
15 #include <FlightController.hpp>
16 
17 int main(int argc, char *argv[]) {
18  const std::string device =
19  (argc > 1) ? std::string(argv[1]) : "/dev/ttyUSB0";
20  const size_t baudrate = (argc > 2) ? std::stoul(argv[2]) : 115200;
21 
23  fcu.connect(device, baudrate);
24 
25  // spin motors 1 to 4
26  fcu.setMotors({{1100, 1100, 1100, 1100, 0, 0, 0, 0}});
27 
28  std::this_thread::sleep_for(std::chrono::seconds(1));
29 
30  // stop motors
31  fcu.setMotors({{1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000}});
32 }
bool setMotors(const std::array< uint16_t, msp::msg::N_MOTOR > &motor_values)
Directly sets motor values using SetMotor message.
int main(int argc, char *argv[])
bool connect(const std::string &device, const size_t baudrate=115200, const double &timeout=0.0, const bool print_info=false)
Connects to a physical flight controller, which includes connecting the internal Client object and qu...


msp
Author(s): Christian Rauch
autogenerated on Tue Oct 6 2020 03:38:57