recorded_objects_transformer.cpp
Go to the documentation of this file.
1 
18 //Global includes
19 
20 
21 
22 //Pkg includes
23 #include <ros/ros.h>
24 
25 
26 //ISM includes
27 #include <ISM/tools/RecordedObjectsTransformer.hpp>
28 
29 
30 bool getNodeParameters(ros::NodeHandle nh, std::string& source_file, std::string& target_file, std::string& object_type, std::string& object_id,
31  std::vector<double>& position, std::vector<double>& orientation)
32 {
33  bool success = true;
34 
35  if (!nh.getParam("source", source_file) || source_file.empty())
36  {
37  ROS_INFO("Missing parameter: \"source\"");
38  success = false;
39  }
40  else
41  {
42  ROS_INFO_STREAM("source: " << source_file);
43  }
44 
45  if (!nh.getParam("target", target_file) || target_file.empty())
46  {
47  ROS_INFO("Missing parameter: \"target\"");
48  success = false;
49  }
50  else
51  {
52  ROS_INFO_STREAM("target: " << target_file);
53  }
54 
55  if (!nh.getParam("object_type", object_type) || object_type.empty())
56  {
57  ROS_INFO("Missing parameter: \"object_type\"");
58  success = false;
59  }
60  else
61  {
62  ROS_INFO_STREAM("object_type: " << object_type);
63  }
64 
65  if (!nh.getParam("object_id", object_id) || object_id.empty())
66  {
67  ROS_INFO("Missing parameter: \"object_id\"");
68  success = false;
69  }
70  else
71  {
72  ROS_INFO_STREAM("object_id: " << object_id);
73  }
74 
75  if (!nh.getParam("position", position) || position.size() != 3)
76  {
77  ROS_INFO("Missing or not full defined parameter: \"position\"");
78  success = false;
79  }
80  else
81  {
82  ROS_INFO_STREAM("position: " << position[0] << " " << position[1] << " " << position[2]);
83  }
84 
85  if (!nh.getParam("orientation", orientation) || orientation.size() != 4)
86  {
87  ROS_INFO("Missing or not full defined parameter: \"orientation\"");
88  success = false;
89  }
90  else
91  {
92  ROS_INFO_STREAM("orientation: " << orientation[0] << " " << orientation[1] << " " << orientation[2] << " " << orientation[3]);
93  }
94 
95  return success;
96 }
97 
98 int main (int argc, char **argv)
99 {
100  //Usual ros node stuff
101  ros::init(argc, argv, "recorded_objects_transformer");
102  ros::NodeHandle nh("~");
103  ISM::RecordedObjectsTransformer recorded_objects_transformer;
104 
105  std::string source_file;
106  std::string target_file;
107  std::string object_type;
108  std::string object_id;
109  std::vector<double> point;
110  std::vector<double> quat;
111 
112 
113  if(getNodeParameters(nh, source_file, target_file, object_type, object_id, point, quat))
114  {
115  recorded_objects_transformer.transformRecordedObjects(source_file, target_file, object_type, object_id,
116  point[0], point[1], point[2], quat[0], quat[1], quat[2], quat[3]);
117  ROS_INFO("TRANSFORMATION COMPLETE!");
118  }
119  else
120  {
121  ROS_INFO("TRANSFORMATION ABORTED! Check launch-file for missing parameter.");
122  }
123 
124  return 0;
125 }
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
#define ROS_INFO(...)
#define ROS_INFO_STREAM(args)
bool getParam(const std::string &key, std::string &s) const
bool getNodeParameters(ros::NodeHandle nh, std::string &source_file, std::string &target_file, std::string &object_type, std::string &object_id, std::vector< double > &position, std::vector< double > &orientation)


asr_ism
Author(s): Borella Jocelyn, Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Thu Jan 9 2020 07:20:58