加入了分任务保存日志
This commit is contained in:
@@ -18,14 +18,14 @@ AltOrigin = 0
|
|||||||
VehicleName = lauv-150
|
VehicleName = lauv-150
|
||||||
|
|
||||||
LogEnable = false
|
LogEnable = false
|
||||||
LogDir = /home/jhl/moos-ivp-pi/moos-ivp-pi-word/log/
|
LogDir = /home/jhl/project/moos-ivp-pi/log/
|
||||||
AuvDataLog = auvData.mdat
|
AuvDataLog = auvData.mdat
|
||||||
MissionHistoryLog = missionHistory.txt
|
MissionHistoryLog = missionHistory.txt
|
||||||
ClientCommandLog = clientCommand.txt
|
ClientCommandLog = clientCommand.txt
|
||||||
FaultLog = faultLog.txt
|
FaultLog = faultLog.txt
|
||||||
MotionControlLog = motionControl.txt
|
MotionControlLog = motionControl.txt
|
||||||
|
|
||||||
llaOriginPath = /home/jhl/moos-ivp-pi/moos-ivp-pi-word/setting/Origin.json
|
llaOriginPath = /home/jhl/project/moos-ivp-pi/setting/Origin.json
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
// Antler configuration block
|
// Antler configuration block
|
||||||
@@ -209,9 +209,9 @@ ProcessConfig = pTaskManagement
|
|||||||
{
|
{
|
||||||
AppTick = 8
|
AppTick = 8
|
||||||
CommsTick = 8
|
CommsTick = 8
|
||||||
planConfigPath = /home/zjk/project/work/moos-ivp-pi/setting/PlanConfigure.json
|
planConfigPath = /home/jhl/project/moos-ivp-pi/setting/PlanConfigure.json
|
||||||
safetyRulesPath = /home/zjk/project/work/moos-ivp-pi/setting/SafetyRules.json
|
safetyRulesPath = /home/jhl/project/moos-ivp-pi/setting/SafetyRules.json
|
||||||
wayConfigParamPath = /home/zjk/project/work/moos-ivp-pi/setting/WayConfigParam.json
|
wayConfigParamPath = /home/jhl/project/moos-ivp-pi/setting/WayConfigParam.json
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessConfig = pBoardSupportComm
|
ProcessConfig = pBoardSupportComm
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ bool BoardSupportComm::OnNewMail(MOOSMSG_LIST &NewMail)
|
|||||||
{
|
{
|
||||||
executeCommand.manual_mode = false;
|
executeCommand.manual_mode = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(key == "uManual_drive_cmd")
|
if(key == "uManual_drive_cmd")
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ bool DataManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
|||||||
if (sval == "true")
|
if (sval == "true")
|
||||||
{
|
{
|
||||||
logEnable = true;
|
logEnable = true;
|
||||||
OpenOutputStream();
|
OpenOutputStream("");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -84,6 +84,39 @@ bool DataManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
|||||||
CloseOutputStream();
|
CloseOutputStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(key == "uMission_action_cmd")
|
||||||
|
{
|
||||||
|
if (logEnable)
|
||||||
|
{
|
||||||
|
std::string err;
|
||||||
|
Json::Value recvCommand;
|
||||||
|
std::istringstream iss(sval);
|
||||||
|
Json::CharReaderBuilder builder;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool parsingResult = Json::parseFromStream(builder, iss, &recvCommand, &err);
|
||||||
|
if (!parsingResult)
|
||||||
|
{
|
||||||
|
throw ("uMission_action_cmd parse error");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (recvCommand["action"].asString() == "start")
|
||||||
|
{
|
||||||
|
CloseOutputStream();
|
||||||
|
OpenOutputStream(recvCommand["taskName"].asString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CloseOutputStream();
|
||||||
|
OpenOutputStream("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (std::string s)
|
||||||
|
{
|
||||||
|
std::cout << s << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(key == "uDevice_monitor_fb")
|
if(key == "uDevice_monitor_fb")
|
||||||
{
|
{
|
||||||
@@ -264,7 +297,9 @@ bool DataManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
|||||||
<< motionControlInfo.desiredSpeed << ","
|
<< motionControlInfo.desiredSpeed << ","
|
||||||
<< motionControlInfo.desiredDepth;
|
<< motionControlInfo.desiredDepth;
|
||||||
Notify("uMotion_desired_log", ss.str());
|
Notify("uMotion_desired_log", ss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
@@ -415,44 +450,7 @@ bool DataManagement::OnStartUp()
|
|||||||
|
|
||||||
if (logEnable)
|
if (logEnable)
|
||||||
{
|
{
|
||||||
// std::string subDir;
|
OpenOutputStream("");
|
||||||
// std::string localTime;
|
|
||||||
// GenerateFileName(subDir, localTime);
|
|
||||||
// saveLogDir += "/" + subDir;
|
|
||||||
// if (access(saveLogDir.c_str(), F_OK) == -1 )
|
|
||||||
// {
|
|
||||||
// mode_t mode = 0775;
|
|
||||||
// mkdir(saveLogDir.c_str(), mode);
|
|
||||||
// }
|
|
||||||
// saveLogDir += "/" + localTime;
|
|
||||||
// if (access(saveLogDir.c_str(), F_OK) == -1 )
|
|
||||||
// {
|
|
||||||
// mode_t mode = 0775;
|
|
||||||
// mkdir(saveLogDir.c_str(), mode);
|
|
||||||
// }
|
|
||||||
// std::string auvDataSavePath = saveLogDir + "/" + auvDataFile;
|
|
||||||
// std::string missionHistorySavePath = saveLogDir + "/" + missionHistoryFile;
|
|
||||||
// std::string clientCommandSavePath = saveLogDir + "/" + clientCommandFile;
|
|
||||||
// std::string faultLogSavePath = saveLogDir + "/" + faultLogFile;
|
|
||||||
// std::string motionControlSavePath = saveLogDir + "/" + motionControlFile;
|
|
||||||
|
|
||||||
// if(!OpenFile(auvDataStream, auvDataSavePath))
|
|
||||||
// return MOOSFail("Failed to Open auvData file");
|
|
||||||
// if(!OpenFile(missionHistoryStream, missionHistorySavePath))
|
|
||||||
// return MOOSFail("Failed to Open missionHistory file");
|
|
||||||
// if(!OpenFile(clientCommandStream, clientCommandSavePath))
|
|
||||||
// return MOOSFail("Failed to Open clientCommand file");
|
|
||||||
// if(!OpenFile(faultLogStream, faultLogSavePath))
|
|
||||||
// return MOOSFail("Failed to Open faultLog file");
|
|
||||||
// if(!OpenFile(motionControlStream, motionControlSavePath))
|
|
||||||
// return MOOSFail("Failed to Open faultLog file");
|
|
||||||
|
|
||||||
// DoAuvDataLogBanner(auvDataStream);
|
|
||||||
// DoMissionHistoryBanner(missionHistoryStream);
|
|
||||||
// DoFaultHandleBanner(faultLogStream);
|
|
||||||
// DoMotionControlBanner(motionControlStream);
|
|
||||||
|
|
||||||
OpenOutputStream();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisterVariables();
|
RegisterVariables();
|
||||||
@@ -485,6 +483,7 @@ void DataManagement::RegisterVariables()
|
|||||||
Register("DESIRED_DEPTH", 0);
|
Register("DESIRED_DEPTH", 0);
|
||||||
Register("uMotion_desired_log", 0);
|
Register("uMotion_desired_log", 0);
|
||||||
Register("uClient_logEnable_cmd", 0);
|
Register("uClient_logEnable_cmd", 0);
|
||||||
|
Register("uMission_action_cmd", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataManagement::buildReport()
|
bool DataManagement::buildReport()
|
||||||
@@ -635,7 +634,7 @@ void DataManagement::GenerateFileName(std::string &fileDir, std::string &fileNam
|
|||||||
fileName = ss.str();
|
fileName = ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataManagement::OpenOutputStream()
|
bool DataManagement::OpenOutputStream(std::string extraName)
|
||||||
{
|
{
|
||||||
std::string subDir;
|
std::string subDir;
|
||||||
std::string localTime;
|
std::string localTime;
|
||||||
@@ -646,7 +645,14 @@ bool DataManagement::OpenOutputStream()
|
|||||||
mode_t mode = 0775;
|
mode_t mode = 0775;
|
||||||
mkdir(saveSubLogDir.c_str(), mode);
|
mkdir(saveSubLogDir.c_str(), mode);
|
||||||
}
|
}
|
||||||
saveSubLogDir += "/" + localTime;
|
if (extraName.size() == 0)
|
||||||
|
{
|
||||||
|
saveSubLogDir += "/" + localTime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
saveSubLogDir += "/" + localTime + "_" + extraName;
|
||||||
|
}
|
||||||
if (access(saveSubLogDir.c_str(), F_OK) == -1 )
|
if (access(saveSubLogDir.c_str(), F_OK) == -1 )
|
||||||
{
|
{
|
||||||
mode_t mode = 0775;
|
mode_t mode = 0775;
|
||||||
@@ -712,4 +718,4 @@ void DataManagement::CloseOutputStream()
|
|||||||
{
|
{
|
||||||
motionControlStream.close();
|
motionControlStream.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ protected:
|
|||||||
void DoMotionControlBanner(std::ofstream &os);
|
void DoMotionControlBanner(std::ofstream &os);
|
||||||
|
|
||||||
void GenerateFileName(std::string &fileDir, std::string &fileName);
|
void GenerateFileName(std::string &fileDir, std::string &fileName);
|
||||||
bool OpenOutputStream();
|
bool OpenOutputStream(std::string extraName);
|
||||||
void CloseOutputStream();
|
void CloseOutputStream();
|
||||||
double getTimeStamp();
|
double getTimeStamp();
|
||||||
int nDoublePrecision;
|
int nDoublePrecision;
|
||||||
|
|||||||
@@ -45,11 +45,9 @@ bool StateManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
|||||||
double mtime = msg.GetTime();
|
double mtime = msg.GetTime();
|
||||||
bool mdbl = msg.IsDouble();
|
bool mdbl = msg.IsDouble();
|
||||||
bool mstr = msg.IsString();
|
bool mstr = msg.IsString();
|
||||||
|
|
||||||
Json::Value deviceState;
|
Json::Value deviceState;
|
||||||
std::string manualState;
|
std::string manualState;
|
||||||
int missionState;
|
int missionState;
|
||||||
int missionState;
|
|
||||||
|
|
||||||
if(key == "uManual_enable_cmd")
|
if(key == "uManual_enable_cmd")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -731,8 +731,10 @@ void SurfaceSupportComm::processMessage(DUNE::IMC::Message * message)
|
|||||||
<< "SetEntityParameters" << ":"
|
<< "SetEntityParameters" << ":"
|
||||||
<< MOOS::Time();
|
<< MOOS::Time();
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Json::Value calibrationCommand;
|
||||||
for(; iter < msg->params.end(); iter++)
|
for(; iter < msg->params.end(); iter++)
|
||||||
{
|
{
|
||||||
DUNE::IMC::EntityParameter *subEntityParameter = static_cast<DUNE::IMC::EntityParameter *>(*iter);
|
DUNE::IMC::EntityParameter *subEntityParameter = static_cast<DUNE::IMC::EntityParameter *>(*iter);
|
||||||
@@ -747,11 +749,11 @@ void SurfaceSupportComm::processMessage(DUNE::IMC::Message * message)
|
|||||||
{
|
{
|
||||||
throw ("SetEntityParameters parse error");
|
throw ("SetEntityParameters parse error");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string parentName = msg->name;
|
std::string parentName = msg->name;
|
||||||
std::string childName = subEntityParameter->name;
|
std::string childName = subEntityParameter->name;
|
||||||
std::string dataType = parameterValue["type"].asString();
|
std::string dataType = parameterValue["type"].asString();
|
||||||
std::string dataValueTemp = parameterValue["value"].asString();
|
std::string dataValueTemp = parameterValue["value"].asString();
|
||||||
|
calibrationCommand[parentName][childName] = subEntityParameter->value;
|
||||||
#if 0
|
#if 0
|
||||||
if (dataType == "float")
|
if (dataType == "float")
|
||||||
{
|
{
|
||||||
@@ -791,8 +793,10 @@ void SurfaceSupportComm::processMessage(DUNE::IMC::Message * message)
|
|||||||
<< std::string(msg->getName()) << ","
|
<< std::string(msg->getName()) << ","
|
||||||
<< ss1.str();
|
<< ss1.str();
|
||||||
appCastContent = appCastStream.str();
|
appCastContent = appCastStream.str();
|
||||||
|
|
||||||
Notify("uClient_parameterSet_log", ss1.str());
|
Notify("uClient_parameterSet_log", ss1.str());
|
||||||
|
|
||||||
|
Json::StreamWriterBuilder builder2;
|
||||||
|
Notify("uClient_calibration_cmd", Json::writeString(builder2, calibrationCommand));
|
||||||
}
|
}
|
||||||
catch(std::string s)
|
catch(std::string s)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user