listLogVariables.cpp
Go to the documentation of this file.
1 #include <iostream>
2 
3 #include <boost/program_options.hpp>
4 #include <crazyflie_cpp/Crazyflie.h>
5 
6 int main(int argc, char **argv)
7 {
8 
9  std::string uri;
10  std::string defaultUri("radio://0/80/2M/E7E7E7E7E7");
11 
12  namespace po = boost::program_options;
13 
14  po::options_description desc("Allowed options");
15  desc.add_options()
16  ("help", "produce help message")
17  ("uri", po::value<std::string>(&uri)->default_value(defaultUri), "unique ressource identifier")
18  ;
19 
20  try
21  {
22  po::variables_map vm;
23  po::store(po::parse_command_line(argc, argv, desc), vm);
24  po::notify(vm);
25 
26  if (vm.count("help")) {
27  std::cout << desc << "\n";
28  return 0;
29  }
30  }
31  catch(po::error& e)
32  {
33  std::cerr << e.what() << std::endl << std::endl;
34  std::cerr << desc << std::endl;
35  return 1;
36  }
37 
38  try
39  {
40  Crazyflie cf(uri);
41  cf.requestLogToc();
42 
43  std::for_each(cf.logVariablesBegin(), cf.logVariablesEnd(),
44  [](const Crazyflie::LogTocEntry& entry)
45  {
46  std::cout << entry.group << "." << entry.name << " (";
47  switch (entry.type) {
49  std::cout << "uint8";
50  break;
52  std::cout << "int8";
53  break;
55  std::cout << "uint16";
56  break;
58  std::cout << "int16";
59  break;
61  std::cout << "uint32";
62  break;
64  std::cout << "int32";
65  break;
67  std::cout << "float";
68  break;
70  std::cout << "fp16";
71  break;
72  }
73  std::cout << ")";
74  std::cout << std::endl;
75  }
76  );
77 
78  return 0;
79  }
80  catch(std::exception& e)
81  {
82  std::cerr << e.what() << std::endl;
83  return 1;
84  }
85 }
void requestLogToc(bool forceNoCache=false)
Definition: Crazyflie.cpp:586
uint8_t error
std::vector< LogTocEntry >::const_iterator logVariablesEnd() const
int main(int argc, char **argv)
std::vector< LogTocEntry >::const_iterator logVariablesBegin() const


crazyflie_tools
Author(s): Wolfgang Hoenig
autogenerated on Mon Sep 28 2020 03:40:15