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

Use for(auto& ...) instead of for(auto ...)

parent 6b3fe415
No related branches found
No related tags found
No related merge requests found
Pipeline #4532 passed
...@@ -148,7 +148,7 @@ int main() ...@@ -148,7 +148,7 @@ int main()
// SELF-CALIBRATION OF SENSOR ORIENTATION // SELF-CALIBRATION OF SENSOR ORIENTATION
// Uncomment this line below to achieve sensor self-calibration (of the orientation only, since the position is not observable) // Uncomment this line below to achieve sensor self-calibration (of the orientation only, since the position is not observable)
// sensor_rb->getO()->unfix(); sensor_rb->getO()->unfix();
// SELF-CALIBRATION OF SENSOR POSITION // SELF-CALIBRATION OF SENSOR POSITION
// The position is however not observable, and thus self-calibration would not work. You can try uncommenting the line below. // The position is however not observable, and thus self-calibration would not work. You can try uncommenting the line below.
...@@ -221,17 +221,17 @@ int main() ...@@ -221,17 +221,17 @@ int main()
// PERTURB initial guess // PERTURB initial guess
WOLF_TRACE("======== PERTURB PROBLEM PRIORS =======") WOLF_TRACE("======== PERTURB PROBLEM PRIORS =======")
for (auto sen : problem->getHardware()->getSensorList()) for (auto& sen : problem->getHardware()->getSensorList())
for (auto sb : sen->getStateBlockVec()) for (auto& sb : sen->getStateBlockVec())
if (sb && !sb->isFixed()) if (sb && !sb->isFixed())
sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT ! sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT !
for (auto kf : problem->getTrajectory()->getFrameList()) for (auto& kf : problem->getTrajectory()->getFrameList())
if (kf->isKeyOrAux()) if (kf->isKeyOrAux())
for (auto sb : kf->getStateBlockVec()) for (auto& sb : kf->getStateBlockVec())
if (sb && !sb->isFixed()) if (sb && !sb->isFixed())
sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT ! sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT !
for (auto lmk : problem->getMap()->getLandmarkList()) for (auto& lmk : problem->getMap()->getLandmarkList())
for (auto sb : lmk->getStateBlockVec()) for (auto& sb : lmk->getStateBlockVec())
if (sb && !sb->isFixed()) if (sb && !sb->isFixed())
sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT ! sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT !
problem->print(1,0,1,0); problem->print(1,0,1,0);
...@@ -245,19 +245,19 @@ int main() ...@@ -245,19 +245,19 @@ int main()
// GET COVARIANCES of all states // GET COVARIANCES of all states
WOLF_TRACE("======== COVARIANCES OF SOLVED PROBLEM =======") WOLF_TRACE("======== COVARIANCES OF SOLVED PROBLEM =======")
ceres->computeCovariances(SolverManager::CovarianceBlocksToBeComputed::ALL_MARGINALS); ceres->computeCovariances(SolverManager::CovarianceBlocksToBeComputed::ALL_MARGINALS);
for (auto kf : problem->getTrajectory()->getFrameList()) for (auto& kf : problem->getTrajectory()->getFrameList())
if (kf->isKeyOrAux()) if (kf->isKeyOrAux())
{ {
Eigen::MatrixXs cov; Eigen::MatrixXs cov;
kf->getCovariance(cov); kf->getCovariance(cov);
WOLF_TRACE("KF", kf->id(), "_cov = \n", cov); WOLF_TRACE("KF", kf->id(), "_cov = \n", cov);
} }
for (auto lmk : problem->getMap()->getLandmarkList()) for (auto& lmk : problem->getMap()->getLandmarkList())
{ {
Eigen::MatrixXs cov; Eigen::MatrixXs cov;
lmk->getCovariance(cov); lmk->getCovariance(cov);
WOLF_TRACE("L", lmk->id(), "_cov = \n", cov); WOLF_TRACE("L", lmk->id(), "_cov = \n", cov);
} }
std::cout << std::endl; std::cout << std::endl;
WOLF_TRACE("======== FINAL PRINT FOR INTERPRETATION =======") WOLF_TRACE("======== FINAL PRINT FOR INTERPRETATION =======")
......
...@@ -204,17 +204,17 @@ int main() ...@@ -204,17 +204,17 @@ int main()
// PERTURB initial guess // PERTURB initial guess
WOLF_TRACE("======== PERTURB PROBLEM PRIORS =======") WOLF_TRACE("======== PERTURB PROBLEM PRIORS =======")
for (auto sen : problem->getHardware()->getSensorList()) for (auto& sen : problem->getHardware()->getSensorList())
for (auto sb : sen->getStateBlockVec()) for (auto& sb : sen->getStateBlockVec())
if (sb && !sb->isFixed()) if (sb && !sb->isFixed())
sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT ! sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT !
for (auto kf : problem->getTrajectory()->getFrameList()) for (auto& kf : problem->getTrajectory()->getFrameList())
if (kf->isKeyOrAux()) if (kf->isKeyOrAux())
for (auto sb : kf->getStateBlockVec()) for (auto& sb : kf->getStateBlockVec())
if (sb && !sb->isFixed()) if (sb && !sb->isFixed())
sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT ! sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT !
for (auto lmk : problem->getMap()->getLandmarkList()) for (auto& lmk : problem->getMap()->getLandmarkList())
for (auto sb : lmk->getStateBlockVec()) for (auto& sb : lmk->getStateBlockVec())
if (sb && !sb->isFixed()) if (sb && !sb->isFixed())
sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT ! sb->setState(sb->getState() + VectorXs::Random(sb->getSize()) * 0.5); // We perturb A LOT !
problem->print(1,0,1,0); problem->print(1,0,1,0);
...@@ -228,19 +228,19 @@ int main() ...@@ -228,19 +228,19 @@ int main()
// GET COVARIANCES of all states // GET COVARIANCES of all states
WOLF_TRACE("======== COVARIANCES OF SOLVED PROBLEM =======") WOLF_TRACE("======== COVARIANCES OF SOLVED PROBLEM =======")
ceres->computeCovariances(SolverManager::CovarianceBlocksToBeComputed::ALL_MARGINALS); ceres->computeCovariances(SolverManager::CovarianceBlocksToBeComputed::ALL_MARGINALS);
for (auto kf : problem->getTrajectory()->getFrameList()) for (auto& kf : problem->getTrajectory()->getFrameList())
if (kf->isKeyOrAux()) if (kf->isKeyOrAux())
{ {
Eigen::MatrixXs cov; Eigen::MatrixXs cov;
kf->getCovariance(cov); kf->getCovariance(cov);
WOLF_TRACE("KF", kf->id(), "_cov = \n", cov); WOLF_TRACE("KF", kf->id(), "_cov = \n", cov);
} }
for (auto lmk : problem->getMap()->getLandmarkList()) for (auto& lmk : problem->getMap()->getLandmarkList())
{ {
Eigen::MatrixXs cov; Eigen::MatrixXs cov;
lmk->getCovariance(cov); lmk->getCovariance(cov);
WOLF_TRACE("L", lmk->id(), "_cov = \n", cov); WOLF_TRACE("L", lmk->id(), "_cov = \n", cov);
} }
std::cout << std::endl; std::cout << std::endl;
WOLF_TRACE("======== FINAL PRINT FOR INTERPRETATION =======") WOLF_TRACE("======== FINAL PRINT FOR INTERPRETATION =======")
......
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