论坛里的一个老哥给出答案
https://discourse.ros.org/t/how-to-shutdown-and-reinitialize-a-publisher-node-in-ros-2/4090
就是我在初始化环境前先初始化了节点
auto node = std::make_shared<Static_tf_broadcaster>(argv); rclcpp::init(argc,argv); rclcpp::spin(node); rclcpp::shutdown();
改正
rclcpp::init(argc,argv); auto node = std::make_shared<Static_tf_broadcaster>(argv); rclcpp::spin(node); rclcpp::shutdown();
标签:node,what,throwing,RCLInvalidArgument,rclcpp,argv,报错,shutdown From: https://www.cnblogs.com/toriyung/p/18192514