private:// 定时器回调函数,用于发布消息voidtimer_callback(){automessage =std::make_shared<std_msgs::msg::String>();message->data ="Hello from Component!";publisher_->publish(*message);// 发布消息} // 成员变量:...
( std::chrono::seconds(1), [this]() { this->timer_callback(); }); } private: // 定时器回调函数,用于发布消息 void timer_callback() { auto message = std::make_shared<std_msgs::msg::String>(); message->data = "Hello from Component!"; publisher_->publish(*message); // 发布...
Unable to start transition 7 from current state shuttingdown: Could not publish transition: publisher's context is invalid, at ./src/rcl/publisher.c:423, at ./src/rcl_lifecycle.c:368 Not sure if it is related to the publisher being invalid or not, but the node is clearly in the shutti...
fib_client_->wait_for_action_server(std::chrono::seconds(3))) { RCLCPP_ERROR_STREAM(get_logger(), "Timed out waiting for action server to be available"); return false; } auto options = rclcpp_action::Client<Fibonacci>::SendGoalOptions(); options.goal_response_callback = [](std::...