From a9ba0ac868d56254aedebaa462074b8531d1f41f Mon Sep 17 00:00:00 2001 From: zhaojingkui <1553836110@qq.com> Date: Wed, 29 Nov 2023 09:33:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E8=A7=84=E5=88=99=E8=AE=BE=E7=BD=AE,=E5=9C=A8seting=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E4=B8=AD=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E8=A7=84=E5=88=99=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- launch/alpha.bhv | 8 ++++---- setting/SafetyRules.json | 24 ++++++++++++++++++++++++ src/pTaskManagement/TaskManger.cpp | 22 +++++++++++++--------- 3 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 setting/SafetyRules.json 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