Remote debugging ROS2 nodes

asked 2021-06-08 10:18:25 -0500

definitive gravatar image

I am not able to "inject" launched nodes within IDE to remote server. I'm running some 3rd party launch files on ssh server and debug my sample code within IDE (remote gdb). Here is my sample code using executor with marked breakpoint:

int main(int argc, char** argv)
    rclcpp::init(argc, argv);
    rclcpp::NodeOptions node_options;
    auto test_node = rclcpp::Node::make_shared("test_node", node_options);

    rclcpp::executors::SingleThreadedExecutor executor;
    std::thread([&executor]() { executor.spin(); }).detach();

>>  rclcpp::shutdown();
    return 0;

On my server side, node wouldn't appear. It's same with rclcpp::spin_some and rclcpp::spin. As I noticed, in ROS2 there is something like a daemon. With stopping and starting daemon every single time before I launch my sample code with rclcpp::spin implementation, it inject node to my server (it is visible). Unfortunately, as you know with spin it's impossible to debug nodes. So how to do it without spin? Probably I couldn't understand executor properly. I proved that nodes may be visible on my server by restarting daemon but how to do it properly with debugging possibility?

edit retag flag offensive close merge delete