39 (stdr_msgs::Noise msg,std::string file_name);
43 void XmlFileWriter::messageToXmlElement<stdr_msgs::Noise>
44 (stdr_msgs::Noise msg,TiXmlNode* base)
48 noise =
new TiXmlElement(
"noise");
49 base->LinkEndChild(noise);
52 TiXmlElement* noise_specs;
53 noise_specs =
new TiXmlElement(
"noise_specifications");
54 noise->LinkEndChild(noise_specs);
57 TiXmlElement* noise_mean;
58 noise_mean =
new TiXmlElement(
"noise_mean");
59 noise_specs->LinkEndChild(noise_mean);
61 TiXmlText * noise_mean_text =
new TiXmlText(
SSTR(msg.noiseMean));
62 noise_mean->LinkEndChild(noise_mean_text);
65 TiXmlElement* noise_std;
66 noise_std =
new TiXmlElement(
"noise_std");
67 noise_specs->LinkEndChild(noise_std);
69 TiXmlText * noise_std_text =
new TiXmlText(
SSTR(msg.noiseStd));
70 noise_std->LinkEndChild(noise_std_text);
76 (stdr_msgs::FootprintMsg msg,std::string file_name);
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);
88 TiXmlElement* footprint_specs;
89 footprint_specs =
new TiXmlElement(
"footprint_specifications");
90 footprint->LinkEndChild(footprint_specs);
94 radius =
new TiXmlElement(
"radius");
95 footprint_specs->LinkEndChild(radius);
96 TiXmlText * radius_text =
new TiXmlText(
SSTR(msg.radius));
97 radius->LinkEndChild(radius_text);
100 TiXmlElement* points;
101 points =
new TiXmlElement(
"points");
102 footprint_specs->LinkEndChild(points);
104 for(
unsigned int i = 0 ; i < msg.points.size() ; i++)
107 point =
new TiXmlElement(
"point");
108 points->LinkEndChild(point);
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);
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);
127 void XmlFileWriter::messageToXmlElement<geometry_msgs::Pose2D>
128 (geometry_msgs::Pose2D msg,TiXmlNode* base){
131 pose =
new TiXmlElement(
"pose");
132 base->LinkEndChild(pose);
136 x =
new TiXmlElement(
"x");
137 pose->LinkEndChild(x);
138 TiXmlText * x_text =
new TiXmlText(
SSTR(msg.x));
139 x->LinkEndChild(x_text);
143 y =
new TiXmlElement(
"y");
144 pose->LinkEndChild(y);
145 TiXmlText * y_text =
new TiXmlText(
SSTR(msg.y));
146 y->LinkEndChild(y_text);
150 theta =
new TiXmlElement(
"theta");
151 pose->LinkEndChild(theta);
152 TiXmlText * theta_text =
new TiXmlText(
SSTR(msg.theta));
153 theta->LinkEndChild(theta_text);
159 (stdr_msgs::LaserSensorMsg msg,std::string file_name);
163 void XmlFileWriter::messageToXmlElement<stdr_msgs::LaserSensorMsg>
164 (stdr_msgs::LaserSensorMsg msg,TiXmlNode* base){
167 TiXmlElement* laser =
new TiXmlElement(
"laser");
168 base->LinkEndChild(laser);
171 TiXmlElement* laser_specifications =
172 new TiXmlElement(
"laser_specifications");
173 laser->LinkEndChild(laser_specifications);
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);
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);
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);
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);
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);
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);
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);
227 (stdr_msgs::SonarSensorMsg msg,std::string file_name);
231 void XmlFileWriter::messageToXmlElement<stdr_msgs::SonarSensorMsg>
232 (stdr_msgs::SonarSensorMsg msg,TiXmlNode* base){
235 TiXmlElement* sonar =
new TiXmlElement(
"sonar");
236 base->LinkEndChild(sonar);
239 TiXmlElement* sonar_specifications =
240 new TiXmlElement(
"sonar_specifications");
241 sonar->LinkEndChild(sonar_specifications);
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);
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);
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);
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);
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);
283 (stdr_msgs::RfidSensorMsg msg,std::string file_name);
287 void XmlFileWriter::messageToXmlElement<stdr_msgs::RfidSensorMsg>
288 (stdr_msgs::RfidSensorMsg msg,TiXmlNode* base){
291 TiXmlElement* rfidReader =
new TiXmlElement(
"rfid_reader");
292 base->LinkEndChild(rfidReader);
295 TiXmlElement* rfid_reader_specifications =
296 new TiXmlElement(
"rfid_reader_specifications");
297 rfidReader->LinkEndChild(rfid_reader_specifications);
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);
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);
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);
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);
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);
335 (stdr_msgs::CO2SensorMsg msg,std::string file_name);
339 void XmlFileWriter::messageToXmlElement<stdr_msgs::CO2SensorMsg>
340 (stdr_msgs::CO2SensorMsg msg,TiXmlNode* base){
343 TiXmlElement* sensor =
new TiXmlElement(
"co2_sensor");
344 base->LinkEndChild(sensor);
347 TiXmlElement* sensor_specifications =
348 new TiXmlElement(
"co2_sensor_specifications");
349 sensor->LinkEndChild(sensor_specifications);
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);
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);
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);
387 (stdr_msgs::ThermalSensorMsg msg,std::string file_name);
391 void XmlFileWriter::messageToXmlElement<stdr_msgs::ThermalSensorMsg>
392 (stdr_msgs::ThermalSensorMsg msg,TiXmlNode* base){
395 TiXmlElement* sensor =
new TiXmlElement(
"thermal_sensor");
396 base->LinkEndChild(sensor);
399 TiXmlElement* sensor_specifications =
400 new TiXmlElement(
"thermal_sensor_specifications");
401 sensor->LinkEndChild(sensor_specifications);
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);
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);
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);
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);
439 (stdr_msgs::SoundSensorMsg msg,std::string file_name);
443 void XmlFileWriter::messageToXmlElement<stdr_msgs::SoundSensorMsg>
444 (stdr_msgs::SoundSensorMsg msg,TiXmlNode* base){
447 TiXmlElement* sensor =
new TiXmlElement(
"sound_sensor");
448 base->LinkEndChild(sensor);
451 TiXmlElement* sensor_specifications =
452 new TiXmlElement(
"sound_sensor_specifications");
453 sensor->LinkEndChild(sensor_specifications);
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);
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);
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);
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);
492 (stdr_msgs::KinematicMsg msg,std::string file_name);
496 void XmlFileWriter::messageToXmlElement<stdr_msgs::KinematicMsg>
497 (stdr_msgs::KinematicMsg msg,TiXmlNode* base){
500 TiXmlElement* kinematic =
new TiXmlElement(
"kinematic");
501 base->LinkEndChild(kinematic);
504 TiXmlElement* kinematic_specifications =
505 new TiXmlElement(
"kinematic_specifications");
506 kinematic->LinkEndChild(kinematic_specifications);
510 model =
new TiXmlElement(
"kinematic_model");
511 kinematic_specifications->LinkEndChild(model);
512 TiXmlText * model_text =
new TiXmlText(msg.type);
513 model->LinkEndChild(model_text);
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;
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
586 (stdr_msgs::RobotMsg msg,std::string file_name);
590 void XmlFileWriter::messageToXmlElement<stdr_msgs::RobotMsg>
591 (stdr_msgs::RobotMsg msg,TiXmlNode* base){
594 TiXmlElement* robot =
new TiXmlElement(
"robot");
595 base->LinkEndChild(robot);
598 TiXmlElement* robot_specifications =
599 new TiXmlElement(
"robot_specifications");
600 robot->LinkEndChild(robot_specifications);
604 pose =
new TiXmlElement(
"initial_pose");
605 robot_specifications->LinkEndChild(pose);
609 x =
new TiXmlElement(
"x");
610 pose->LinkEndChild(x);
611 TiXmlText * x_text =
new TiXmlText(
SSTR(msg.initialPose.x));
612 x->LinkEndChild(x_text);
616 y =
new TiXmlElement(
"y");
617 pose->LinkEndChild(y);
618 TiXmlText * y_text =
new TiXmlText(
SSTR(msg.initialPose.y));
619 y->LinkEndChild(y_text);
623 theta =
new TiXmlElement(
"theta");
624 pose->LinkEndChild(theta);
625 TiXmlText * theta_text =
new TiXmlText(
SSTR(msg.initialPose.theta));
626 theta->LinkEndChild(theta_text);
635 for(
unsigned int i = 0 ; i < msg.laserSensors.size() ; i++)
641 for(
unsigned int i = 0 ; i < msg.sonarSensors.size() ; i++)
647 for(
unsigned int i = 0 ; i < msg.rfidSensors.size() ; i++)
652 for(
unsigned int i = 0 ; i < msg.co2Sensors.size() ; i++)
657 for(
unsigned int i = 0 ; i < msg.thermalSensors.size() ; i++)
662 for(
unsigned int i = 0 ; i < msg.soundSensors.size() ; i++)
691 messageToXmlElement<T>(msg,&doc);
692 doc.SaveFile(file_name.c_str());
The main namespace for STDR GUI XML parser.
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.