Skip to content
Snippets Groups Projects
Commit 7e8ee330 authored by Tobias Gröger's avatar Tobias Gröger
Browse files

Visualize path alternatives inside TimedElasticBands

parent f14dce58
No related branches found
No related tags found
2 merge requests!48Set visualization of teb,!28Draft: Dev -> Main
#include "TimedElasticBands.h" #include "TimedElasticBands.h"
#include <SimoxUtility/algorithm/apply.hpp>
#include <SimoxUtility/json/json.hpp> #include <SimoxUtility/json/json.hpp>
#include <VirtualRobot/MathTools.h> #include <VirtualRobot/MathTools.h>
#include <VirtualRobot/Robot.h> #include <VirtualRobot/Robot.h>
...@@ -128,6 +129,32 @@ namespace armarx::navigation::local_planning ...@@ -128,6 +129,32 @@ namespace armarx::navigation::local_planning
core::LocalTrajectory best = conv::fromRos(hcp_->findBestTeb()->teb()); core::LocalTrajectory best = conv::fromRos(hcp_->findBestTeb()->teb());
// visualize path alternatives
if (arviz != nullptr)
{
auto layer = arviz->layer("local_planner_path_alternatives");
int i = 0;
int bestTebIdx = hcp_->bestTebIdx();
for (const auto& teb : hcp_->getTrajectoryContainer())
{
if (i == bestTebIdx)
{
continue;
}
const core::LocalTrajectory trajectory = conv::fromRos(teb->teb());
const std::vector<Eigen::Vector3f> points =
simox::alg::apply(trajectory.points(),
[](const core::LocalTrajectoryPoint& pt) -> Eigen::Vector3f
{ return pt.pose.translation(); });
layer.add(viz::Path("path_alternative_" + std::to_string(i))
.points(points)
.color(simox::Color::gray()));
i++;
}
arviz->commit(layer);
}
return {{.trajectory = best}}; return {{.trajectory = best}};
} }
...@@ -165,7 +192,7 @@ namespace armarx::navigation::local_planning ...@@ -165,7 +192,7 @@ namespace armarx::navigation::local_planning
ARMARX_CHECK(scene.dynamicScene.has_value()); ARMARX_CHECK(scene.dynamicScene.has_value());
for (const auto& obst : scene.dynamicScene.value().humans) for (const auto& obst : scene.dynamicScene.value().humans)
{ {
obstManager.addHumanObstacle(obst, visPtr); obstManager.addHumanObstacle(obst, visPtr);
} }
} }
......
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