rotationInvariantObjectsRotator.cpp
Go to the documentation of this file.
1 
19 
20 #include <string>
21 #include <vector>
22 #include <boost/program_options.hpp>
23 #include <fstream>
24 
25 /*
26  * Command line tool to rotate coordinates system of rotation invariant objects in a given database, so that an object has a fixed
27  * orientation to the map frame or to a reference object.
28  * - Currently just objects of type Cup and PlateDeep are normalized to avoid dependencies to object_database ROS package.
29  * - If rotation to map frame is asked, tool expects data to be already given in map frame.
30  *
31  * Usage:
32  * - map frame as reference:
33  * ./rotationInvariantRotator -s <path-to-source-file> -t <path-to-target-file>
34  *
35  * - object as reference:
36  * ./rotationInvariantRotator -s <path-to-source-file> -t <path-to-target-file> -i <object-identifier> -o <object-type>
37  */
38 
39 using namespace ISM;
40 using namespace std;
41 namespace po = boost::program_options;
42 
43 
44 int main (int argc, char** argv) {
45  po::options_description desc("Allowed options");
46  desc.add_options()
47  ("help,h", "produce help message")
48  ;
49 
50  po::options_description required("Required");
51  required.add_options()
52  ("source-file,s", po::value<string>(), "source file")
53  ("target-file,t", po::value<string>(), "target file");
54  desc.add(required);
55 
56  po::options_description optional("Optional");
57  optional.add_options()
58  ("object-type,o", po::value<string>(), "Object type")
59  ("object-id,i", po::value<string>(), "Object id");
60  desc.add(optional);
61 
62 
63  po::variables_map vm;
64  po::store(po::parse_command_line(argc, argv, desc), vm);
65  po::notify(vm);
66 
67  if (vm.count("help") || !vm.count("source-file") || !vm.count("target-file")) {
68  cout << desc << endl;
69  return 1;
70  }
71 
72  string objectType;
73  string objectId;
74 
75  bool useMapFrame = false;
76  if (!vm.count("object-type") || !vm.count("object-id")) {
77  cout << "object-type/object-id are not set" << endl;
78  cout << "!!!!!!!Reference object is map frame!!!!!!!" << endl;
79  useMapFrame = true;
80  } else {
81  objectType = vm["object-type"].as<string>();
82  objectId = vm["object-id"].as<string>();
83  }
84 
85  string sourceFile = vm["source-file"].as<string>();
86  string targetFile = vm["target-file"].as<string>();
87 
88  vector<string> rotationInvariantTypes;
89  rotationInvariantTypes.push_back("Cup");
90  rotationInvariantTypes.push_back("PlateDeep");
91 
92  //actual rotation process
94  rotator.rotateRotationInvariantObjects(sourceFile, targetFile, objectType, objectId, useMapFrame, rotationInvariantTypes);
95 
96 }
int main(int argc, char **argv)
void rotateRotationInvariantObjects(const std::string &sourceFile, const std::string &targetFile, const std::string &objectType, const std::string &objectId, bool useMapFrame, const std::vector< std::string > &rotationInvariantTypes)
this namespace contains all generally usable classes.


asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:40