Skip to content

Commit

Permalink
バッファクリア
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo committed Jan 31, 2025
1 parent ef36d46 commit fa8f453
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions crane_robot_skills/include/crane_robot_skills/skill_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ class SkillInterface
command_base->latest_msg.skill_name = name;
}

virtual ~SkillInterface() { visualizer->clearBuffer(); }

const std::string name;

virtual Status run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class PlannerBase
{
}

virtual ~PlannerBase() { visualizer->clearBuffer(); }

crane_msgs::srv::RobotSelect::Response doRobotSelect(
const crane_msgs::srv::RobotSelect::Request::SharedPtr request,
const std::unordered_map<uint8_t, RobotRole> & prev_roles, PlannerContext & context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,12 @@ struct CraneVisualizerBuffer
if (layer == "") {
CraneVisualizerBuffer::buffer->message_buffer.svg_primitive_arrays.clear();
} else {
ranges::actions::remove_if(
CraneVisualizerBuffer::buffer->message_buffer.svg_primitive_arrays,
[&layer](const auto & layer_array) { return layer_array.layer == layer; });
for (auto & svg_layer : CraneVisualizerBuffer::buffer->message_buffer.svg_primitive_arrays |
ranges::views::filter([&](auto svg_primitive_array) {
return svg_primitive_array.layer == layer;
})) {
svg_layer.svg_primitives.clear();
}
}
}
}
Expand Down Expand Up @@ -633,6 +636,7 @@ struct CraneVisualizerBuffer

void clearBuffer()
{
clear();
if (CraneVisualizerBuffer::active()) {
CraneVisualizerBuffer::clear(layer);
}
Expand Down

0 comments on commit fa8f453

Please sign in to comment.