From 5fea49cdb7fce8b1da3fd98ddc66bce2349b963b Mon Sep 17 00:00:00 2001 From: acki Date: Thu, 15 May 2025 19:56:32 -0400 Subject: [PATCH] convention --- src/modelec_com/src/pcb_action_interface.cpp | 32 ++++++++++---------- src/modelec_strat/src/action_executor.cpp | 5 +++ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/modelec_com/src/pcb_action_interface.cpp b/src/modelec_com/src/pcb_action_interface.cpp index cbf3442..aad93ec 100644 --- a/src/modelec_com/src/pcb_action_interface.cpp +++ b/src/modelec_com/src/pcb_action_interface.cpp @@ -75,42 +75,42 @@ namespace Modelec } asc_get_sub_ = this->create_subscription( - "action/asc/get", 10, + "action/get/asc", 10, [this](const modelec_interfaces::msg::ActionAscPos::SharedPtr) { GetData("ASC", {"POS"}); }); servo_get_sub_ = this->create_subscription( - "action/servo/get", 10, + "action/get/servo", 10, [this](const modelec_interfaces::msg::ActionServoPos::SharedPtr msg) { GetData("SERVO" + std::to_string(msg->id), {"POS"}); }); relay_get_sub_ = this->create_subscription( - "action/relay/get", 10, + "action/get/relay", 10, [this](const modelec_interfaces::msg::ActionRelayState::SharedPtr msg) { GetData("RELAY" + std::to_string(msg->id), {"STATE"}); }); asc_get_res_pub_ = this->create_publisher( - "action/asc/get/res", 10); + "action/get/asc/res", 10); servo_get_res_pub_ = this->create_publisher( - "action/servo/get/res", 10); + "action/get/servo/res", 10); relay_get_res_pub_ = this->create_publisher( - "action/relay/get/res", 10); + "action/get/relay/res", 10); asc_set_sub_ = this->create_subscription( - "action/asc/set", 10, + "action/set/asc", 10, [this](const modelec_interfaces::msg::ActionAscPos::SharedPtr msg) { SendOrder("ASC", {std::to_string(msg->pos), std::to_string(msg->value)}); }); servo_set_sub_ = this->create_subscription( - "action/servo/set", 10, + "action/set/servo", 10, [this](const modelec_interfaces::msg::ActionServoPos::SharedPtr msg) { SendOrder("SERVO" + std::to_string(msg->id), { @@ -119,40 +119,40 @@ namespace Modelec }); asc_set_res_pub_ = this->create_publisher( - "action/asc/set/res", 10); + "action/set/asc/res", 10); servo_set_res_pub_ = this->create_publisher( - "action/servo/set/res", 10); + "action/set/servo/res", 10); asc_move_sub_ = this->create_subscription( - "action/asc/move", 10, + "action/move/asc", 10, [this](const modelec_interfaces::msg::ActionAscPos::SharedPtr msg) { SendMove("ASC", {std::to_string(msg->pos)}); }); servo_move_sub_ = this->create_subscription( - "action/servo/move", 10, + "action/move/servo", 10, [this](const modelec_interfaces::msg::ActionServoPos::SharedPtr msg) { SendMove("SERVO" + std::to_string(msg->id), {"POS" + std::to_string(msg->pos)}); }); relay_move_sub_ = this->create_subscription( - "action/relay/move", 10, + "action/move/relay", 10, [this](const modelec_interfaces::msg::ActionRelayState::SharedPtr msg) { SendMove("RELAY" + std::to_string(msg->id), {std::to_string(msg->state)}); }); asc_move_res_pub_ = this->create_publisher( - "action/asc/move/res", 10); + "action/mode/asc/res", 10); servo_move_res_pub_ = this->create_publisher( - "action/servo/move/res", 10); + "action/move/servo/res", 10); relay_move_res_pub_ = this->create_publisher( - "action/relay/move/res", 10); + "action/move/relay/res", 10); } PCBActionInterface::~PCBActionInterface() diff --git a/src/modelec_strat/src/action_executor.cpp b/src/modelec_strat/src/action_executor.cpp index a79c479..14177e9 100644 --- a/src/modelec_strat/src/action_executor.cpp +++ b/src/modelec_strat/src/action_executor.cpp @@ -78,8 +78,11 @@ namespace Modelec void ActionExecutor::Update() { + RCLCPP_INFO(node_->get_logger(), "ActionExecutor::Update()"); if (step_.empty()) { + RCLCPP_INFO(node_->get_logger(), "action finished"); + action_ = NONE; action_done_ = true; return; @@ -87,6 +90,8 @@ namespace Modelec if (step_running_ == 0) { + RCLCPP_INFO(node_->get_logger(), "Running new action"); + step_.pop(); switch (step_.front())