void MasterTestSet_t :: fromXml(TiXmlNode* pNode){ if(pNode == NULL)return; XML_CHECK("MasterTestSet",pNode->Type() == TiXmlNode::ELEMENT); TiXmlElement* pEm = pNode->ToElement(); XML_CHECK("MasterTestSet",pEm != 0); PhysicalLayer = FromString_string(pEm, pEm->Attribute("PhysicalLayer")); LogFile = FromString_string(pEm, pEm->Attribute("LogFile")); Log.fromXml(pNode->FirstChildElement("Log")); Master.fromXml(pNode->FirstChildElement("Master")); PhysicalLayerList.fromXml(pNode->FirstChildElement("PhysicalLayerList")); valid=true; };
void SlaveTestSet_t :: fromXml(TiXmlNode* pNode) { if(pNode == NULL)return; XML_CHECK("SlaveTestSet", pNode->Type() == TiXmlNode::ELEMENT); TiXmlElement* pEm = pNode->ToElement(); XML_CHECK("SlaveTestSet", pEm != 0); LogFile = FromString_string(pEm, pEm->Attribute("LogFile")); PhysicalLayer = FromString_string(pEm, pEm->Attribute("PhysicalLayer")); Remote = FromString_bool(pEm, pEm->Attribute("Remote")); RemotePort = FromString_int(pEm, pEm->Attribute("RemotePort")); LinkCommandStatus = FromString_bool(pEm, pEm->Attribute("LinkCommandStatus")); StartOnline = FromString_bool(pEm, pEm->Attribute("StartOnline")); Log.fromXml(pNode->FirstChildElement("Log")); Slave.fromXml(pNode->FirstChildElement("Slave")); DeviceTemplate.fromXml(pNode->FirstChildElement("DeviceTemplate")); PhysicalLayerList.fromXml(pNode->FirstChildElement("PhysicalLayerList")); valid = true; };
EReturn AICOProblem::initDerived(tinyxml2::XMLHandle & handle) { EReturn ret_value = SUCCESS; tinyxml2::XMLElement* xmltmp; bool hastime = false; XML_CHECK("T"); XML_OK(getInt(*xmltmp, T)); if (T <= 2) { INDICATE_FAILURE ; return PAR_ERR; } xmltmp = handle.FirstChildElement("duration").ToElement(); if (xmltmp) { XML_OK(getDouble(*xmltmp, tau)); tau = tau / ((double) T); hastime = true; } if (hastime) { xmltmp = handle.FirstChildElement("tau").ToElement(); if (xmltmp) WARNING("Duration has already been specified, tau is ignored."); } else { XML_CHECK("tau"); XML_OK(getDouble(*xmltmp, tau)); } XML_CHECK("Qrate"); XML_OK(getDouble(*xmltmp, Q_rate)); XML_CHECK("Hrate"); XML_OK(getDouble(*xmltmp, H_rate)); XML_CHECK("Wrate"); XML_OK(getDouble(*xmltmp, W_rate)); { Eigen::VectorXd tmp; XML_CHECK("W"); XML_OK(getVector(*xmltmp, tmp)); W = Eigen::MatrixXd::Identity(tmp.rows(), tmp.rows()); W.diagonal() = tmp; } for (TaskDefinition_map::const_iterator it = task_defs_.begin(); it != task_defs_.end() and ok(ret_value); ++it) { if (it->second->type().compare(std::string("TaskSqrError")) == 0) ERROR("Task variable " << it->first << " is not an squared error!"); } // Set number of time steps return setTime(T); }
EReturn OMPLsolver::initDerived(tinyxml2::XMLHandle & handle) { tinyxml2::XMLHandle tmp_handle = handle.FirstChildElement( "TrajectorySmooth"); server_->registerParam<std_msgs::Bool>(ns_, tmp_handle, smooth_); tmp_handle = handle.FirstChildElement("SaveResults"); server_->registerParam<std_msgs::Bool>(ns_, tmp_handle, saveResults_); tinyxml2::XMLElement* xmltmp; std::string txt; XML_CHECK("algorithm"); { txt = std::string(xmltmp->GetText()); bool known = false; std::vector<std::string> nm = getPlannerNames(); for (std::string s : nm) { if (txt.compare(s.substr(11)) == 0) { selected_planner_ = s; INFO( "Using planning algorithm: "<<selected_planner_<<". Trajectory smoother is "<<(smooth_->data?"Enabled":"Disabled")); known = true; break; } } if (!known) { ERROR("Unknown planning algorithm ["<<txt<<"]"); HIGHLIGHT_NAMED(object_name_, "Available algorithms:"); for (std::string s : nm) HIGHLIGHT_NAMED(object_name_, s); return FAILURE; } } XML_CHECK("max_goal_sampling_attempts"); XML_OK(getInt(*xmltmp, goal_ampling_max_attempts_)); projection_components_.clear(); tmp_handle = handle.FirstChildElement("Projection"); if (tmp_handle.ToElement()) { projector_ = tmp_handle.ToElement()->Attribute("type"); tinyxml2::XMLHandle jnt_handle = tmp_handle.FirstChildElement( "component"); while (jnt_handle.ToElement()) { const char* atr = jnt_handle.ToElement()->Attribute("name"); if (atr) { projection_components_.push_back(std::string(atr)); } else { INDICATE_FAILURE ; return FAILURE; } jnt_handle = jnt_handle.NextSiblingElement("component"); } } tmp_handle = handle.FirstChildElement("Range"); if (tmp_handle.ToElement()) { server_->registerParam<std_msgs::String>(ns_, tmp_handle, range_); } if (saveResults_->data) { std::string path = ros::package::getPath("ompl_solver") + "/result/" + txt + ".txt"; result_file_.open(path); if (!result_file_.is_open()) { ERROR("Error open "<<path); return FAILURE; } } succ_cnt_ = 0; return SUCCESS; }