6#include "behaviortree_cpp/loggers/abstract_logger.h"
14 BT::Duration timestamp,
const BT::TreeNode & node, BT::NodeStatus prev_status,
15 BT::NodeStatus status)
override
19 (status == BT::NodeStatus::SUCCESS || status == BT::NodeStatus::RUNNING ||
20 status == BT::NodeStatus::IDLE) &&
21 (node.name() ==
"UpdateMode" || node.name() ==
"CheckSensorsStatus" ||
22 node.name() ==
"RetryUntilSuccessful")) {
27 double time_sec = std::chrono::duration<double>(timestamp).count();
30 const char * color_code = resetColor();
32 case BT::NodeStatus::SUCCESS:
33 color_code = greenColor();
35 case BT::NodeStatus::FAILURE:
36 color_code = redColor();
38 case BT::NodeStatus::RUNNING:
39 color_code = yellowColor();
41 case BT::NodeStatus::IDLE:
42 color_code = resetColor();
44 case BT::NodeStatus::SKIPPED:
45 color_code = cyanColor();
51 std::cout <<
"[" << std::fixed << std::setprecision(3) << time_sec <<
"s] " <<
"["
52 << node.name() <<
"]: " << toStr(prev_status) <<
" -> " << color_code << toStr(status)
53 << resetColor() << std::endl;
56 void flush()
override { std::cout << std::flush; }
60 const char * redColor() {
return "\033[31m"; }
61 const char * greenColor() {
return "\033[32m"; }
62 const char * yellowColor() {
return "\033[33m"; }
63 const char * cyanColor() {
return "\033[36m"; }
64 const char * resetColor() {
return "\033[0m"; }
Definition: filtered_logger.hpp:9
void callback(BT::Duration timestamp, const BT::TreeNode &node, BT::NodeStatus prev_status, BT::NodeStatus status) override
Definition: filtered_logger.hpp:13
FilteredStdCoutLogger(const BT::Tree &tree)
Definition: filtered_logger.hpp:11
void flush() override
Definition: filtered_logger.hpp:56