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

Merge branch 'feature/path-alternatives-visualization' into feature/teb-visualization

parents 9c99adbb 7e8ee330
No related branches found
No related tags found
2 merge requests!48Set visualization of teb,!28Draft: Dev -> Main
#include "TimedElasticBands.h"
#include <SimoxUtility/algorithm/apply.hpp>
#include <SimoxUtility/json/json.hpp>
#include <VirtualRobot/MathTools.h>
#include <VirtualRobot/Robot.h>
......@@ -128,6 +129,32 @@ namespace armarx::navigation::local_planning
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}};
}
......
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