Go to the documentation of this file.00001 #include <iostream>
00002 #include <chrono>
00003 #include <thread>
00004
00005 #include <boost/program_options.hpp>
00006 #include <crazyflie_cpp/Crazyflie.h>
00007
00008 int main(int argc, char **argv)
00009 {
00010
00011 std::string uri;
00012 std::string defaultUri("radio://0/80/2M/E7E7E7E7E7");
00013
00014 namespace po = boost::program_options;
00015
00016 po::options_description desc("Allowed options");
00017 desc.add_options()
00018 ("help", "produce help message")
00019 ("uri", po::value<std::string>(&uri)->default_value(defaultUri), "unique ressource identifier")
00020 ;
00021
00022 try
00023 {
00024 po::variables_map vm;
00025 po::store(po::parse_command_line(argc, argv, desc), vm);
00026 po::notify(vm);
00027
00028 if (vm.count("help")) {
00029 std::cout << desc << "\n";
00030 return 0;
00031 }
00032 }
00033 catch(po::error& e)
00034 {
00035 std::cerr << e.what() << std::endl << std::endl;
00036 std::cerr << desc << std::endl;
00037 return 1;
00038 }
00039
00040 try
00041 {
00042 Crazyflie cf(uri);
00043
00044 std::cout << "firmware version: " << cf.getFirmwareVersion() << std::endl;
00045 std::cout << "protocol version: " << cf.getProtocolVersion() << std::endl;
00046 std::cout << "device type name: " << cf.getDeviceTypeName() << std::endl;
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 return 0;
00087 }
00088 catch(std::exception& e)
00089 {
00090 std::cerr << e.what() << std::endl;
00091 return 1;
00092 }
00093 }