Skip to content
Snippets Groups Projects
Commit 0c90bd21 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Make printHeader() more uniform

parent 1e53a5d5
No related branches found
No related tags found
1 merge request!348WIP: Resolve "Rework Problem::{check,print} into a recursive approach"
Pipeline #5194 failed
...@@ -260,7 +260,7 @@ int main() ...@@ -260,7 +260,7 @@ int main()
std::cout << std::endl; std::cout << std::endl;
WOLF_TRACE("======== FINAL PRINT FOR INTERPRETATION =======") WOLF_TRACE("======== FINAL PRINT FOR INTERPRETATION =======")
problem->print(4,1,1,1); problem->print(4,0,1,0);
/* /*
* ============= FIRST COMMENT ON THE RESULTS ================== * ============= FIRST COMMENT ON THE RESULTS ==================
......
...@@ -297,18 +297,46 @@ void CaptureBase::printHeader(int _depth, std::ostream& _stream, bool _constr_by ...@@ -297,18 +297,46 @@ void CaptureBase::printHeader(int _depth, std::ostream& _stream, bool _constr_by
} }
_stream << std::endl; _stream << std::endl;
if (_state_blocks)
for (const auto& sb : getStateBlockVec()) if (_metric && _state_blocks){
for (const auto& key : getStructure())
{ {
if(sb != nullptr) auto sb = getStateBlock(key);
{ _stream << " " << key << "[" << (sb->isFixed() ? "Fix" : "Est") << "] = ( " << sb->getState().transpose() << " )" << std::endl;
_stream << " sb: ";
_stream << (sb->isFixed() ? "Fix" : "Est");
if (_metric)
_stream << std::setprecision(2) << " (" << sb->getState().transpose() << " )";
_stream << std::endl;
}
} }
}
else if (_metric)
{
_stream << (isFixed() ? " Fix" : " Est") << ", ts=" << std::setprecision(5)
<< getTimeStamp();
_stream << ",\t x = ( " << std::setprecision(2) << getState().transpose() << " )";
_stream << std::endl;
}
else if (_state_blocks)
{
_stream << " sb:";
for (const auto& key : getStructure())
{
const auto& sb = getStateBlock(key);
_stream << " " << key << "[" << (sb->isFixed() ? "Fix" : "Est") << "]; ";
}
_stream << std::endl;
}
// if (_state_blocks)
// for (const auto& sb : getStateBlockVec())
// {
// if(sb != nullptr)
// {
// _stream << " sb: ";
// _stream << (sb->isFixed() ? "Fix" : "Est");
// if (_metric)
// _stream << std::setprecision(2) << " (" << sb->getState().transpose() << " )";
// _stream << std::endl;
// }
// }
} }
void CaptureBase::print(int _depth, std::ostream& _stream, bool _constr_by, bool _metric, bool _state_blocks) const void CaptureBase::print(int _depth, std::ostream& _stream, bool _constr_by, bool _metric, bool _state_blocks) const
{ {
......
...@@ -374,7 +374,7 @@ void FrameBase::printHeader(int _depth, std::ostream& _stream, bool _constr_by, ...@@ -374,7 +374,7 @@ void FrameBase::printHeader(int _depth, std::ostream& _stream, bool _constr_by,
for (const auto& key : getStructure()) for (const auto& key : getStructure())
{ {
auto sb = getStateBlock(key); auto sb = getStateBlock(key);
_stream << " " << key << "," << (sb->isFixed() ? "Fix: " : "Est: ") << sb->getState().transpose() << std::endl; _stream << " " << key << "[" << (sb->isFixed() ? "Fix" : "Est") << "] = ( " << sb->getState().transpose() << " )" << std::endl;
} }
} }
else if (_metric) else if (_metric)
...@@ -387,9 +387,10 @@ void FrameBase::printHeader(int _depth, std::ostream& _stream, bool _constr_by, ...@@ -387,9 +387,10 @@ void FrameBase::printHeader(int _depth, std::ostream& _stream, bool _constr_by,
else if (_state_blocks) else if (_state_blocks)
{ {
_stream << " sb:"; _stream << " sb:";
for (const auto& sb : getStateBlockVec()) for (const auto& key : getStructure())
{ {
_stream << " " << (sb->isFixed() ? "Fix" : "Est"); const auto& sb = getStateBlock(key);
_stream << " " << key << "[" << (sb->isFixed() ? "Fix" : "Est") << "]; ";
} }
_stream << std::endl; _stream << std::endl;
} }
......
...@@ -163,19 +163,27 @@ void LandmarkBase::printHeader(int _depth, std::ostream& _stream, bool _constr_b ...@@ -163,19 +163,27 @@ void LandmarkBase::printHeader(int _depth, std::ostream& _stream, bool _constr_b
_stream << "Fac" << cby->id() << " \t"; _stream << "Fac" << cby->id() << " \t";
} }
_stream << std::endl; _stream << std::endl;
if (_metric)
if (_metric && _state_blocks){
for (const auto& key : getStructure())
{
auto sb = getStateBlock(key);
_stream << " " << key << "[" << (sb->isFixed() ? "Fix" : "Est") << "] = ( " << sb->getState().transpose() << " )" << std::endl;
}
}
else if (_metric)
{ {
_stream << (isFixed() ? " Fix" : " Est"); _stream << (isFixed() ? " Fix" : " Est");
_stream << ",\t x = ( " << std::setprecision(2) << getState().transpose() << " )"; _stream << ",\t x = ( " << std::setprecision(2) << getState().transpose() << " )";
_stream << std::endl; _stream << std::endl;
} }
if (_state_blocks) else if (_state_blocks)
{ {
_stream << " sb:"; _stream << " sb:";
for (const auto& sb : getStateBlockVec()) for (const auto& key : getStructure())
{ {
if (sb != nullptr) const auto& sb = getStateBlock(key);
_stream << (sb->isFixed() ? " Fix" : " Est"); _stream << " " << key << "[" << (sb->isFixed() ? "Fix" : "Est") << "]; ";
} }
_stream << std::endl; _stream << std::endl;
} }
......
...@@ -473,6 +473,7 @@ void SensorBase::printHeader(int _depth, std::ostream& _stream, bool _constr_by, ...@@ -473,6 +473,7 @@ void SensorBase::printHeader(int _depth, std::ostream& _stream, bool _constr_by,
if (_depth < 2) if (_depth < 2)
_stream << " -- " << getProcessorList().size() << "p"; _stream << " -- " << getProcessorList().size() << "p";
_stream << std::endl; _stream << std::endl;
if (_metric && _state_blocks) if (_metric && _state_blocks)
{ {
_stream << " sb: "; _stream << " sb: ";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment