recordedObjectsTransformer.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 transform the absolute pose of an entire scene relative to a world coordinate frame.
27  * (All absolute poses of recorded objects in a given database are transformed into poses relative to a given object, before the expected pose of this object in world frame is applied on all of them.)
28  *
29  * Usage:
30  * ./recordedObjectsTransformer
31  * -s <path-to-source-database>
32  * -t <path-to-target-database> (does not need to be existence)
33  * -S <reference-object-type>
34  * -I <corresponding-object-id>
35  * -x -y -z <absolut-position-of-reference-object>
36  * -W -X -Y -Z <absolute-orientation-quaternion-of-reference-object>
37  *
38  * Example:
39  * ./recordedObjectsTransformer -s /PATH/SOURCE_DATABASE.sqlite -t /PATH/TARGET_DATABASE.sqlite -S marker_5 -I 052052051100 -x -1.5 -y 0.5 -z 0.7 -W 0.289 -X -0.242 -Y -0.642 -Z 0.667
40  *
41  */
42 
43 using namespace ISM;
44 using namespace std;
45 namespace po = boost::program_options;
46 
47 
48 int main (int argc, char** argv) {
49  po::options_description desc("Allowed options");
50  desc.add_options()
51  ("help,h", "produce help message")
52  ;
53 
54  po::options_description required("Required");
55  required.add_options()
56  ("source-file,s", po::value<string>(), "source file")
57  ("target-file,t", po::value<string>(), "target file")
58  ("source-object-type,S", po::value<string>(), "source object type")
59  ("source-object-id,I", po::value<string>(), "source object ID")
60  ("px,x", po::value<double>(), "Point x")
61  ("py,y", po::value<double>(), "Point y")
62  ("pz,z", po::value<double>(), "Point z")
63  ("qw,W", po::value<double>(), "Quaternion W")
64  ("qx,X", po::value<double>(), "Quaternion X")
65  ("qy,Y", po::value<double>(), "Quaternion Y")
66  ("qz,Z", po::value<double>(), "Quaternion Z")
67  ;
68 
69  desc.add(required);
70 
71  po::variables_map vm;
72  po::store(po::parse_command_line(argc, argv, desc), vm);
73  po::notify(vm);
74 
75  if (vm.count("help") || !vm.count("source-file") || !vm.count("target-file") || !vm.count("source-object-type") || !vm.count("source-object-id")
76  || !vm.count("px") || !vm.count("py") || !vm.count("pz") || !vm.count("qw") || !vm.count("qx") || !vm.count("qy") || !vm.count("qz")) {
77  cout << desc << "\n";
78  return 1;
79  }
80 
81  string sourceFile = vm["source-file"].as<string>();
82  string targetFile = vm["target-file"].as<string>();
83  string type = vm["source-object-type"].as<string>();
84  string id = vm["source-object-id"].as<string>();
85  double px = vm["px"].as<double>();
86  double py = vm["py"].as<double>();
87  double pz = vm["pz"].as<double>();
88  double qw = vm["qw"].as<double>();
89  double qx = vm["qx"].as<double>();
90  double qy = vm["qy"].as<double>();
91  double qz = vm["qz"].as<double>();
92 
93  //actual transform process
94  RecordedObjectsTransformer objects_transformer;
95  objects_transformer.transformRecordedObjects(sourceFile, targetFile, type, id, px, py, pz, qw, qx, qy, qz);
96 }
int main(int argc, char **argv)
void transformRecordedObjects(const std::string &sourceFile, const std::string &targetFile, const std::string &type, const std::string &id, double px, double py, double pz, double qw, double qx, double qy, double qz)
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