增加了安全规则设置,在seting文件夹中添加了安全规则配置文件
This commit is contained in:
@@ -12,7 +12,6 @@ set MODE = T1{
|
||||
TaskNum = t1
|
||||
}
|
||||
|
||||
|
||||
//----------路径点任务----------------------------
|
||||
Behavior = BHV_Waypoint
|
||||
{
|
||||
@@ -155,19 +154,20 @@ Behavior = BHV_MaxDepth
|
||||
// ---------------------------
|
||||
name = op_region // example
|
||||
pwt = 300 // default
|
||||
condition = MODE==TN
|
||||
condition = MODE==ACTIVE
|
||||
updates = OPREGION_UPDATES // example
|
||||
|
||||
// Parameters specific to this behavior
|
||||
// ------------------------------------
|
||||
max_time = 20 // default (seconds)
|
||||
max_depth = 25 // default (meters)
|
||||
max_time = 0.1 // default (seconds)
|
||||
max_depth = 2 // default (meters)
|
||||
min_altitude = 0 // default (meters)
|
||||
reset_var = OPREGION_RESET // example
|
||||
trigger_entry_time = 1 // default (seconds)
|
||||
trigger_exit_time = 0.5 // default (seconds)
|
||||
|
||||
polygon = pts={-80,-00:-30,-175:150,-100:95,25}
|
||||
//polygon = -160,90:275,90:275,-360:-160,-360
|
||||
|
||||
breached_altitude_flag = TaskFault = AltitudeOut
|
||||
breached_depth_flag = TaskFault = DepthOut
|
||||
|
||||
24
setting/SafetyRules.json
Normal file
24
setting/SafetyRules.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"maxTime" : 100,
|
||||
"maxDepth" : 100,
|
||||
"minAltitude" : 1,
|
||||
"points" :
|
||||
[
|
||||
{
|
||||
"east" : 90,
|
||||
"north" : -160
|
||||
},
|
||||
{
|
||||
"east" : 90,
|
||||
"north" : 275
|
||||
},
|
||||
{
|
||||
"east" : -360,
|
||||
"north" : 275
|
||||
},
|
||||
{
|
||||
"east" : -360,
|
||||
"north" : -160
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user