修改了状态管理代码
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "MBUtils.h"
|
||||
#include "StateManagement.h"
|
||||
#include <json/json.h>
|
||||
#include <cmath>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -36,7 +37,6 @@ bool StateManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
||||
for(p=NewMail.begin(); p!=NewMail.end(); p++) {
|
||||
CMOOSMsg &msg = *p;
|
||||
|
||||
#if 1 // Keep these around just for template
|
||||
string key = msg.GetKey();
|
||||
string comm = msg.GetCommunity();
|
||||
double dval = msg.GetDouble();
|
||||
@@ -45,11 +45,10 @@ bool StateManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
||||
double mtime = msg.GetTime();
|
||||
bool mdbl = msg.IsDouble();
|
||||
bool mstr = msg.IsString();
|
||||
#endif
|
||||
|
||||
Json::Value deviceState;
|
||||
double manualState;
|
||||
double missionState;
|
||||
double manualState;
|
||||
int missionState;
|
||||
|
||||
if(key == "uManual_enable_cmd")
|
||||
{
|
||||
@@ -75,18 +74,18 @@ bool StateManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
||||
deviceState["opMode"] = opModeLists.external;
|
||||
}
|
||||
else if (fabs(manualState - 0) < 1e-6) //manualState=0
|
||||
{
|
||||
if(missionState == 0)
|
||||
{
|
||||
switch (missionState)
|
||||
{
|
||||
case 0:
|
||||
deviceState["opMode"] = opModeLists.error;
|
||||
}
|
||||
if(missionState == 1)
|
||||
{
|
||||
break;
|
||||
case 1:
|
||||
deviceState["opMode"] = opModeLists.service;
|
||||
}
|
||||
else if((missionState == 3) )
|
||||
{
|
||||
break;
|
||||
case 3:
|
||||
deviceState["opMode"] = opModeLists.maneuver;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user