add goals file to txt trajectory

parent 72bf84fb
Pipeline #19406 passed with stages
in 10 minutes and 17 seconds
......@@ -358,9 +358,36 @@ std::string getSourceFileName(const std::string & GetProjectFile)
}
std::string getGoalFileName(const std::string & GetProjectFile)
{
std::string ret="";
TiXmlDocument doc(GetProjectFile);
if (!doc.LoadFile()) {
Log->Write("ERROR: \t%s", doc.ErrorDesc());
Log->Write("ERROR: \tGetSourceFileName could not parse the project file");
return ret;
}
TiXmlNode* xRootNode = doc.RootElement();
if (!xRootNode->FirstChild("routing")) {
return ret;
}
//load goals and routes
TiXmlNode* xGoalsNode = xRootNode->FirstChild("routing")->FirstChild("goals");
TiXmlNode* xGoalsNodeFile = xGoalsNode->FirstChild("file");
if(xGoalsNodeFile)
{
ret = xGoalsNodeFile->FirstChild()->ValueStr();
Log->Write("INFO:\tGoal file <%s> will be parsed", ret.c_str());
}
return ret;
}
void TrajectoriesFLAT::WriteHeader(long nPeds, double fps, Building* building, int seed, int count)
{
std::string sourceFileName = getSourceFileName(building->GetProjectFilename());
std::string goalFileName = getGoalFileName(building->GetProjectFilename());
(void) seed; (void) nPeds;
char tmp[100] = "";
sprintf(tmp, "#description: jpscore (%s)", JPSCORE_VERSION);
......@@ -373,7 +400,8 @@ void TrajectoriesFLAT::WriteHeader(long nPeds, double fps, Building* building, i
Write(tmp);
sprintf(tmp,"#sources: %s", sourceFileName.c_str());
Write(tmp);
sprintf(tmp,"#goals: %s", goalFileName.c_str());
Write(tmp);
Write("#ID: the agent ID");
Write("#FR: the current frame");
Write("#X,Y,Z: the agents coordinates (in metres)");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment