增加了任务管理程序路径参数配置文件及功能
This commit is contained in:
9
setting/WayConfigParam.json
Normal file
9
setting/WayConfigParam.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"lead" : 8,
|
||||
"lead_damper" : 1,
|
||||
"lead_to_start" : false,
|
||||
"capture_line" : true,
|
||||
"capture_radius" : 5,
|
||||
"slip_radius" : 15,
|
||||
"efficiency_measure" :"all"
|
||||
}
|
||||
@@ -359,13 +359,13 @@ bool TaskManger::Iterate()
|
||||
readSafetyRules();
|
||||
setSafetyRules(maxTime, maxDepth, minAltitude, safePolygon);
|
||||
// setMaxDepth(maxDepth);
|
||||
setMaxDepth("2");
|
||||
setMaxDepth(maxDepth);
|
||||
st = 49;
|
||||
break;
|
||||
}
|
||||
case 41: //路径参数配置
|
||||
{
|
||||
readWayConfig("a");
|
||||
readWayConfig();
|
||||
setWayConfig(lead,lead_damper,capture_line,capture_radius,slip_radius);
|
||||
st = 49;
|
||||
//setWayConfig();
|
||||
@@ -444,14 +444,21 @@ bool TaskManger::OnStartUp()
|
||||
if(param == "SAFETYRULESPATH")
|
||||
{
|
||||
safetyRulesPath = value;
|
||||
RepList["RulesPath"] = safetyRulesPath;
|
||||
}
|
||||
//RepList["RulesPath"] = safetyRulesPath;
|
||||
}
|
||||
if(param == "WAYCONFIGPARAMPATH")
|
||||
{
|
||||
wayParamPath = value;
|
||||
RepList["WayConfigPath"] = wayParamPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(planConfigPath == "")
|
||||
reportConfigWarning("NO TASK FILE PATH");
|
||||
if(planConfigPath == "")
|
||||
reportConfigWarning("NO TASK SAFETY RULES CONFIG");
|
||||
if(wayParamPath == "")
|
||||
reportConfigWarning("NO WAY PARAM CONFIG");
|
||||
RegisterVariables();
|
||||
return(true);
|
||||
}
|
||||
@@ -748,15 +755,32 @@ int TaskManger::readSafetyRules()
|
||||
|
||||
}
|
||||
|
||||
int TaskManger::readWayConfig(string filename)
|
||||
int TaskManger::readWayConfig()
|
||||
{
|
||||
lead = "8";
|
||||
lead_damper = "1";
|
||||
lead_to_start = "false";
|
||||
capture_line = "true";
|
||||
capture_radius = "5";
|
||||
slip_radius = "15";
|
||||
efficiency_measure = "all";
|
||||
ifstream ifs;
|
||||
ifs.open(wayParamPath, ios::in);
|
||||
Json::Reader reader;
|
||||
Json::Value inputJsonValue;
|
||||
reader.parse(ifs, inputJsonValue);
|
||||
ifs.close();
|
||||
if(!inputJsonValue.isMember("lead")
|
||||
|| !inputJsonValue.isMember("lead_damper")
|
||||
|| !inputJsonValue.isMember("lead_to_start")
|
||||
|| !inputJsonValue.isMember("capture_line")
|
||||
|| !inputJsonValue.isMember("capture_radius")
|
||||
|| !inputJsonValue.isMember("efficiency_measure")
|
||||
|| !inputJsonValue.isMember("slip_radius"))
|
||||
return 1;
|
||||
if(!inputJsonValue["points"].isArray())
|
||||
return 2;
|
||||
lead = doubleToString(inputJsonValue["lead"].asDouble());
|
||||
lead_damper = doubleToString(inputJsonValue["lead_damper"].asDouble());
|
||||
lead_to_start = boolToString(inputJsonValue["lead_to_start"].asBool());
|
||||
capture_line = boolToString(inputJsonValue["capture_line"].asBool());
|
||||
capture_radius = doubleToString(inputJsonValue["capture_radius"].asDouble());
|
||||
slip_radius = doubleToString(inputJsonValue["slip_radius"].asDouble());
|
||||
efficiency_measure = inputJsonValue["efficiency_measure"].asString();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1046,7 +1070,7 @@ inline void TaskManger::InitConfig()
|
||||
//
|
||||
readSafetyRules();
|
||||
setSafetyRules(maxTime, maxDepth, minAltitude, safePolygon);
|
||||
readWayConfig("a");
|
||||
readWayConfig();
|
||||
setWayConfig(lead,lead_damper,capture_line,capture_radius,slip_radius);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: 1553836110 1553836110@qq.com
|
||||
* @Date: 2023-09-28 15:45:17
|
||||
* @LastEditors: zhaojingkui 1553836110@qq.com
|
||||
* @LastEditTime: 2023-11-28 15:38:44
|
||||
* @LastEditTime: 2023-11-29 10:08:55
|
||||
* @FilePath: /moos-ivp-pi/src/pTaskManagement/TaskManger.h
|
||||
* @Description:
|
||||
*
|
||||
@@ -66,7 +66,7 @@ class TaskManger : public AppCastingMOOSApp
|
||||
|
||||
int readTaskFile(string taskName);
|
||||
int readSafetyRules();
|
||||
int readWayConfig(string fileName);
|
||||
int readWayConfig();
|
||||
void postReportToSSM();
|
||||
|
||||
inline void clearHelmFlag(){Notify("HELM_MAP_CLEAR",0.0);}
|
||||
@@ -142,6 +142,7 @@ private:
|
||||
//TODO:动态配置任务文件等参数
|
||||
string planConfigPath;
|
||||
string safetyRulesPath;
|
||||
string wayParamPath;
|
||||
vector<string> taskList;
|
||||
int taskCount;
|
||||
string taskName;
|
||||
|
||||
@@ -8,6 +8,7 @@ ProcessConfig = pTaskManger
|
||||
AppTick = 10
|
||||
CommsTick = 10
|
||||
planConfigPath = /home/zjk/project/work/moos-ivp-pi/setting/PlanConfigure.json
|
||||
planConfigPath = /home/zjk/project/work/moos-ivp-pi/setting/SafetyRules.json
|
||||
safetyRulesPath = /home/zjk/project/work/moos-ivp-pi/setting/SafetyRules.json
|
||||
wayConfigParamPath = /home/zjk/project/work/moos-ivp-pi/setting/WayConfigParam.json
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user