增加了安全规则设置,在seting文件夹中添加了安全规则配置文件

This commit is contained in:
2023-11-29 09:33:17 +08:00
parent f5c34bd4b9
commit a9ba0ac868
3 changed files with 41 additions and 13 deletions

View File

@@ -142,7 +142,6 @@ bool TaskManger::OnNewMail(MOOSMSG_LIST &NewMail)
faultNumber = 1111;
}
}
}
return(true);
}
@@ -445,7 +444,7 @@ bool TaskManger::OnStartUp()
if(param == "SAFETYRULESPATH")
{
safetyRulesPath = value;
//RepList["RulesPath"] = safetyRulesPath;
RepList["RulesPath"] = safetyRulesPath;
}
}
}
@@ -709,7 +708,7 @@ int TaskManger::readTaskFile(string taskName)
int TaskManger::readSafetyRules()
{
ifstream ifs;
ifs.open(planConfigPath, ios::in);
ifs.open(safetyRulesPath, ios::in);
Json::Reader reader;
Json::Value inputJsonValue;
reader.parse(ifs, inputJsonValue);
@@ -728,18 +727,23 @@ int TaskManger::readSafetyRules()
maxDepth = doubleToString(depth);
minAltitude = doubleToString(altitude);
safePolygon = "";
string pts = "";
Json::Value points = inputJsonValue["points"];
//"pts={-80,-00:-30,-175:150,-100:95,25}"
int ps_cnt = points.size();
for(int i=0; i<ps_cnt; i++)
{
string x = points["north"].asString();
string y = points["east"].asString();
if(safePolygon=="")
safePolygon = x + "," + y ;
string x = intToString(points[i]["north"].asInt());
string y = intToString(points[i]["east"].asInt());
if(pts=="")
pts = x + "," + y ;
else
safePolygon = safePolygon + ":" + x + "," + y ;
pts = pts + ":" + x + "," + y ;
}
safePolygon = pts;
// safePolygon="pts={-80,-00:-30,-175:150,-100:9,2}";s
RepList["safePolygon"] = safePolygon;
RepList["maxTime"] = maxTime;
return 0;
}