sr_hand_detector_node.cpp
Go to the documentation of this file.
1 /*
2 * Copyright 2020 Shadow Robot Company Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16 
18 #include <string>
19 #include <map>
20 #include <utility>
21 #include <iostream>
22 #include <fstream>
23 #include "yaml-cpp/yaml.h"
24 
25 int main(int argc, char** argv)
26 {
28  sr_hand_detector.run();
29  auto hand_serial_to_port_map = sr_hand_detector.get_hand_serial_to_port();
30 
31  if (hand_serial_to_port_map.empty())
32  {
33  std::cout << "No hand detected on any of the ports!" << std::endl;
34  }
35 
36  YAML::Node hand_serial_to_port_map_yaml;
37  for (auto const& serial_to_port : hand_serial_to_port_map)
38  {
39  std::cout << "Detected hand on port: " << serial_to_port.second << std::endl;
40  std::cout << "Hand's serial number: " << serial_to_port.first << std::endl;
41  hand_serial_to_port_map_yaml[serial_to_port.first] = serial_to_port.second;
42  }
43 
44  std::ofstream fout("/tmp/sr_hand_detector.yaml");
45  fout << hand_serial_to_port_map_yaml;
46  return 0;
47 }
sr_hand_detector::SrHandDetector
Definition: sr_hand_detector.h:31
main
int main(int argc, char **argv)
Definition: sr_hand_detector_node.cpp:25
sr_hand_detector
Definition: sr_hand_autodetect.h:27
sr_hand_detector.h


sr_hand_detector
Author(s):
autogenerated on Sat Sep 24 2022 02:26:10