Skip to content

Commit 7b96586

Browse files
committed
Add more debugging output
- Add Stage::introspection() accessor - Introspection: debug-log solution registration - RemoteSolutionModel: show internal solution id as tooltip in 1st column
1 parent 08b102d commit 7b96586

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

core/include/moveit/task_constructor/stage.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ class Stage
184184
void setName(const std::string& name);
185185

186186
uint32_t introspectionId() const;
187+
Introspection* introspection() const;
187188

188189
/** set computation timeout (in seconds)
189190
*

core/src/introspection.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ bool isValidCharInName(char c); // unfortunately this is not declared in ros/na
5555
} // namespace names
5656
} // namespace ros
5757

58+
static const char* LOGGER = "introspection";
59+
5860
namespace moveit {
5961
namespace task_constructor {
6062

@@ -206,6 +208,9 @@ uint32_t Introspection::stageId(const Stage* const s) const {
206208

207209
uint32_t Introspection::solutionId(const SolutionBase& s) {
208210
auto result = impl->id_solution_bimap_.left.insert(std::make_pair(1 + impl->id_solution_bimap_.size(), &s));
211+
if (result.second) // new entry
212+
ROS_DEBUG_STREAM_NAMED(LOGGER, "new solution #" << result.first->first << " (" << s.creator()->name()
213+
<< "): " << s.cost() << " " << s.comment());
209214
return result.first->first;
210215
}
211216

core/src/stage.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ uint32_t Stage::introspectionId() const {
381381
throw std::runtime_error("Task is not initialized yet or Introspection was disabled.");
382382
return const_cast<const moveit::task_constructor::Introspection*>(pimpl_->introspection_)->stageId(this);
383383
}
384+
Introspection* Stage::introspection() const {
385+
return pimpl_->introspection_;
386+
}
384387

385388
void Stage::forwardProperties(const InterfaceState& source, InterfaceState& dest) {
386389
const PropertyMap& src = source.properties();

core/test/stage_mockups.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ void ConnectMockup::compute(const InterfaceState& from, const InterfaceState& to
9999

100100
auto solution{ std::make_shared<SubTrajectory>() };
101101
solution->setCost(costs_.cost());
102+
solution->setComment(std::to_string(from.priority().cost()) + " -> " + std::to_string(to.priority().cost()));
102103
connect(from, to, solution);
103104
}
104105

visualization/motion_planning_tasks/src/remote_task_model.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,15 @@ QVariant RemoteSolutionModel::data(const QModelIndex& index, int role) const {
501501
return item.id;
502502

503503
case Qt::ToolTipRole:
504-
return item.comment;
504+
switch (index.column()) {
505+
#if 1 // show internal solution id in first column return item
506+
case 0:
507+
return item.id;
508+
default:
509+
return item.comment;
510+
#endif
511+
}
512+
break;
505513

506514
case Qt::DisplayRole:
507515
switch (index.column()) {

0 commit comments

Comments
 (0)