diff --git a/PlanConfigure.json b/PlanConfigure.json deleted file mode 100644 index 861e03d..0000000 --- a/PlanConfigure.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "east_waypt_survey" : - { - "boardStamp" : 1698135269.1985879, - "clientStamp" : 1698135269.1812179, - "closedLoop" : true, - "constSpeed" : -1.0, - "duration" : -1.0, - "maxDepth" : -1.0, - "minDepth" : -1.0, - "origin" : - { - "altitude" : 0.0, - "lat" : 43.825298309326172, - "lon" : -70.330398559570312 - }, - "perpetual" : false, - "points" : - [ - { - "depth" : 9.0, - "east" : 121.51780491942634, - "lat" : 43.824428558349609, - "lon" : -70.328887939453125, - "name" : "station_1", - "north" : -96.635898081838207, - "speed" : 2.0, - "type" : "point" - }, - { - "depth" : 7.0, - "east" : 201.91511278899367, - "lat" : 43.824676513671875, - "lon" : -70.327888488769531, - "name" : "station_2", - "north" : -69.083922179977421, - "speed" : 2.5, - "type" : "point" - } - ], - "priority" : 10, - "repeat" : 3, - "sourceAddress" : "10.25.0.160", - "sourceName" : "CCU Neptus 0_163", - "taskId" : "1", - "taskName" : "east_waypt_survey" - }, - "plan1_toMoos" : - { - "boardStamp" : 1699602762.2845099, - "clientStamp" : 1699602762.7520001, - "closedLoop" : false, - "duration" : -1.0, - "maxDepth" : -1.0, - "minDepth" : -1.0, - "origin" : - { - "altitude" : 0.0, - "lat" : 43.825299999999999, - "lon" : -70.330399999999997 - }, - "perpetual" : false, - "points" : - [ - { - "depth" : 2.0, - "east" : 117.83291847226671, - "lat" : 43.825713999999998, - "lon" : -70.32893, - "name" : "Goto1", - "north" : 46.200319317940647, - "speed" : 2.0, - "type" : "point" - }, - { - "depth" : 2.0, - "east" : -17.18366087421261, - "lat" : 43.826782000000001, - "lon" : -70.330609999999993, - "name" : "Goto2", - "north" : 164.87635389378988, - "speed" : 2.0, - "type" : "point" - }, - { - "depth" : 2.0, - "east" : -241.19025325837993, - "lat" : 43.825465999999999, - "lon" : -70.333399999999997, - "name" : "Goto3", - "north" : 18.653618776002617, - "speed" : 2.0, - "type" : "point" - }, - { - "depth" : 2.0, - "east" : -203.76118848802312, - "lat" : 43.823234999999997, - "lon" : -70.332930000000005, - "name" : "Goto4", - "north" : -229.29782627916489, - "speed" : 2.0, - "type" : "point" - } - ], - "priority" : 10, - "repeat" : 1, - "sourceAddress" : "10.25.0.163", - "sourceName" : "CCU JHL 0_163", - "taskId" : "0,106,3,-96,8,-103,13,6,9,32,50,-13,47,-71,61,1", - "taskName" : "plan1_toMoos" - }, - "west_waypt_survey" : - { - "boardStamp" : 1698135268.3958621, - "clientStamp" : 1698135268.2057669, - "closedLoop" : true, - "constSpeed" : -1.0, - "duration" : -1.0, - "maxDepth" : -1.0, - "minDepth" : -1.0, - "origin" : - { - "altitude" : 0.0, - "lat" : 43.825298309326172, - "lon" : -70.330398559570312 - }, - "perpetual" : true, - "points" : - [ - { - "depth" : 9.0, - "east" : -91.445572043530944, - "lat" : 43.824195861816406, - "lon" : -70.331535339355469, - "name" : "station_1", - "north" : -122.49101460421512, - "speed" : 4.0 - }, - { - "depth" : 7.0, - "east" : 5.5235485468483718, - "lat" : 43.824298858642578, - "lon" : -70.330329895019531, - "name" : "station_2", - "north" : -111.04778559533926, - "speed" : 6.0 - }, - { - "depth" : 5.0, - "east" : 4.2961493948725868, - "lat" : 43.823516845703125, - "lon" : -70.330345153808594, - "name" : "station_3", - "north" : -197.93630920628678, - "speed" : 8.0 - }, - { - "depth" : 3.0, - "east" : -81.013520711457318, - "lat" : 43.823207855224609, - "lon" : -70.331405639648438, - "name" : "station_4", - "north" : -232.26737690334403, - "speed" : 10.0 - } - ], - "priority" : 10, - "repeat" : -1, - "sourceAddress" : "10.25.0.160", - "sourceName" : "CCU Neptus 0_163", - "taskId" : "2", - "taskName" : "west_waypt_survey" - } -} diff --git a/src/pStateManagement/CMakeLists.txt b/src/pStateManagement/CMakeLists.txt index bde6d92..0e5676b 100755 --- a/src/pStateManagement/CMakeLists.txt +++ b/src/pStateManagement/CMakeLists.txt @@ -17,6 +17,9 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) #find_package (jsoncpp NO_MODULE REQUIRED) +find_package (GeographicLib REQUIRED) +include_directories(${GeographicLib_INCLUDE_DIRS}) + include_directories(/usr/include/jsoncpp/) link_directories(/usr/local/lib/) @@ -26,7 +29,8 @@ TARGET_LINK_LIBRARIES(pStateManagement ${MOOS_LIBRARIES} ${CMAKE_DL_LIBS} ${SYSTEM_LIBS} - ${DUNE_LIB} + ${DUNE_LIB} + ${GeographicLib_LIBRARIES} mbutil m pthread diff --git a/src/pStateManagement/StateManagement.cpp b/src/pStateManagement/StateManagement.cpp index e6b2027..b503f49 100755 --- a/src/pStateManagement/StateManagement.cpp +++ b/src/pStateManagement/StateManagement.cpp @@ -9,6 +9,7 @@ #include "MBUtils.h" #include "StateManagement.h" #include +#include using namespace std; @@ -48,6 +49,7 @@ bool StateManagement::OnNewMail(MOOSMSG_LIST &NewMail) Json::Value deviceState; std::string manualState; int missionState; + int missionState; if(key == "uManual_enable_cmd") { @@ -76,15 +78,16 @@ bool StateManagement::OnNewMail(MOOSMSG_LIST &NewMail) { if(missionState == 0) { + case 0: deviceState["opMode"] = opModeLists.error; - } - if(missionState == 1) - { + break; + case 1: deviceState["opMode"] = opModeLists.service; } if((missionState == 3) ) { deviceState["opMode"] = opModeLists.maneuver; + break; } } diff --git a/src/pStateManagement/StateManagement.h b/src/pStateManagement/StateManagement.h index 5da5f97..6635540 100755 --- a/src/pStateManagement/StateManagement.h +++ b/src/pStateManagement/StateManagement.h @@ -9,6 +9,12 @@ #define StateManagement_HEADER #include "MOOS/libMOOS/MOOSLib.h" +#include "MOOS/libMOOS/Thirdparty/AppCasting/AppCastingMOOSApp.h" +#include +#include +#include +#include +#include class StateManagement : public CMOOSApp {