We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stateDiagram-v2 Callback --> UpdateLatestState Timer --> ReadLatestState ReadLatestState --> transform transform --> publish
Read a latest state, need to know if it has been updated since you read.
/// in header rsl::Observer<std_msgs::msg::Int8> status_; /// in initalizer_list Foo::Foo() : status_{ node_, // rclcpp::Node "topic name", // std::string std_msgs::msg::Int8{ .val = 0; }, // initial value QoS, // Optional QoS param } {} /// in timer or thread loop auto latest_status = status_.get();
template<typename MessageT> class Observer { std::atomic<MessageT> msg_; std::shared_ptr<rclcpp::Subscription<MessageT>> subscription_; public: auto get() { return msg_.load(); } operator MessageT() { return get(); } Observer(std::shared_ptr<rclcpp::Node> node, std::string const& topic, MessageT initial_value, rclcpp::QoS qos = rclcpp::DefaultQoS()); }; template<typename MessageT> Observer::Observer( std::shared_ptr<const rclcpp::Node> const& node, std::string const& topic, MessageT const& initial_value, rclcpp::QoS qos = rclcpp::SystemDefaultsQoS()) : msg_{initial_value} , subscription_{ node->create_subscription<MessageT>( topic, [this](auto msg) { msg_ = msg; }, qos) } { assert(subscription_); }
TODO:
The text was updated successfully, but these errors were encountered:
See https://github.com/PickNikRobotics/RSL/commits/observer. CI is failing due to Asan violation in rclcpp code.
Sorry, something went wrong.
No branches or pull requests
Use cases
Read a latest state, need to know if it has been updated since you read.
TODO:
The text was updated successfully, but these errors were encountered: