Skip to content

Commit d031f1b

Browse files
committed
send a single reset message when introspection is enabled
My previous patches accidentally disabled *all* (3) reset messages, instead of keeping exactly one. This patch sends exactly one empty description (reset) message every time an introspection instance is constructed for a task. Notice the additional increase of the description queue_size from 1 to 2 to avoid directly dropping the reset message in favor of the new description likely to be send shortly afterwards.
1 parent e8324ab commit d031f1b

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

core/src/introspection.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,26 @@ class IntrospectionPrivate
6666
: nh_(std::string("~/") + task->id()) // topics + services are advertised in private namespace
6767
, task_(task)
6868
, process_id_(getProcessId()) {
69-
resetMaps();
7069
task_description_publisher_ =
71-
nh_.advertise<moveit_task_constructor_msgs::TaskDescription>(DESCRIPTION_TOPIC, 1, true);
70+
nh_.advertise<moveit_task_constructor_msgs::TaskDescription>(DESCRIPTION_TOPIC, 2, true);
71+
// send reset message as early as possible to give subscribers time to see it
72+
indicateReset();
73+
7274
task_statistics_publisher_ =
7375
nh_.advertise<moveit_task_constructor_msgs::TaskStatistics>(STATISTICS_TOPIC, 1, true);
7476
solution_publisher_ = nh_.advertise<moveit_task_constructor_msgs::Solution>(SOLUTION_TOPIC, 1, true);
77+
78+
resetMaps();
79+
}
80+
81+
void indicateReset() {
82+
// send empty task description message to indicate reset
83+
::moveit_task_constructor_msgs::TaskDescription msg;
84+
msg.process_id = process_id_;
85+
msg.id = task_->id();
86+
task_description_publisher_.publish(msg);
7587
}
88+
7689
void resetMaps() {
7790
// reset maps
7891
stage_to_id_map_.clear();
@@ -118,12 +131,7 @@ void Introspection::publishTaskState() {
118131
}
119132

120133
void Introspection::reset() {
121-
// send empty task description message to indicate reset
122-
::moveit_task_constructor_msgs::TaskDescription msg;
123-
msg.process_id = impl->process_id_;
124-
msg.id = impl->task_->id();
125-
impl->task_description_publisher_.publish(msg);
126-
134+
impl->indicateReset();
127135
impl->resetMaps();
128136
}
129137

0 commit comments

Comments
 (0)