optimizer_ros.cpp
Go to the documentation of this file.
1 
18 #include <cstdio>
19 #include <iostream>
20 #include <cstring>
21 #include <fstream>
22 
23 #include <optimizer_ros.h>
24 
25 using namespace robotLibPbD;
26 
27 
29 {
30  CFrameInterface interface;
31  std::string text;
32 
33  text = "<launch>\n";
34 
35  unsigned int counter = 0;
36  for (unsigned int i=0; i<frames.getFrames().size(); i++)
37  {
38  interface.setFrame(frames.getFrame(i));
39  LOG_VERBOSE("Frame: %s\n", interface.getFrameAsXml().c_str());
40 
41  CVec position, quater;
42  position = frames.getFrame(i)->getPose()[3];
44 
45  if (frames.getFrame(i)->isData())
46  {
47  text += printToString("# input: %s\n", frames.getFrame(i)->getName());
48  } else
49  {
50  if (frames.getFrame(i)->getBase() == NULL && frames.getFrame(i)->getRelativeToBase().length() < 1.0e-10)
51  continue;
52 
53  text += printToString("<node pkg=\"tf\" type=\"static_transform_publisher\" name=\"%s\" args=\"%f %f %f %f %f %f %f %s %s 100\"/> \n",
54  printToString("calibration_publisher_%d", counter).c_str(),
55  position.x / 1000.0, position.y / 1000.0, position.z / 1000.0,
56  quater.x, quater.y, quater.z, quater.w,
57  frames.getFrame(i)->getBase() == NULL ? "CalibrationBase" : frames.getFrame(i)->getBase()->getName(),
58  frames.getFrame(i)->getName());
59  counter++;
60  }
61  }
62 
63  text += "</launch>\n";
64 
65  return text;
66 }
67 
CFrameContainer frames
Definition: optimizer.h:58
std::string printToString(const char *format,...)
Definition: utils.cpp:149
virtual std::string getFrameAsXml()
Definition: frame.cpp:1186
virtual CMatrix getRelativeToBase()
Returns pose in the base (frame with no predecessor) frame.
Definition: frame.h:508
PRECISION length() const
Definition: vecmath.cpp:355
std::vector< CFrame * > getFrames()
Definition: frame.h:227
static void quaternionFromMatrix(const CMatrix &mat, CVec &quaternion)
Transforms a homogenous matrix into quaternion representation.
Definition: vecmath.cpp:525
Homogenous vector.
Definition: vecmath.h:57
virtual void setFrame(CFrame *frame)
Definition: frame.h:144
bool isData()
Definition: frame.h:95
virtual char * getName()
Definition: frame.h:103
#define LOG_VERBOSE(format,...)
Definition: log.h:34
unsigned int counter
Definition: optimizer.h:63
virtual CFrame * getBase()
Definition: frame.h:482
virtual CMatrix getPose()
Definition: frame.h:118
CFrame * getFrame(unsigned int id)
Definition: frame.h:224


asr_kinematic_chain_optimizer
Author(s): Aumann Florian, Heller Florian, Jäkel Rainer, Wittenbeck Valerij
autogenerated on Mon Jun 10 2019 12:35:36