stdr_parser_xml_file_writer.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002    STDR Simulator - Simple Two DImensional Robot Simulator
00003    Copyright (C) 2013 STDR Simulator
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 3 of the License, or
00007    (at your option) any later version.
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software Foundation,
00014    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015    
00016    Authors : 
00017    * Manos Tsardoulias, etsardou@gmail.com
00018    * Aris Thallas, aris.thallas@gmail.com
00019    * Chris Zalidis, zalidis@gmail.com 
00020 ******************************************************************************/
00021 
00022 #include "stdr_parser/stdr_parser_xml_file_writer.h"
00023 
00024 namespace stdr_parser
00025 {
00026   
00031   XmlFileWriter::XmlFileWriter(void)
00032   {
00033 
00034   }
00035 
00038   template void XmlFileWriter::messageToFile
00039     (stdr_msgs::Noise msg,std::string file_name);
00040     
00042   template <>
00043   void XmlFileWriter::messageToXmlElement<stdr_msgs::Noise>
00044     (stdr_msgs::Noise msg,TiXmlNode* base)
00045   {
00047     TiXmlElement* noise;
00048     noise = new TiXmlElement("noise");
00049     base->LinkEndChild(noise);
00050         
00052     TiXmlElement* noise_specs;
00053     noise_specs = new TiXmlElement("noise_specifications");
00054     noise->LinkEndChild(noise_specs);
00055     
00057     TiXmlElement* noise_mean;
00058     noise_mean = new TiXmlElement("noise_mean");
00059     noise_specs->LinkEndChild(noise_mean);
00060     
00061     TiXmlText * noise_mean_text = new TiXmlText(SSTR(msg.noiseMean));
00062     noise_mean->LinkEndChild(noise_mean_text);
00063     
00065     TiXmlElement* noise_std;
00066     noise_std = new TiXmlElement("noise_std");
00067     noise_specs->LinkEndChild(noise_std);
00068     
00069     TiXmlText * noise_std_text = new TiXmlText(SSTR(msg.noiseStd));
00070     noise_std->LinkEndChild(noise_std_text);
00071   }
00072   
00075   template void XmlFileWriter::messageToFile
00076     (stdr_msgs::FootprintMsg msg,std::string file_name);
00077     
00079   template <>
00080   void XmlFileWriter::messageToXmlElement<stdr_msgs::FootprintMsg>
00081     (stdr_msgs::FootprintMsg msg,TiXmlNode* base){
00083     TiXmlElement* footprint;
00084     footprint = new TiXmlElement("footprint");
00085     base->LinkEndChild(footprint);
00086         
00088     TiXmlElement* footprint_specs;
00089     footprint_specs = new TiXmlElement("footprint_specifications");
00090     footprint->LinkEndChild(footprint_specs);
00091     
00093     TiXmlElement* radius;
00094     radius = new TiXmlElement("radius");
00095     footprint_specs->LinkEndChild(radius);
00096     TiXmlText * radius_text = new TiXmlText(SSTR(msg.radius));
00097     radius->LinkEndChild(radius_text);
00098     
00100     TiXmlElement* points;
00101     points = new TiXmlElement("points");
00102     footprint_specs->LinkEndChild(points);
00103     
00104     for(unsigned int i = 0 ; i < msg.points.size() ; i++)
00105     {
00106       TiXmlElement* point;
00107       point = new TiXmlElement("point");
00108       points->LinkEndChild(point);
00109       
00110       TiXmlElement* x;
00111       x = new TiXmlElement("x");
00112       point->LinkEndChild(x);
00113       TiXmlText * x_text = new TiXmlText(SSTR(msg.points[i].x));
00114       x->LinkEndChild(x_text);
00115       
00116       TiXmlElement* y;
00117       y = new TiXmlElement("y");
00118       point->LinkEndChild(y);
00119       TiXmlText * y_text = new TiXmlText(SSTR(msg.points[i].y));
00120       y->LinkEndChild(y_text);
00121     }
00122   }
00123   
00126   template <>
00127   void XmlFileWriter::messageToXmlElement<geometry_msgs::Pose2D>
00128     (geometry_msgs::Pose2D msg,TiXmlNode* base){
00130     TiXmlElement* pose;
00131     pose = new TiXmlElement("pose");
00132     base->LinkEndChild(pose);
00133         
00135     TiXmlElement* x;
00136     x = new TiXmlElement("x");
00137     pose->LinkEndChild(x);
00138     TiXmlText * x_text = new TiXmlText(SSTR(msg.x));
00139     x->LinkEndChild(x_text);
00140     
00142     TiXmlElement* y;
00143     y = new TiXmlElement("y");
00144     pose->LinkEndChild(y);
00145     TiXmlText * y_text = new TiXmlText(SSTR(msg.y));
00146     y->LinkEndChild(y_text);
00147     
00149     TiXmlElement* theta;
00150     theta = new TiXmlElement("theta");
00151     pose->LinkEndChild(theta);
00152     TiXmlText * theta_text = new TiXmlText(SSTR(msg.theta));
00153     theta->LinkEndChild(theta_text);
00154   }
00155 
00158   template void XmlFileWriter::messageToFile
00159     (stdr_msgs::LaserSensorMsg msg,std::string file_name);
00160     
00162   template <>
00163   void XmlFileWriter::messageToXmlElement<stdr_msgs::LaserSensorMsg>
00164     (stdr_msgs::LaserSensorMsg msg,TiXmlNode* base){
00165       
00167     TiXmlElement* laser = new TiXmlElement("laser");
00168     base->LinkEndChild(laser);
00169         
00171     TiXmlElement* laser_specifications = 
00172       new TiXmlElement("laser_specifications");
00173     laser->LinkEndChild(laser_specifications);
00174 
00176     TiXmlElement* max_angle = new TiXmlElement("max_angle");
00177     laser_specifications->LinkEndChild(max_angle);
00178     TiXmlText * max_angle_text = new TiXmlText(SSTR(msg.maxAngle));
00179     max_angle->LinkEndChild(max_angle_text);
00180     
00182     TiXmlElement* min_angle = new TiXmlElement("min_angle");
00183     laser_specifications->LinkEndChild(min_angle);
00184     TiXmlText * min_angle_text = new TiXmlText(SSTR(msg.minAngle));
00185     min_angle->LinkEndChild(min_angle_text);
00186     
00188     TiXmlElement* max_range = new TiXmlElement("max_range");
00189     laser_specifications->LinkEndChild(max_range);
00190     TiXmlText * max_range_text = new TiXmlText(SSTR(msg.maxRange));
00191     max_range->LinkEndChild(max_range_text);
00192     
00194     TiXmlElement* min_range = new TiXmlElement("min_range");
00195     laser_specifications->LinkEndChild(min_range);
00196     TiXmlText * min_range_text = new TiXmlText(SSTR(msg.minRange));
00197     min_range->LinkEndChild(min_range_text);
00198     
00200     TiXmlElement* num_rays = new TiXmlElement("num_rays");
00201     laser_specifications->LinkEndChild(num_rays);
00202     TiXmlText * num_rays_text = new TiXmlText(SSTR(msg.numRays));
00203     num_rays->LinkEndChild(num_rays_text);
00204 
00206     TiXmlElement* frequency = new TiXmlElement("frequency");
00207     laser_specifications->LinkEndChild(frequency);
00208     TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
00209     frequency->LinkEndChild(frequency_text);
00210     
00212     TiXmlElement* frame_id = new TiXmlElement("frame_id");
00213     laser_specifications->LinkEndChild(frame_id);
00214     TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
00215     frame_id->LinkEndChild(frame_id_text);
00216     
00218     messageToXmlElement(msg.pose,laser_specifications);
00219     
00221     messageToXmlElement(msg.noise,laser_specifications);
00222   }
00223   
00226   template void XmlFileWriter::messageToFile
00227     (stdr_msgs::SonarSensorMsg msg,std::string file_name);
00228     
00230   template <>
00231   void XmlFileWriter::messageToXmlElement<stdr_msgs::SonarSensorMsg>
00232     (stdr_msgs::SonarSensorMsg msg,TiXmlNode* base){
00233       
00235     TiXmlElement* sonar = new TiXmlElement("sonar");
00236     base->LinkEndChild(sonar);
00237         
00239     TiXmlElement* sonar_specifications = 
00240       new TiXmlElement("sonar_specifications");
00241     sonar->LinkEndChild(sonar_specifications);
00242 
00244     TiXmlElement* cone_angle = new TiXmlElement("cone_angle");
00245     sonar_specifications->LinkEndChild(cone_angle);
00246     TiXmlText * cone_angle_text = new TiXmlText(SSTR(msg.coneAngle));
00247     cone_angle->LinkEndChild(cone_angle_text);
00248     
00250     TiXmlElement* max_range = new TiXmlElement("max_range");
00251     sonar_specifications->LinkEndChild(max_range);
00252     TiXmlText * max_range_text = new TiXmlText(SSTR(msg.maxRange));
00253     max_range->LinkEndChild(max_range_text);
00254     
00256     TiXmlElement* min_range = new TiXmlElement("min_range");
00257     sonar_specifications->LinkEndChild(min_range);
00258     TiXmlText * min_range_text = new TiXmlText(SSTR(msg.minRange));
00259     min_range->LinkEndChild(min_range_text);
00260     
00262     TiXmlElement* frequency = new TiXmlElement("frequency");
00263     sonar_specifications->LinkEndChild(frequency);
00264     TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
00265     frequency->LinkEndChild(frequency_text);
00266     
00268     TiXmlElement* frame_id = new TiXmlElement("frame_id");
00269     sonar_specifications->LinkEndChild(frame_id);
00270     TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
00271     frame_id->LinkEndChild(frame_id_text);
00272     
00274     messageToXmlElement(msg.pose,sonar_specifications);
00275     
00277     messageToXmlElement(msg.noise,sonar_specifications);
00278   }
00279   
00282   template void XmlFileWriter::messageToFile
00283     (stdr_msgs::RfidSensorMsg msg,std::string file_name);
00284     
00286   template <>
00287   void XmlFileWriter::messageToXmlElement<stdr_msgs::RfidSensorMsg>
00288     (stdr_msgs::RfidSensorMsg msg,TiXmlNode* base){
00289       
00291     TiXmlElement* rfidReader = new TiXmlElement("rfid_reader");
00292     base->LinkEndChild(rfidReader);
00293         
00295     TiXmlElement* rfid_reader_specifications = 
00296       new TiXmlElement("rfid_reader_specifications");
00297     rfidReader->LinkEndChild(rfid_reader_specifications);
00298 
00300     TiXmlElement* maxRange = new TiXmlElement("max_range");
00301     rfid_reader_specifications->LinkEndChild(maxRange);
00302     TiXmlText * maxRange_text = new TiXmlText(SSTR(msg.maxRange));
00303     maxRange->LinkEndChild(maxRange_text);
00304     
00306     TiXmlElement* angleSpan = new TiXmlElement("angle_span");
00307     rfid_reader_specifications->LinkEndChild(angleSpan);
00308     TiXmlText * angleSpan_text = new TiXmlText(SSTR(msg.angleSpan));
00309     angleSpan->LinkEndChild(angleSpan_text);
00310     
00312     TiXmlElement* signalCutoff = new TiXmlElement("signal_cutoff");
00313     rfid_reader_specifications->LinkEndChild(signalCutoff);
00314     TiXmlText * signalCutoff_text = new TiXmlText(SSTR(msg.signalCutoff));
00315     signalCutoff->LinkEndChild(signalCutoff_text);
00316     
00318     TiXmlElement* frequency = new TiXmlElement("frequency");
00319     rfid_reader_specifications->LinkEndChild(frequency);
00320     TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
00321     frequency->LinkEndChild(frequency_text);
00322     
00324     TiXmlElement* frame_id = new TiXmlElement("frame_id");
00325     rfid_reader_specifications->LinkEndChild(frame_id);
00326     TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
00327     frame_id->LinkEndChild(frame_id_text);
00328     
00330     messageToXmlElement(msg.pose,rfid_reader_specifications);
00331   }
00334   template void XmlFileWriter::messageToFile
00335     (stdr_msgs::CO2SensorMsg msg,std::string file_name);
00336     
00338   template <>
00339   void XmlFileWriter::messageToXmlElement<stdr_msgs::CO2SensorMsg>
00340     (stdr_msgs::CO2SensorMsg msg,TiXmlNode* base){
00341       
00343     TiXmlElement* sensor = new TiXmlElement("co2_sensor");
00344     base->LinkEndChild(sensor);
00345         
00347     TiXmlElement* sensor_specifications = 
00348       new TiXmlElement("co2_sensor_specifications");
00349     sensor->LinkEndChild(sensor_specifications);
00350 
00352     TiXmlElement* maxRange = new TiXmlElement("max_range");
00353     sensor_specifications->LinkEndChild(maxRange);
00354     TiXmlText * maxRange_text = new TiXmlText(SSTR(msg.maxRange));
00355     maxRange->LinkEndChild(maxRange_text);
00356     
00358     //~ TiXmlElement* angleSpan = new TiXmlElement("angle_span");
00359     //~ rfid_reader_specifications->LinkEndChild(angleSpan);
00360     //~ TiXmlText * angleSpan_text = new TiXmlText(SSTR(msg.angleSpan));
00361     //~ angleSpan->LinkEndChild(angleSpan_text);
00362     
00364     //~ TiXmlElement* signalCutoff = new TiXmlElement("signal_cutoff");
00365     //~ rfid_reader_specifications->LinkEndChild(signalCutoff);
00366     //~ TiXmlText * signalCutoff_text = new TiXmlText(SSTR(msg.signalCutoff));
00367     //~ signalCutoff->LinkEndChild(signalCutoff_text);
00368     
00370     TiXmlElement* frequency = new TiXmlElement("frequency");
00371     sensor_specifications->LinkEndChild(frequency);
00372     TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
00373     frequency->LinkEndChild(frequency_text);
00374     
00376     TiXmlElement* frame_id = new TiXmlElement("frame_id");
00377     sensor_specifications->LinkEndChild(frame_id);
00378     TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
00379     frame_id->LinkEndChild(frame_id_text);
00380     
00382     messageToXmlElement(msg.pose,sensor_specifications);
00383   }
00386   template void XmlFileWriter::messageToFile
00387     (stdr_msgs::ThermalSensorMsg msg,std::string file_name);
00388     
00390   template <>
00391   void XmlFileWriter::messageToXmlElement<stdr_msgs::ThermalSensorMsg>
00392     (stdr_msgs::ThermalSensorMsg msg,TiXmlNode* base){
00393       
00395     TiXmlElement* sensor = new TiXmlElement("thermal_sensor");
00396     base->LinkEndChild(sensor);
00397         
00399     TiXmlElement* sensor_specifications = 
00400       new TiXmlElement("thermal_sensor_specifications");
00401     sensor->LinkEndChild(sensor_specifications);
00402 
00404     TiXmlElement* maxRange = new TiXmlElement("max_range");
00405     sensor_specifications->LinkEndChild(maxRange);
00406     TiXmlText * maxRange_text = new TiXmlText(SSTR(msg.maxRange));
00407     maxRange->LinkEndChild(maxRange_text);
00408     
00410     TiXmlElement* angleSpan = new TiXmlElement("angle_span");
00411     sensor_specifications->LinkEndChild(angleSpan);
00412     TiXmlText * angleSpan_text = new TiXmlText(SSTR(msg.angleSpan));
00413     angleSpan->LinkEndChild(angleSpan_text);
00414     
00416     //~ TiXmlElement* signalCutoff = new TiXmlElement("signal_cutoff");
00417     //~ rfid_reader_specifications->LinkEndChild(signalCutoff);
00418     //~ TiXmlText * signalCutoff_text = new TiXmlText(SSTR(msg.signalCutoff));
00419     //~ signalCutoff->LinkEndChild(signalCutoff_text);
00420     
00422     TiXmlElement* frequency = new TiXmlElement("frequency");
00423     sensor_specifications->LinkEndChild(frequency);
00424     TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
00425     frequency->LinkEndChild(frequency_text);
00426     
00428     TiXmlElement* frame_id = new TiXmlElement("frame_id");
00429     sensor_specifications->LinkEndChild(frame_id);
00430     TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
00431     frame_id->LinkEndChild(frame_id_text);
00432     
00434     messageToXmlElement(msg.pose,sensor_specifications);
00435   }
00438   template void XmlFileWriter::messageToFile
00439     (stdr_msgs::SoundSensorMsg msg,std::string file_name);
00440     
00442   template <>
00443   void XmlFileWriter::messageToXmlElement<stdr_msgs::SoundSensorMsg>
00444     (stdr_msgs::SoundSensorMsg msg,TiXmlNode* base){
00445       
00447     TiXmlElement* sensor = new TiXmlElement("sound_sensor");
00448     base->LinkEndChild(sensor);
00449         
00451     TiXmlElement* sensor_specifications = 
00452       new TiXmlElement("sound_sensor_specifications");
00453     sensor->LinkEndChild(sensor_specifications);
00454 
00456     TiXmlElement* maxRange = new TiXmlElement("max_range");
00457     sensor_specifications->LinkEndChild(maxRange);
00458     TiXmlText * maxRange_text = new TiXmlText(SSTR(msg.maxRange));
00459     maxRange->LinkEndChild(maxRange_text);
00460     
00462     TiXmlElement* angleSpan = new TiXmlElement("angle_span");
00463     sensor_specifications->LinkEndChild(angleSpan);
00464     TiXmlText * angleSpan_text = new TiXmlText(SSTR(msg.angleSpan));
00465     angleSpan->LinkEndChild(angleSpan_text);
00466     
00468     //~ TiXmlElement* signalCutoff = new TiXmlElement("signal_cutoff");
00469     //~ rfid_reader_specifications->LinkEndChild(signalCutoff);
00470     //~ TiXmlText * signalCutoff_text = new TiXmlText(SSTR(msg.signalCutoff));
00471     //~ signalCutoff->LinkEndChild(signalCutoff_text);
00472     
00474     TiXmlElement* frequency = new TiXmlElement("frequency");
00475     sensor_specifications->LinkEndChild(frequency);
00476     TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
00477     frequency->LinkEndChild(frequency_text);
00478     
00480     TiXmlElement* frame_id = new TiXmlElement("frame_id");
00481     sensor_specifications->LinkEndChild(frame_id);
00482     TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
00483     frame_id->LinkEndChild(frame_id_text);
00484     
00486     messageToXmlElement(msg.pose,sensor_specifications);
00487   }
00488   
00491   template void XmlFileWriter::messageToFile
00492     (stdr_msgs::KinematicMsg msg,std::string file_name);
00493     
00495   template <>
00496   void XmlFileWriter::messageToXmlElement<stdr_msgs::KinematicMsg>
00497     (stdr_msgs::KinematicMsg msg,TiXmlNode* base){
00498       
00500     TiXmlElement* kinematic = new TiXmlElement("kinematic");
00501     base->LinkEndChild(kinematic);
00502         
00504     TiXmlElement* kinematic_specifications = 
00505       new TiXmlElement("kinematic_specifications");
00506     kinematic->LinkEndChild(kinematic_specifications);
00507 
00509     TiXmlElement* model;
00510     model = new TiXmlElement("kinematic_model");
00511     kinematic_specifications->LinkEndChild(model);
00512     TiXmlText * model_text = new TiXmlText(msg.type);
00513     model->LinkEndChild(model_text);
00514 
00516     TiXmlElement* parameters;
00517     parameters = new TiXmlElement("kinematic_parameters");
00518     kinematic_specifications->LinkEndChild(parameters);
00519     TiXmlElement *a_ux_ux, *a_ux_uy, *a_ux_w, *a_uy_ux, *a_uy_uy, *a_uy_w;
00520     TiXmlElement *a_w_ux, *a_w_uy, *a_w_w, *a_g_ux, *a_g_uy, *a_g_w;
00521     
00522     a_ux_ux = new TiXmlElement("a_ux_ux");
00523     parameters->LinkEndChild(a_ux_ux);
00524     TiXmlText *a_ux_ux_text = new TiXmlText(SSTR(msg.a_ux_ux));
00525     a_ux_ux->LinkEndChild(a_ux_ux_text);
00526 
00527     a_ux_uy = new TiXmlElement("a_ux_uy");
00528     parameters->LinkEndChild(a_ux_uy);
00529     TiXmlText *a_ux_uy_text = new TiXmlText(SSTR(msg.a_ux_uy));
00530     a_ux_uy->LinkEndChild(a_ux_uy_text);
00531 
00532     a_ux_w = new TiXmlElement("a_ux_w");
00533     parameters->LinkEndChild(a_ux_w);
00534     TiXmlText *a_ux_w_text = new TiXmlText(SSTR(msg.a_ux_w));
00535     a_ux_w->LinkEndChild(a_ux_w_text);
00536 
00537     a_uy_ux = new TiXmlElement("a_uy_ux");
00538     parameters->LinkEndChild(a_uy_ux);
00539     TiXmlText *a_uy_ux_text = new TiXmlText(SSTR(msg.a_uy_ux));
00540     a_uy_ux->LinkEndChild(a_uy_ux_text);
00541 
00542     a_uy_uy = new TiXmlElement("a_uy_uy");
00543     parameters->LinkEndChild(a_uy_uy);
00544     TiXmlText *a_uy_uy_text = new TiXmlText(SSTR(msg.a_uy_uy));
00545     a_uy_uy->LinkEndChild(a_uy_uy_text);
00546 
00547     a_uy_w = new TiXmlElement("a_uy_w");
00548     parameters->LinkEndChild(a_uy_w);
00549     TiXmlText *a_uy_w_text = new TiXmlText(SSTR(msg.a_uy_w));
00550     a_uy_w->LinkEndChild(a_uy_w_text);
00551 
00552     a_w_ux = new TiXmlElement("a_w_ux");
00553     parameters->LinkEndChild(a_w_ux);
00554     TiXmlText *a_w_ux_text = new TiXmlText(SSTR(msg.a_w_ux));
00555     a_w_ux->LinkEndChild(a_w_ux_text);
00556 
00557     a_w_uy = new TiXmlElement("a_w_uy");
00558     parameters->LinkEndChild(a_w_uy);
00559     TiXmlText *a_w_uy_text = new TiXmlText(SSTR(msg.a_w_uy));
00560     a_w_uy->LinkEndChild(a_w_uy_text);
00561 
00562     a_w_w = new TiXmlElement("a_w_w");
00563     parameters->LinkEndChild(a_w_w);
00564     TiXmlText *a_w_w_text = new TiXmlText(SSTR(msg.a_w_w));
00565     a_w_w->LinkEndChild(a_w_w_text);
00566 
00567     a_g_ux = new TiXmlElement("a_g_ux");
00568     parameters->LinkEndChild(a_g_ux);
00569     TiXmlText *a_g_ux_text = new TiXmlText(SSTR(msg.a_g_ux));
00570     a_g_ux->LinkEndChild(a_g_ux_text);
00571 
00572     a_g_uy = new TiXmlElement("a_g_uy");
00573     parameters->LinkEndChild(a_g_uy);
00574     TiXmlText *a_g_uy_text = new TiXmlText(SSTR(msg.a_g_uy));
00575     a_g_uy->LinkEndChild(a_g_uy_text);
00576 
00577     a_g_w = new TiXmlElement("a_g_w");
00578     parameters->LinkEndChild(a_g_w);
00579     TiXmlText *a_g_w_text = new TiXmlText(SSTR(msg.a_g_w));
00580     a_g_w->LinkEndChild(a_g_w_text);
00581   }
00582 
00585   template void XmlFileWriter::messageToFile
00586     (stdr_msgs::RobotMsg msg,std::string file_name);
00587     
00589   template <>
00590   void XmlFileWriter::messageToXmlElement<stdr_msgs::RobotMsg>
00591     (stdr_msgs::RobotMsg msg,TiXmlNode* base){
00592       
00594     TiXmlElement* robot = new TiXmlElement("robot");
00595     base->LinkEndChild(robot);
00596         
00598     TiXmlElement* robot_specifications = 
00599       new TiXmlElement("robot_specifications");
00600     robot->LinkEndChild(robot_specifications);
00601 
00603     TiXmlElement* pose;
00604     pose = new TiXmlElement("initial_pose");
00605     robot_specifications->LinkEndChild(pose);
00606         
00608     TiXmlElement* x;
00609     x = new TiXmlElement("x");
00610     pose->LinkEndChild(x);
00611     TiXmlText * x_text = new TiXmlText(SSTR(msg.initialPose.x));
00612     x->LinkEndChild(x_text);
00613     
00615     TiXmlElement* y;
00616     y = new TiXmlElement("y");
00617     pose->LinkEndChild(y);
00618     TiXmlText * y_text = new TiXmlText(SSTR(msg.initialPose.y));
00619     y->LinkEndChild(y_text);
00620     
00622     TiXmlElement* theta;
00623     theta = new TiXmlElement("theta");
00624     pose->LinkEndChild(theta);
00625     TiXmlText * theta_text = new TiXmlText(SSTR(msg.initialPose.theta));
00626     theta->LinkEndChild(theta_text);
00627     
00629     messageToXmlElement(msg.footprint, robot_specifications);
00630 
00632     messageToXmlElement(msg.kinematicModel, robot_specifications);
00633     
00635     for(unsigned int i = 0 ; i < msg.laserSensors.size() ; i++)
00636     {
00637       messageToXmlElement(msg.laserSensors[i],robot_specifications);
00638     }
00639     
00641     for(unsigned int i = 0 ; i < msg.sonarSensors.size() ; i++)
00642     {
00643       messageToXmlElement(msg.sonarSensors[i],robot_specifications);
00644     }
00645     
00647     for(unsigned int i = 0 ; i < msg.rfidSensors.size() ; i++)
00648     {
00649       messageToXmlElement(msg.rfidSensors[i],robot_specifications);
00650     }
00651     
00652     for(unsigned int i = 0 ; i < msg.co2Sensors.size() ; i++)
00653     {
00654       messageToXmlElement(msg.co2Sensors[i],robot_specifications);
00655     }
00656     
00657     for(unsigned int i = 0 ; i < msg.thermalSensors.size() ; i++)
00658     {
00659       messageToXmlElement(msg.thermalSensors[i],robot_specifications);
00660     }
00661     
00662     for(unsigned int i = 0 ; i < msg.soundSensors.size() ; i++)
00663     {
00664       messageToXmlElement(msg.soundSensors[i],robot_specifications);
00665     }
00666   }
00667   
00669   
00676   template <class T>
00677   void XmlFileWriter::messageToXmlElement(T msg,TiXmlNode* base)
00678   {
00679   }
00680   
00687   template <class T>
00688   void XmlFileWriter::messageToFile(T msg,std::string file_name)
00689   {
00690     TiXmlDocument doc;
00691     messageToXmlElement<T>(msg,&doc);
00692     doc.SaveFile(file_name.c_str()); 
00693   }
00694 }
00695 


stdr_parser
Author(s): Manos Tsardoulias, Chris Zalidis, Aris Thallas
autogenerated on Thu Jun 6 2019 18:57:14