diff --git a/launch/alpha.bhv b/launch/alpha.bhv index 7a727f1..e0164ef 100644 --- a/launch/alpha.bhv +++ b/launch/alpha.bhv @@ -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 diff --git a/setting/SafetyRules.json b/setting/SafetyRules.json new file mode 100644 index 0000000..f2505b5 --- /dev/null +++ b/setting/SafetyRules.json @@ -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 + } + ] +} \ No newline at end of file diff --git a/src/pTaskManagement/TaskManger.cpp b/src/pTaskManagement/TaskManger.cpp index 58e9bec..e8f01b9 100644 --- a/src/pTaskManagement/TaskManger.cpp +++ b/src/pTaskManagement/TaskManger.cpp @@ -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