Skip to content
Snippets Groups Projects
Commit d0fe5ba5 authored by Andre Meixner's avatar Andre Meixner :camera:
Browse files

Updated visualization of framed box locations

parent 95730d70
No related branches found
No related tags found
No related merge requests found
Pipeline #21597 failed
#include "Visu.h"
#include <SimoxUtility/color/Color.h>
#include <SimoxUtility/color/KellyLUT.h>
#include <ArmarXCore/core/logging/Logging.h>
namespace armarx::priorknowledge::util::location
......@@ -25,10 +28,28 @@ namespace armarx::priorknowledge::util::location
const Eigen::Vector3f& extends) const
{
// Add global location to layer
layer.add(armarx::viz::Box(id)
std::smatch matches;
if (std::regex_match(id, matches, pattern))
{
const std::string& affordance_name = matches[1];
unique_affordances.insert(affordance_name);
unsigned int index = std::distance(unique_affordances.begin(), unique_affordances.find(affordance_name))
% simox::color::KellyLUT::KELLY_COLORS_COLOR_BLIND.size();
layer.add(armarx::viz::Text(id + "_name").text(affordance_name)
.color(simox::color::Color::black()).scale(10.0f).pose(locationGlobalPose));
layer.add(armarx::viz::Box(id)
.pose(locationGlobalPose)
.size(extends)
.color(simox::color::KellyLUT::KELLY_COLORS_COLOR_BLIND.at(index).with_alpha(0.5f)));
}
else
{
layer.add(armarx::viz::Text(id + "_name").text(id).pose(locationGlobalPose));
layer.add(armarx::viz::Box(id)
.pose(locationGlobalPose)
.size(extends)
.color(this->settings.framedBoxedLocationColor));
}
}
viz::Layer
......
#pragma once
#include <regex>
#include <unordered_map>
#include <RobotAPI/components/ArViz/Client/Client.h>
#include <RobotAPI/components/ArViz/Client/ScopedClient.h>
......@@ -60,5 +63,9 @@ namespace armarx::priorknowledge::util::location
protected:
viz::Client& arviz;
private:
const std::regex pattern = std::regex(R"(^[^:]+\/([^:]+?):[^:]+?$)");
mutable std::set<std::string> unique_affordances;
};
} // namespace armarx::priorknowledge::util::location
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