optimizer_ros.cpp
Go to the documentation of this file.
00001 
00018 #include <cstdio>
00019 #include <iostream>
00020 #include <cstring>
00021 #include <fstream> 
00022  
00023 #include <optimizer_ros.h>
00024 
00025 using namespace robotLibPbD;
00026 
00027  
00028 std::string COptimizerRos::generateOutput()
00029 {
00030   CFrameInterface interface;
00031   std::string text;
00032 
00033   text = "<launch>\n";
00034 
00035   unsigned int counter = 0;
00036   for (unsigned int i=0; i<frames.getFrames().size(); i++)
00037     {
00038       interface.setFrame(frames.getFrame(i));
00039       LOG_VERBOSE("Frame: %s\n", interface.getFrameAsXml().c_str());
00040 
00041       CVec position, quater;
00042       position = frames.getFrame(i)->getPose()[3];
00043       CMathLib::quaternionFromMatrix(frames.getFrame(i)->getPose(), quater); 
00044  
00045       if (frames.getFrame(i)->isData())
00046         {
00047           text += printToString("# input: %s\n", frames.getFrame(i)->getName());
00048         } else
00049         {
00050           if (frames.getFrame(i)->getBase() == NULL && frames.getFrame(i)->getRelativeToBase().length() < 1.0e-10)
00051             continue;
00052 
00053           text += printToString("<node pkg=\"tf\" type=\"static_transform_publisher\" name=\"%s\" args=\"%f %f %f %f %f %f %f %s %s 100\"/> \n",
00054                                 printToString("calibration_publisher_%d", counter).c_str(),
00055                                 position.x / 1000.0, position.y / 1000.0, position.z / 1000.0,
00056                                 quater.x, quater.y, quater.z, quater.w,
00057                                 frames.getFrame(i)->getBase() == NULL ? "CalibrationBase" : frames.getFrame(i)->getBase()->getName(),
00058                                 frames.getFrame(i)->getName());
00059                                 counter++;
00060         }
00061     }
00062 
00063   text += "</launch>\n";
00064 
00065   return text;
00066 }
00067  


asr_kinematic_chain_optimizer
Author(s): Aumann Florian, Heller Florian, Jäkel Rainer, Wittenbeck Valerij
autogenerated on Sat Jun 8 2019 19:42:49