Skip to content

Commit a30bc17

Browse files
committed
bug fix
1 parent e73a495 commit a30bc17

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

tools/reaction_analyzer/src/reaction_analyzer_node.cpp

+2-14
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ void ReactionAnalyzerNode::loadChainModules()
9191
{
9292
const auto param_key = std::string("chain");
9393
const auto module_names = this->list_parameters({param_key}, 3).prefixes;
94-
// std::cout << module_names.size() << std::endl;
9594
for (const auto & module_name : module_names) {
9695
const auto splitted_name = split(module_name, '.');
9796
TopicConfig tmp;
@@ -300,7 +299,6 @@ void ReactionAnalyzerNode::onTimer()
300299
all_topics_reacted_ = false;
301300
const auto brake_start_idx = findFirstBrakeIdx(message->first);
302301
if (brake_start_idx) {
303-
// std::cout << "found brake idx" <<std::endl;
304302
mutex_.lock();
305303
auto * tmp = std::get_if<ControlBuffer>(&messageBuffers_[key]);
306304
if (tmp) tmp->second = message->first.at(brake_start_idx.value());
@@ -444,14 +442,11 @@ void ReactionAnalyzerNode::controlCommandOutputCallback(
444442
{
445443
std::lock_guard<std::mutex> lock(mutex_);
446444
auto & variant = messageBuffers_[node_name];
447-
if (std::holds_alternative<ControlBuffer>(variant)) {
448-
std::get<ControlBuffer>(variant).first.push_back(*msg_ptr);
449-
} else {
445+
if (!std::holds_alternative<ControlBuffer>(variant)) {
450446
// If the variant doesn't hold a vector of AckermannControlCommand yet, initialize it
451447
ControlBuffer buffer(std::vector<AckermannControlCommand>{*msg_ptr}, std::nullopt);
452448
variant = buffer;
453449
}
454-
// std::cout << node_name << std::endl;
455450
setControlCommandToBuffer(std::get<ControlBuffer>(variant).first, *msg_ptr);
456451
}
457452

@@ -520,18 +515,12 @@ void ReactionAnalyzerNode::setControlCommandToBuffer(
520515
itr++;
521516
}
522517
}
523-
// std::cout << "buffer size: " << buffer.size() << std::endl;
524518
buffer.emplace_back(cmd);
525519
}
526520

527521
std::optional<size_t> ReactionAnalyzerNode::findFirstBrakeIdx(
528522
const std::vector<AckermannControlCommand> & cmd_array)
529523
{
530-
// for (size_t k = 0; k < cmd_array.size(); ++k) {
531-
// std::cout << cmd_array.at(k).longitudinal.acceleration << " ";
532-
// }
533-
// std::cout << std::endl;
534-
535524
if (
536525
cmd_array.size() < static_cast<size_t>(node_params_.min_number_descending_order_control_cmd) ||
537526
!spawn_cmd_time)
@@ -543,8 +532,7 @@ std::optional<size_t> ReactionAnalyzerNode::findFirstBrakeIdx(
543532
cmd_array.at(cmd_array.size() - node_params_.min_number_descending_order_control_cmd).stamp) <
544533
spawn_cmd_time)
545534
return {};
546-
std::cout << "searching " << std::endl;
547-
// find the place that acc cmd decreases continuously
535+
548536
for (size_t i = 0;
549537
i < cmd_array.size() - node_params_.min_number_descending_order_control_cmd + 1; ++i) {
550538
size_t decreased_cmd_counter = 1; // because # of the decreased cmd = iteration + 1

0 commit comments

Comments
 (0)