diff --git a/simulated_pcb/action.py b/simulated_pcb/action.py index 39b93b4..29bad6d 100644 --- a/simulated_pcb/action.py +++ b/simulated_pcb/action.py @@ -133,7 +133,7 @@ if __name__ == '__main__': sim.stop() print("Simulation stopped") -# socat -d -d pty,raw,echo=0,link=/tmp/MARCEL_ACTION_SIM pty,raw,echo=0,link=/tmp/MARCEL_ACTION -# python3 simulated_pcb/action.py --port /tmp/MARCEL_ACTION_SIM -# socat -d -d pty,raw,echo=0,link=/tmp/ENEMY_ACTION_SIM pty,raw,echo=0,link=/tmp/ENEMY_ACTION -# python3 simulated_pcb/action.py --port /tmp/ENEMY_ACTION_SIM \ No newline at end of file +# socat -d -d pty,raw,echo=0,link=/tmp/ACTION_SIM pty,raw,echo=0,link=/tmp/ACTION_USB +# python3 simulated_pcb/action.py --port /tmp/ACTION_SIM +# socat -d -d pty,raw,echo=0,link=/tmp/ODO_SIM pty,raw,echo=0,link=/tmp/ODO_USB +# python3 simulated_pcb/action.py --port /tmp/ODO_SIM diff --git a/src/modelec_com/include/modelec_com/pcb_odo_interface.new.hpp b/src/modelec_com/include/modelec_com/pcb_odo_interface.new.hpp index a0d8893..8e496c8 100644 --- a/src/modelec_com/include/modelec_com/pcb_odo_interface.new.hpp +++ b/src/modelec_com/include/modelec_com/pcb_odo_interface.new.hpp @@ -37,9 +37,6 @@ namespace Modelec public: PCBOdoInterface(); - rclcpp::CallbackGroup::SharedPtr pcb_callback_group_; - std::shared_ptr pcb_executor_; - std::thread pcb_executor_thread_; ~PCBOdoInterface() override; struct OdometryData @@ -57,9 +54,6 @@ namespace Modelec }; private: - rclcpp::Publisher::SharedPtr pcb_publisher_; - rclcpp::Subscription::SharedPtr pcb_subscriber_; - void read(const std::string& msg) override; rclcpp::Publisher::SharedPtr odo_pos_publisher_; diff --git a/src/modelec_com/src/pcb_odo_interface.new.cpp b/src/modelec_com/src/pcb_odo_interface.new.cpp index 4c0f792..451cf95 100644 --- a/src/modelec_com/src/pcb_odo_interface.new.cpp +++ b/src/modelec_com/src/pcb_odo_interface.new.cpp @@ -153,20 +153,11 @@ namespace Modelec PCBOdoInterface::~PCBOdoInterface() { SetStart(false); - - if (pcb_executor_) - { - pcb_executor_->cancel(); - } - if (pcb_executor_thread_.joinable()) - { - pcb_executor_thread_.join(); - } } void PCBOdoInterface::read(const std::string& msg) { - RCLCPP_INFO(this->get_logger(), "Received from PCB: %s", msg.c_str()); + RCLCPP_DEBUG(this->get_logger(), "Received from PCB: %s", msg.c_str()); std::vector tokens = split(trim(msg), ';'); if (tokens.size() < 2) { @@ -300,12 +291,10 @@ namespace Modelec void PCBOdoInterface::SendToPCB(const std::string& data) { - if (pcb_publisher_) + if (IsOk()) { RCLCPP_DEBUG(this->get_logger(), "Sending to PCB: %s", data.c_str()); - auto message = std_msgs::msg::String(); - message.data = data; - pcb_publisher_->publish(message); + this->write(data); } } diff --git a/src/modelec_core/launch/modelec.launch.py b/src/modelec_core/launch/modelec.launch.py index feaee78..8022516 100644 --- a/src/modelec_core/launch/modelec.launch.py +++ b/src/modelec_core/launch/modelec.launch.py @@ -109,7 +109,7 @@ def generate_launch_description(): executable='pcb_action_interface', name='pcb_action_interface', parameters=[{ - 'serial_port': "/tmp/USB_ACTION", + 'serial_port': "/dev/USB_ACTION", 'baudrate': 115200, 'name': "pcb_action", }]