| 362 | |
| 363 | |
| 364 | int createTestLaunchFile(std::string launchFileFullName, std::vector<paramEntryAscii> entryList, std::string& testLaunchFile) |
| 365 | { |
| 366 | printf("Try loading launchfile :%s",launchFileFullName.c_str()); |
| 367 | TiXmlDocument doc; |
| 368 | doc.LoadFile(launchFileFullName.c_str()); |
| 369 | |
| 370 | if (doc.Error() == true) |
| 371 | { |
| 372 | ROS_ERROR("ERROR parsing launch file %s\nRow: %d\nCol: %d", doc.ErrorDesc(), doc.ErrorRow(), doc.ErrorCol()); |
| 373 | return(-1); |
| 374 | } |
| 375 | TiXmlNode *node = doc.FirstChild("launch"); |
| 376 | if (node != NULL) |
| 377 | { |
| 378 | node = node->FirstChild("node"); |
| 379 | std::vector<paramEntryAscii> paramOrgList = getParamList(node); |
| 380 | for (int i = 0; i < entryList.size(); i++) |
| 381 | { |
| 382 | bool replaceEntry = false; |
| 383 | for (int j = 0; j < paramOrgList.size(); j++) |
| 384 | { |
| 385 | if (entryList[i].getName().compare(paramOrgList[j].getName()) == 0) |
| 386 | { |
| 387 | paramOrgList[j].setValues(entryList[i].getName(), entryList[i].getType(), entryList[i].getValue()); |
| 388 | replaceEntry = true; |
| 389 | } |
| 390 | } |
| 391 | if (replaceEntry == false) // add new one to list |
| 392 | { |
| 393 | paramEntryAscii tmp(entryList[i].getName(), entryList[i].getType(), entryList[i].getValue()); |
| 394 | paramOrgList.push_back(tmp); |
| 395 | } |
| 396 | } |
| 397 | // delete all parameters and replace with new one |
| 398 | replaceParamList(node, paramOrgList); |
| 399 | } |
| 400 | |
| 401 | // append source extension if any |
| 402 | size_t pos = launchFileFullName.rfind('.'); |
| 403 | std::string resultFileName = ""; |
| 404 | testLaunchFile = ""; |
| 405 | if (pos != std::string::npos) |
| 406 | { |
| 407 | resultFileName = launchFileFullName.substr(0, pos); |
| 408 | resultFileName += "_test.launch"; |
| 409 | doc.SaveFile(resultFileName.c_str()); |
| 410 | testLaunchFile = resultFileName; |
| 411 | } |
| 412 | return(0); |
| 413 | } |
| 414 | |
| 415 | int cloud_width = 0; // hacky |
| 416 | int cloud_height = 0; |
no test coverage detected