Skip to content

Commit a605ee5

Browse files
fix(rtbot): Fixing for the case of a message generator.
Like in the case of including a resampler inside the Pipeline
1 parent 1e39033 commit a605ee5

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

libs/core/include/rtbot/Pipeline.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class Pipeline : public Operator {
129129
entry_operator_->execute();
130130
input_queue.pop_front();
131131
// Process output mappings
132-
bool has_output = false;
132+
bool was_reseted = false;
133133
for (const auto& [op_id, mappings] : output_mappings_) {
134134
auto it = operators_.find(op_id);
135135
if (it != operators_.end()) {
@@ -139,19 +139,26 @@ class Pipeline : public Operator {
139139
const auto& source_queue = op->get_output_queue(operator_port);
140140
// Only forward if source operator has produced output on the mapped port
141141
if (!source_queue.empty()) {
142-
has_output = true;
142+
was_reseted = false;
143143
auto& target_queue = get_output_queue(pipeline_port);
144144
for (const auto& msg : source_queue) {
145145
RTBOT_LOG_DEBUG("Forwarding message ", msg->to_string(), " from ", op_id, " -> ", pipeline_port);
146146
target_queue.push_back(msg->clone());
147+
reset();
148+
was_reseted = true;
149+
break;
147150
}
148151
}
149152
}
153+
if (was_reseted) {
154+
break;
155+
}
150156
}
151157
}
158+
if (was_reseted) {
159+
break;
160+
}
152161
}
153-
// if source operator has produced output on the mapped port then reset the pipeline
154-
if (has_output) reset();
155162
}
156163
}
157164
}

0 commit comments

Comments
 (0)