加入了分任务保存日志
This commit is contained in:
@@ -18,14 +18,14 @@ AltOrigin = 0
|
||||
VehicleName = lauv-150
|
||||
|
||||
LogEnable = false
|
||||
LogDir = /home/jhl/moos-ivp-pi/moos-ivp-pi-word/log/
|
||||
LogDir = /home/jhl/project/moos-ivp-pi/log/
|
||||
AuvDataLog = auvData.mdat
|
||||
MissionHistoryLog = missionHistory.txt
|
||||
ClientCommandLog = clientCommand.txt
|
||||
FaultLog = faultLog.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
|
||||
@@ -209,9 +209,9 @@ ProcessConfig = pTaskManagement
|
||||
{
|
||||
AppTick = 8
|
||||
CommsTick = 8
|
||||
planConfigPath = /home/zjk/project/work/moos-ivp-pi/setting/PlanConfigure.json
|
||||
safetyRulesPath = /home/zjk/project/work/moos-ivp-pi/setting/SafetyRules.json
|
||||
wayConfigParamPath = /home/zjk/project/work/moos-ivp-pi/setting/WayConfigParam.json
|
||||
planConfigPath = /home/jhl/project/moos-ivp-pi/setting/PlanConfigure.json
|
||||
safetyRulesPath = /home/jhl/project/moos-ivp-pi/setting/SafetyRules.json
|
||||
wayConfigParamPath = /home/jhl/project/moos-ivp-pi/setting/WayConfigParam.json
|
||||
}
|
||||
|
||||
ProcessConfig = pBoardSupportComm
|
||||
|
||||
@@ -76,7 +76,7 @@ bool DataManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
||||
if (sval == "true")
|
||||
{
|
||||
logEnable = true;
|
||||
OpenOutputStream();
|
||||
OpenOutputStream("");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -84,6 +84,39 @@ bool DataManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
||||
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")
|
||||
{
|
||||
@@ -265,6 +298,8 @@ bool DataManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
||||
<< motionControlInfo.desiredDepth;
|
||||
Notify("uMotion_desired_log", ss.str());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(true);
|
||||
@@ -415,44 +450,7 @@ bool DataManagement::OnStartUp()
|
||||
|
||||
if (logEnable)
|
||||
{
|
||||
// std::string subDir;
|
||||
// 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();
|
||||
OpenOutputStream("");
|
||||
}
|
||||
|
||||
RegisterVariables();
|
||||
@@ -485,6 +483,7 @@ void DataManagement::RegisterVariables()
|
||||
Register("DESIRED_DEPTH", 0);
|
||||
Register("uMotion_desired_log", 0);
|
||||
Register("uClient_logEnable_cmd", 0);
|
||||
Register("uMission_action_cmd", 0);
|
||||
}
|
||||
|
||||
bool DataManagement::buildReport()
|
||||
@@ -635,7 +634,7 @@ void DataManagement::GenerateFileName(std::string &fileDir, std::string &fileNam
|
||||
fileName = ss.str();
|
||||
}
|
||||
|
||||
bool DataManagement::OpenOutputStream()
|
||||
bool DataManagement::OpenOutputStream(std::string extraName)
|
||||
{
|
||||
std::string subDir;
|
||||
std::string localTime;
|
||||
@@ -646,7 +645,14 @@ bool DataManagement::OpenOutputStream()
|
||||
mode_t mode = 0775;
|
||||
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 )
|
||||
{
|
||||
mode_t mode = 0775;
|
||||
|
||||
@@ -44,7 +44,7 @@ protected:
|
||||
void DoMotionControlBanner(std::ofstream &os);
|
||||
|
||||
void GenerateFileName(std::string &fileDir, std::string &fileName);
|
||||
bool OpenOutputStream();
|
||||
bool OpenOutputStream(std::string extraName);
|
||||
void CloseOutputStream();
|
||||
double getTimeStamp();
|
||||
int nDoublePrecision;
|
||||
|
||||
@@ -45,11 +45,9 @@ bool StateManagement::OnNewMail(MOOSMSG_LIST &NewMail)
|
||||
double mtime = msg.GetTime();
|
||||
bool mdbl = msg.IsDouble();
|
||||
bool mstr = msg.IsString();
|
||||
|
||||
Json::Value deviceState;
|
||||
std::string manualState;
|
||||
int missionState;
|
||||
int missionState;
|
||||
|
||||
if(key == "uManual_enable_cmd")
|
||||
{
|
||||
|
||||
@@ -731,8 +731,10 @@ void SurfaceSupportComm::processMessage(DUNE::IMC::Message * message)
|
||||
<< "SetEntityParameters" << ":"
|
||||
<< MOOS::Time();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
Json::Value calibrationCommand;
|
||||
for(; iter < msg->params.end(); 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");
|
||||
}
|
||||
|
||||
std::string parentName = msg->name;
|
||||
std::string childName = subEntityParameter->name;
|
||||
std::string dataType = parameterValue["type"].asString();
|
||||
std::string dataValueTemp = parameterValue["value"].asString();
|
||||
calibrationCommand[parentName][childName] = subEntityParameter->value;
|
||||
#if 0
|
||||
if (dataType == "float")
|
||||
{
|
||||
@@ -791,8 +793,10 @@ void SurfaceSupportComm::processMessage(DUNE::IMC::Message * message)
|
||||
<< std::string(msg->getName()) << ","
|
||||
<< ss1.str();
|
||||
appCastContent = appCastStream.str();
|
||||
|
||||
Notify("uClient_parameterSet_log", ss1.str());
|
||||
|
||||
Json::StreamWriterBuilder builder2;
|
||||
Notify("uClient_calibration_cmd", Json::writeString(builder2, calibrationCommand));
|
||||
}
|
||||
catch(std::string s)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user