stdr_parser_xml_file_writer.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  STDR Simulator - Simple Two DImensional Robot Simulator
3  Copyright (C) 2013 STDR Simulator
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 3 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software Foundation,
14  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 
16  Authors :
17  * Manos Tsardoulias, etsardou@gmail.com
18  * Aris Thallas, aris.thallas@gmail.com
19  * Chris Zalidis, zalidis@gmail.com
20 ******************************************************************************/
21 
23 
24 namespace stdr_parser
25 {
26 
32  {
33 
34  }
35 
38  template void XmlFileWriter::messageToFile
39  (stdr_msgs::Noise msg,std::string file_name);
40 
42  template <>
43  void XmlFileWriter::messageToXmlElement<stdr_msgs::Noise>
44  (stdr_msgs::Noise msg,TiXmlNode* base)
45  {
47  TiXmlElement* noise;
48  noise = new TiXmlElement("noise");
49  base->LinkEndChild(noise);
50 
52  TiXmlElement* noise_specs;
53  noise_specs = new TiXmlElement("noise_specifications");
54  noise->LinkEndChild(noise_specs);
55 
57  TiXmlElement* noise_mean;
58  noise_mean = new TiXmlElement("noise_mean");
59  noise_specs->LinkEndChild(noise_mean);
60 
61  TiXmlText * noise_mean_text = new TiXmlText(SSTR(msg.noiseMean));
62  noise_mean->LinkEndChild(noise_mean_text);
63 
65  TiXmlElement* noise_std;
66  noise_std = new TiXmlElement("noise_std");
67  noise_specs->LinkEndChild(noise_std);
68 
69  TiXmlText * noise_std_text = new TiXmlText(SSTR(msg.noiseStd));
70  noise_std->LinkEndChild(noise_std_text);
71  }
72 
75  template void XmlFileWriter::messageToFile
76  (stdr_msgs::FootprintMsg msg,std::string file_name);
77 
79  template <>
80  void XmlFileWriter::messageToXmlElement<stdr_msgs::FootprintMsg>
81  (stdr_msgs::FootprintMsg msg,TiXmlNode* base){
83  TiXmlElement* footprint;
84  footprint = new TiXmlElement("footprint");
85  base->LinkEndChild(footprint);
86 
88  TiXmlElement* footprint_specs;
89  footprint_specs = new TiXmlElement("footprint_specifications");
90  footprint->LinkEndChild(footprint_specs);
91 
93  TiXmlElement* radius;
94  radius = new TiXmlElement("radius");
95  footprint_specs->LinkEndChild(radius);
96  TiXmlText * radius_text = new TiXmlText(SSTR(msg.radius));
97  radius->LinkEndChild(radius_text);
98 
100  TiXmlElement* points;
101  points = new TiXmlElement("points");
102  footprint_specs->LinkEndChild(points);
103 
104  for(unsigned int i = 0 ; i < msg.points.size() ; i++)
105  {
106  TiXmlElement* point;
107  point = new TiXmlElement("point");
108  points->LinkEndChild(point);
109 
110  TiXmlElement* x;
111  x = new TiXmlElement("x");
112  point->LinkEndChild(x);
113  TiXmlText * x_text = new TiXmlText(SSTR(msg.points[i].x));
114  x->LinkEndChild(x_text);
115 
116  TiXmlElement* y;
117  y = new TiXmlElement("y");
118  point->LinkEndChild(y);
119  TiXmlText * y_text = new TiXmlText(SSTR(msg.points[i].y));
120  y->LinkEndChild(y_text);
121  }
122  }
123 
126  template <>
127  void XmlFileWriter::messageToXmlElement<geometry_msgs::Pose2D>
128  (geometry_msgs::Pose2D msg,TiXmlNode* base){
130  TiXmlElement* pose;
131  pose = new TiXmlElement("pose");
132  base->LinkEndChild(pose);
133 
135  TiXmlElement* x;
136  x = new TiXmlElement("x");
137  pose->LinkEndChild(x);
138  TiXmlText * x_text = new TiXmlText(SSTR(msg.x));
139  x->LinkEndChild(x_text);
140 
142  TiXmlElement* y;
143  y = new TiXmlElement("y");
144  pose->LinkEndChild(y);
145  TiXmlText * y_text = new TiXmlText(SSTR(msg.y));
146  y->LinkEndChild(y_text);
147 
149  TiXmlElement* theta;
150  theta = new TiXmlElement("theta");
151  pose->LinkEndChild(theta);
152  TiXmlText * theta_text = new TiXmlText(SSTR(msg.theta));
153  theta->LinkEndChild(theta_text);
154  }
155 
158  template void XmlFileWriter::messageToFile
159  (stdr_msgs::LaserSensorMsg msg,std::string file_name);
160 
162  template <>
163  void XmlFileWriter::messageToXmlElement<stdr_msgs::LaserSensorMsg>
164  (stdr_msgs::LaserSensorMsg msg,TiXmlNode* base){
165 
167  TiXmlElement* laser = new TiXmlElement("laser");
168  base->LinkEndChild(laser);
169 
171  TiXmlElement* laser_specifications =
172  new TiXmlElement("laser_specifications");
173  laser->LinkEndChild(laser_specifications);
174 
176  TiXmlElement* max_angle = new TiXmlElement("max_angle");
177  laser_specifications->LinkEndChild(max_angle);
178  TiXmlText * max_angle_text = new TiXmlText(SSTR(msg.maxAngle));
179  max_angle->LinkEndChild(max_angle_text);
180 
182  TiXmlElement* min_angle = new TiXmlElement("min_angle");
183  laser_specifications->LinkEndChild(min_angle);
184  TiXmlText * min_angle_text = new TiXmlText(SSTR(msg.minAngle));
185  min_angle->LinkEndChild(min_angle_text);
186 
188  TiXmlElement* max_range = new TiXmlElement("max_range");
189  laser_specifications->LinkEndChild(max_range);
190  TiXmlText * max_range_text = new TiXmlText(SSTR(msg.maxRange));
191  max_range->LinkEndChild(max_range_text);
192 
194  TiXmlElement* min_range = new TiXmlElement("min_range");
195  laser_specifications->LinkEndChild(min_range);
196  TiXmlText * min_range_text = new TiXmlText(SSTR(msg.minRange));
197  min_range->LinkEndChild(min_range_text);
198 
200  TiXmlElement* num_rays = new TiXmlElement("num_rays");
201  laser_specifications->LinkEndChild(num_rays);
202  TiXmlText * num_rays_text = new TiXmlText(SSTR(msg.numRays));
203  num_rays->LinkEndChild(num_rays_text);
204 
206  TiXmlElement* frequency = new TiXmlElement("frequency");
207  laser_specifications->LinkEndChild(frequency);
208  TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
209  frequency->LinkEndChild(frequency_text);
210 
212  TiXmlElement* frame_id = new TiXmlElement("frame_id");
213  laser_specifications->LinkEndChild(frame_id);
214  TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
215  frame_id->LinkEndChild(frame_id_text);
216 
218  messageToXmlElement(msg.pose,laser_specifications);
219 
221  messageToXmlElement(msg.noise,laser_specifications);
222  }
223 
226  template void XmlFileWriter::messageToFile
227  (stdr_msgs::SonarSensorMsg msg,std::string file_name);
228 
230  template <>
231  void XmlFileWriter::messageToXmlElement<stdr_msgs::SonarSensorMsg>
232  (stdr_msgs::SonarSensorMsg msg,TiXmlNode* base){
233 
235  TiXmlElement* sonar = new TiXmlElement("sonar");
236  base->LinkEndChild(sonar);
237 
239  TiXmlElement* sonar_specifications =
240  new TiXmlElement("sonar_specifications");
241  sonar->LinkEndChild(sonar_specifications);
242 
244  TiXmlElement* cone_angle = new TiXmlElement("cone_angle");
245  sonar_specifications->LinkEndChild(cone_angle);
246  TiXmlText * cone_angle_text = new TiXmlText(SSTR(msg.coneAngle));
247  cone_angle->LinkEndChild(cone_angle_text);
248 
250  TiXmlElement* max_range = new TiXmlElement("max_range");
251  sonar_specifications->LinkEndChild(max_range);
252  TiXmlText * max_range_text = new TiXmlText(SSTR(msg.maxRange));
253  max_range->LinkEndChild(max_range_text);
254 
256  TiXmlElement* min_range = new TiXmlElement("min_range");
257  sonar_specifications->LinkEndChild(min_range);
258  TiXmlText * min_range_text = new TiXmlText(SSTR(msg.minRange));
259  min_range->LinkEndChild(min_range_text);
260 
262  TiXmlElement* frequency = new TiXmlElement("frequency");
263  sonar_specifications->LinkEndChild(frequency);
264  TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
265  frequency->LinkEndChild(frequency_text);
266 
268  TiXmlElement* frame_id = new TiXmlElement("frame_id");
269  sonar_specifications->LinkEndChild(frame_id);
270  TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
271  frame_id->LinkEndChild(frame_id_text);
272 
274  messageToXmlElement(msg.pose,sonar_specifications);
275 
277  messageToXmlElement(msg.noise,sonar_specifications);
278  }
279 
282  template void XmlFileWriter::messageToFile
283  (stdr_msgs::RfidSensorMsg msg,std::string file_name);
284 
286  template <>
287  void XmlFileWriter::messageToXmlElement<stdr_msgs::RfidSensorMsg>
288  (stdr_msgs::RfidSensorMsg msg,TiXmlNode* base){
289 
291  TiXmlElement* rfidReader = new TiXmlElement("rfid_reader");
292  base->LinkEndChild(rfidReader);
293 
295  TiXmlElement* rfid_reader_specifications =
296  new TiXmlElement("rfid_reader_specifications");
297  rfidReader->LinkEndChild(rfid_reader_specifications);
298 
300  TiXmlElement* maxRange = new TiXmlElement("max_range");
301  rfid_reader_specifications->LinkEndChild(maxRange);
302  TiXmlText * maxRange_text = new TiXmlText(SSTR(msg.maxRange));
303  maxRange->LinkEndChild(maxRange_text);
304 
306  TiXmlElement* angleSpan = new TiXmlElement("angle_span");
307  rfid_reader_specifications->LinkEndChild(angleSpan);
308  TiXmlText * angleSpan_text = new TiXmlText(SSTR(msg.angleSpan));
309  angleSpan->LinkEndChild(angleSpan_text);
310 
312  TiXmlElement* signalCutoff = new TiXmlElement("signal_cutoff");
313  rfid_reader_specifications->LinkEndChild(signalCutoff);
314  TiXmlText * signalCutoff_text = new TiXmlText(SSTR(msg.signalCutoff));
315  signalCutoff->LinkEndChild(signalCutoff_text);
316 
318  TiXmlElement* frequency = new TiXmlElement("frequency");
319  rfid_reader_specifications->LinkEndChild(frequency);
320  TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
321  frequency->LinkEndChild(frequency_text);
322 
324  TiXmlElement* frame_id = new TiXmlElement("frame_id");
325  rfid_reader_specifications->LinkEndChild(frame_id);
326  TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
327  frame_id->LinkEndChild(frame_id_text);
328 
330  messageToXmlElement(msg.pose,rfid_reader_specifications);
331  }
334  template void XmlFileWriter::messageToFile
335  (stdr_msgs::CO2SensorMsg msg,std::string file_name);
336 
338  template <>
339  void XmlFileWriter::messageToXmlElement<stdr_msgs::CO2SensorMsg>
340  (stdr_msgs::CO2SensorMsg msg,TiXmlNode* base){
341 
343  TiXmlElement* sensor = new TiXmlElement("co2_sensor");
344  base->LinkEndChild(sensor);
345 
347  TiXmlElement* sensor_specifications =
348  new TiXmlElement("co2_sensor_specifications");
349  sensor->LinkEndChild(sensor_specifications);
350 
352  TiXmlElement* maxRange = new TiXmlElement("max_range");
353  sensor_specifications->LinkEndChild(maxRange);
354  TiXmlText * maxRange_text = new TiXmlText(SSTR(msg.maxRange));
355  maxRange->LinkEndChild(maxRange_text);
356 
358  //~ TiXmlElement* angleSpan = new TiXmlElement("angle_span");
359  //~ rfid_reader_specifications->LinkEndChild(angleSpan);
360  //~ TiXmlText * angleSpan_text = new TiXmlText(SSTR(msg.angleSpan));
361  //~ angleSpan->LinkEndChild(angleSpan_text);
362 
364  //~ TiXmlElement* signalCutoff = new TiXmlElement("signal_cutoff");
365  //~ rfid_reader_specifications->LinkEndChild(signalCutoff);
366  //~ TiXmlText * signalCutoff_text = new TiXmlText(SSTR(msg.signalCutoff));
367  //~ signalCutoff->LinkEndChild(signalCutoff_text);
368 
370  TiXmlElement* frequency = new TiXmlElement("frequency");
371  sensor_specifications->LinkEndChild(frequency);
372  TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
373  frequency->LinkEndChild(frequency_text);
374 
376  TiXmlElement* frame_id = new TiXmlElement("frame_id");
377  sensor_specifications->LinkEndChild(frame_id);
378  TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
379  frame_id->LinkEndChild(frame_id_text);
380 
382  messageToXmlElement(msg.pose,sensor_specifications);
383  }
386  template void XmlFileWriter::messageToFile
387  (stdr_msgs::ThermalSensorMsg msg,std::string file_name);
388 
390  template <>
391  void XmlFileWriter::messageToXmlElement<stdr_msgs::ThermalSensorMsg>
392  (stdr_msgs::ThermalSensorMsg msg,TiXmlNode* base){
393 
395  TiXmlElement* sensor = new TiXmlElement("thermal_sensor");
396  base->LinkEndChild(sensor);
397 
399  TiXmlElement* sensor_specifications =
400  new TiXmlElement("thermal_sensor_specifications");
401  sensor->LinkEndChild(sensor_specifications);
402 
404  TiXmlElement* maxRange = new TiXmlElement("max_range");
405  sensor_specifications->LinkEndChild(maxRange);
406  TiXmlText * maxRange_text = new TiXmlText(SSTR(msg.maxRange));
407  maxRange->LinkEndChild(maxRange_text);
408 
410  TiXmlElement* angleSpan = new TiXmlElement("angle_span");
411  sensor_specifications->LinkEndChild(angleSpan);
412  TiXmlText * angleSpan_text = new TiXmlText(SSTR(msg.angleSpan));
413  angleSpan->LinkEndChild(angleSpan_text);
414 
416  //~ TiXmlElement* signalCutoff = new TiXmlElement("signal_cutoff");
417  //~ rfid_reader_specifications->LinkEndChild(signalCutoff);
418  //~ TiXmlText * signalCutoff_text = new TiXmlText(SSTR(msg.signalCutoff));
419  //~ signalCutoff->LinkEndChild(signalCutoff_text);
420 
422  TiXmlElement* frequency = new TiXmlElement("frequency");
423  sensor_specifications->LinkEndChild(frequency);
424  TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
425  frequency->LinkEndChild(frequency_text);
426 
428  TiXmlElement* frame_id = new TiXmlElement("frame_id");
429  sensor_specifications->LinkEndChild(frame_id);
430  TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
431  frame_id->LinkEndChild(frame_id_text);
432 
434  messageToXmlElement(msg.pose,sensor_specifications);
435  }
438  template void XmlFileWriter::messageToFile
439  (stdr_msgs::SoundSensorMsg msg,std::string file_name);
440 
442  template <>
443  void XmlFileWriter::messageToXmlElement<stdr_msgs::SoundSensorMsg>
444  (stdr_msgs::SoundSensorMsg msg,TiXmlNode* base){
445 
447  TiXmlElement* sensor = new TiXmlElement("sound_sensor");
448  base->LinkEndChild(sensor);
449 
451  TiXmlElement* sensor_specifications =
452  new TiXmlElement("sound_sensor_specifications");
453  sensor->LinkEndChild(sensor_specifications);
454 
456  TiXmlElement* maxRange = new TiXmlElement("max_range");
457  sensor_specifications->LinkEndChild(maxRange);
458  TiXmlText * maxRange_text = new TiXmlText(SSTR(msg.maxRange));
459  maxRange->LinkEndChild(maxRange_text);
460 
462  TiXmlElement* angleSpan = new TiXmlElement("angle_span");
463  sensor_specifications->LinkEndChild(angleSpan);
464  TiXmlText * angleSpan_text = new TiXmlText(SSTR(msg.angleSpan));
465  angleSpan->LinkEndChild(angleSpan_text);
466 
468  //~ TiXmlElement* signalCutoff = new TiXmlElement("signal_cutoff");
469  //~ rfid_reader_specifications->LinkEndChild(signalCutoff);
470  //~ TiXmlText * signalCutoff_text = new TiXmlText(SSTR(msg.signalCutoff));
471  //~ signalCutoff->LinkEndChild(signalCutoff_text);
472 
474  TiXmlElement* frequency = new TiXmlElement("frequency");
475  sensor_specifications->LinkEndChild(frequency);
476  TiXmlText * frequency_text = new TiXmlText(SSTR(msg.frequency));
477  frequency->LinkEndChild(frequency_text);
478 
480  TiXmlElement* frame_id = new TiXmlElement("frame_id");
481  sensor_specifications->LinkEndChild(frame_id);
482  TiXmlText * frame_id_text = new TiXmlText(SSTR(msg.frame_id));
483  frame_id->LinkEndChild(frame_id_text);
484 
486  messageToXmlElement(msg.pose,sensor_specifications);
487  }
488 
491  template void XmlFileWriter::messageToFile
492  (stdr_msgs::KinematicMsg msg,std::string file_name);
493 
495  template <>
496  void XmlFileWriter::messageToXmlElement<stdr_msgs::KinematicMsg>
497  (stdr_msgs::KinematicMsg msg,TiXmlNode* base){
498 
500  TiXmlElement* kinematic = new TiXmlElement("kinematic");
501  base->LinkEndChild(kinematic);
502 
504  TiXmlElement* kinematic_specifications =
505  new TiXmlElement("kinematic_specifications");
506  kinematic->LinkEndChild(kinematic_specifications);
507 
509  TiXmlElement* model;
510  model = new TiXmlElement("kinematic_model");
511  kinematic_specifications->LinkEndChild(model);
512  TiXmlText * model_text = new TiXmlText(msg.type);
513  model->LinkEndChild(model_text);
514 
516  TiXmlElement* parameters;
517  parameters = new TiXmlElement("kinematic_parameters");
518  kinematic_specifications->LinkEndChild(parameters);
519  TiXmlElement *a_ux_ux, *a_ux_uy, *a_ux_w, *a_uy_ux, *a_uy_uy, *a_uy_w;
520  TiXmlElement *a_w_ux, *a_w_uy, *a_w_w, *a_g_ux, *a_g_uy, *a_g_w;
521 
522  a_ux_ux = new TiXmlElement("a_ux_ux");
523  parameters->LinkEndChild(a_ux_ux);
524  TiXmlText *a_ux_ux_text = new TiXmlText(SSTR(msg.a_ux_ux));
525  a_ux_ux->LinkEndChild(a_ux_ux_text);
526 
527  a_ux_uy = new TiXmlElement("a_ux_uy");
528  parameters->LinkEndChild(a_ux_uy);
529  TiXmlText *a_ux_uy_text = new TiXmlText(SSTR(msg.a_ux_uy));
530  a_ux_uy->LinkEndChild(a_ux_uy_text);
531 
532  a_ux_w = new TiXmlElement("a_ux_w");
533  parameters->LinkEndChild(a_ux_w);
534  TiXmlText *a_ux_w_text = new TiXmlText(SSTR(msg.a_ux_w));
535  a_ux_w->LinkEndChild(a_ux_w_text);
536 
537  a_uy_ux = new TiXmlElement("a_uy_ux");
538  parameters->LinkEndChild(a_uy_ux);
539  TiXmlText *a_uy_ux_text = new TiXmlText(SSTR(msg.a_uy_ux));
540  a_uy_ux->LinkEndChild(a_uy_ux_text);
541 
542  a_uy_uy = new TiXmlElement("a_uy_uy");
543  parameters->LinkEndChild(a_uy_uy);
544  TiXmlText *a_uy_uy_text = new TiXmlText(SSTR(msg.a_uy_uy));
545  a_uy_uy->LinkEndChild(a_uy_uy_text);
546 
547  a_uy_w = new TiXmlElement("a_uy_w");
548  parameters->LinkEndChild(a_uy_w);
549  TiXmlText *a_uy_w_text = new TiXmlText(SSTR(msg.a_uy_w));
550  a_uy_w->LinkEndChild(a_uy_w_text);
551 
552  a_w_ux = new TiXmlElement("a_w_ux");
553  parameters->LinkEndChild(a_w_ux);
554  TiXmlText *a_w_ux_text = new TiXmlText(SSTR(msg.a_w_ux));
555  a_w_ux->LinkEndChild(a_w_ux_text);
556 
557  a_w_uy = new TiXmlElement("a_w_uy");
558  parameters->LinkEndChild(a_w_uy);
559  TiXmlText *a_w_uy_text = new TiXmlText(SSTR(msg.a_w_uy));
560  a_w_uy->LinkEndChild(a_w_uy_text);
561 
562  a_w_w = new TiXmlElement("a_w_w");
563  parameters->LinkEndChild(a_w_w);
564  TiXmlText *a_w_w_text = new TiXmlText(SSTR(msg.a_w_w));
565  a_w_w->LinkEndChild(a_w_w_text);
566 
567  a_g_ux = new TiXmlElement("a_g_ux");
568  parameters->LinkEndChild(a_g_ux);
569  TiXmlText *a_g_ux_text = new TiXmlText(SSTR(msg.a_g_ux));
570  a_g_ux->LinkEndChild(a_g_ux_text);
571 
572  a_g_uy = new TiXmlElement("a_g_uy");
573  parameters->LinkEndChild(a_g_uy);
574  TiXmlText *a_g_uy_text = new TiXmlText(SSTR(msg.a_g_uy));
575  a_g_uy->LinkEndChild(a_g_uy_text);
576 
577  a_g_w = new TiXmlElement("a_g_w");
578  parameters->LinkEndChild(a_g_w);
579  TiXmlText *a_g_w_text = new TiXmlText(SSTR(msg.a_g_w));
580  a_g_w->LinkEndChild(a_g_w_text);
581  }
582 
585  template void XmlFileWriter::messageToFile
586  (stdr_msgs::RobotMsg msg,std::string file_name);
587 
589  template <>
590  void XmlFileWriter::messageToXmlElement<stdr_msgs::RobotMsg>
591  (stdr_msgs::RobotMsg msg,TiXmlNode* base){
592 
594  TiXmlElement* robot = new TiXmlElement("robot");
595  base->LinkEndChild(robot);
596 
598  TiXmlElement* robot_specifications =
599  new TiXmlElement("robot_specifications");
600  robot->LinkEndChild(robot_specifications);
601 
603  TiXmlElement* pose;
604  pose = new TiXmlElement("initial_pose");
605  robot_specifications->LinkEndChild(pose);
606 
608  TiXmlElement* x;
609  x = new TiXmlElement("x");
610  pose->LinkEndChild(x);
611  TiXmlText * x_text = new TiXmlText(SSTR(msg.initialPose.x));
612  x->LinkEndChild(x_text);
613 
615  TiXmlElement* y;
616  y = new TiXmlElement("y");
617  pose->LinkEndChild(y);
618  TiXmlText * y_text = new TiXmlText(SSTR(msg.initialPose.y));
619  y->LinkEndChild(y_text);
620 
622  TiXmlElement* theta;
623  theta = new TiXmlElement("theta");
624  pose->LinkEndChild(theta);
625  TiXmlText * theta_text = new TiXmlText(SSTR(msg.initialPose.theta));
626  theta->LinkEndChild(theta_text);
627 
629  messageToXmlElement(msg.footprint, robot_specifications);
630 
632  messageToXmlElement(msg.kinematicModel, robot_specifications);
633 
635  for(unsigned int i = 0 ; i < msg.laserSensors.size() ; i++)
636  {
637  messageToXmlElement(msg.laserSensors[i],robot_specifications);
638  }
639 
641  for(unsigned int i = 0 ; i < msg.sonarSensors.size() ; i++)
642  {
643  messageToXmlElement(msg.sonarSensors[i],robot_specifications);
644  }
645 
647  for(unsigned int i = 0 ; i < msg.rfidSensors.size() ; i++)
648  {
649  messageToXmlElement(msg.rfidSensors[i],robot_specifications);
650  }
651 
652  for(unsigned int i = 0 ; i < msg.co2Sensors.size() ; i++)
653  {
654  messageToXmlElement(msg.co2Sensors[i],robot_specifications);
655  }
656 
657  for(unsigned int i = 0 ; i < msg.thermalSensors.size() ; i++)
658  {
659  messageToXmlElement(msg.thermalSensors[i],robot_specifications);
660  }
661 
662  for(unsigned int i = 0 ; i < msg.soundSensors.size() ; i++)
663  {
664  messageToXmlElement(msg.soundSensors[i],robot_specifications);
665  }
666  }
667 
669 
676  template <class T>
677  void XmlFileWriter::messageToXmlElement(T msg,TiXmlNode* base)
678  {
679  }
680 
687  template <class T>
688  void XmlFileWriter::messageToFile(T msg,std::string file_name)
689  {
690  TiXmlDocument doc;
691  messageToXmlElement<T>(msg,&doc);
692  doc.SaveFile(file_name.c_str());
693  }
694 }
695 
The main namespace for STDR GUI XML parser.
#define SSTR(x)
< Transforms a float number to string
static void messageToXmlElement(T msg, TiXmlNode *base)
Creates an xml element from a msg - template member function.
XmlFileWriter(void)
Default constructor.
static void messageToFile(T msg, std::string file_name)
Creates an xml file from a message - template member function.


stdr_parser
Author(s): Manos Tsardoulias, Chris Zalidis, Aris Thallas
autogenerated on Mon Jun 10 2019 15:14:54