增加了任务管理程序路径参数配置文件及功能
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();
|
readSafetyRules();
|
||||||
setSafetyRules(maxTime, maxDepth, minAltitude, safePolygon);
|
setSafetyRules(maxTime, maxDepth, minAltitude, safePolygon);
|
||||||
// setMaxDepth(maxDepth);
|
// setMaxDepth(maxDepth);
|
||||||
setMaxDepth("2");
|
setMaxDepth(maxDepth);
|
||||||
st = 49;
|
st = 49;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 41: //路径参数配置
|
case 41: //路径参数配置
|
||||||
{
|
{
|
||||||
readWayConfig("a");
|
readWayConfig();
|
||||||
setWayConfig(lead,lead_damper,capture_line,capture_radius,slip_radius);
|
setWayConfig(lead,lead_damper,capture_line,capture_radius,slip_radius);
|
||||||
st = 49;
|
st = 49;
|
||||||
//setWayConfig();
|
//setWayConfig();
|
||||||
@@ -444,7 +444,12 @@ bool TaskManger::OnStartUp()
|
|||||||
if(param == "SAFETYRULESPATH")
|
if(param == "SAFETYRULESPATH")
|
||||||
{
|
{
|
||||||
safetyRulesPath = value;
|
safetyRulesPath = value;
|
||||||
RepList["RulesPath"] = safetyRulesPath;
|
//RepList["RulesPath"] = safetyRulesPath;
|
||||||
|
}
|
||||||
|
if(param == "WAYCONFIGPARAMPATH")
|
||||||
|
{
|
||||||
|
wayParamPath = value;
|
||||||
|
RepList["WayConfigPath"] = wayParamPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -452,6 +457,8 @@ bool TaskManger::OnStartUp()
|
|||||||
reportConfigWarning("NO TASK FILE PATH");
|
reportConfigWarning("NO TASK FILE PATH");
|
||||||
if(planConfigPath == "")
|
if(planConfigPath == "")
|
||||||
reportConfigWarning("NO TASK SAFETY RULES CONFIG");
|
reportConfigWarning("NO TASK SAFETY RULES CONFIG");
|
||||||
|
if(wayParamPath == "")
|
||||||
|
reportConfigWarning("NO WAY PARAM CONFIG");
|
||||||
RegisterVariables();
|
RegisterVariables();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@@ -748,15 +755,32 @@ int TaskManger::readSafetyRules()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int TaskManger::readWayConfig(string filename)
|
int TaskManger::readWayConfig()
|
||||||
{
|
{
|
||||||
lead = "8";
|
ifstream ifs;
|
||||||
lead_damper = "1";
|
ifs.open(wayParamPath, ios::in);
|
||||||
lead_to_start = "false";
|
Json::Reader reader;
|
||||||
capture_line = "true";
|
Json::Value inputJsonValue;
|
||||||
capture_radius = "5";
|
reader.parse(ifs, inputJsonValue);
|
||||||
slip_radius = "15";
|
ifs.close();
|
||||||
efficiency_measure = "all";
|
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();
|
readSafetyRules();
|
||||||
setSafetyRules(maxTime, maxDepth, minAltitude, safePolygon);
|
setSafetyRules(maxTime, maxDepth, minAltitude, safePolygon);
|
||||||
readWayConfig("a");
|
readWayConfig();
|
||||||
setWayConfig(lead,lead_damper,capture_line,capture_radius,slip_radius);
|
setWayConfig(lead,lead_damper,capture_line,capture_radius,slip_radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: 1553836110 1553836110@qq.com
|
* @Author: 1553836110 1553836110@qq.com
|
||||||
* @Date: 2023-09-28 15:45:17
|
* @Date: 2023-09-28 15:45:17
|
||||||
* @LastEditors: zhaojingkui 1553836110@qq.com
|
* @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
|
* @FilePath: /moos-ivp-pi/src/pTaskManagement/TaskManger.h
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@@ -66,7 +66,7 @@ class TaskManger : public AppCastingMOOSApp
|
|||||||
|
|
||||||
int readTaskFile(string taskName);
|
int readTaskFile(string taskName);
|
||||||
int readSafetyRules();
|
int readSafetyRules();
|
||||||
int readWayConfig(string fileName);
|
int readWayConfig();
|
||||||
void postReportToSSM();
|
void postReportToSSM();
|
||||||
|
|
||||||
inline void clearHelmFlag(){Notify("HELM_MAP_CLEAR",0.0);}
|
inline void clearHelmFlag(){Notify("HELM_MAP_CLEAR",0.0);}
|
||||||
@@ -142,6 +142,7 @@ private:
|
|||||||
//TODO:动态配置任务文件等参数
|
//TODO:动态配置任务文件等参数
|
||||||
string planConfigPath;
|
string planConfigPath;
|
||||||
string safetyRulesPath;
|
string safetyRulesPath;
|
||||||
|
string wayParamPath;
|
||||||
vector<string> taskList;
|
vector<string> taskList;
|
||||||
int taskCount;
|
int taskCount;
|
||||||
string taskName;
|
string taskName;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ ProcessConfig = pTaskManger
|
|||||||
AppTick = 10
|
AppTick = 10
|
||||||
CommsTick = 10
|
CommsTick = 10
|
||||||
planConfigPath = /home/zjk/project/work/moos-ivp-pi/setting/PlanConfigure.json
|
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