15#ifndef AWVIZ_COMMON__DISPLAY_HPP_
16#define AWVIZ_COMMON__DISPLAY_HPP_
20#include <rclcpp/qos.hpp>
21#include <rclcpp/rclcpp.hpp>
23#include <rosidl_runtime_cpp/traits.hpp>
27#include <unordered_map>
47 rclcpp::Node::SharedPtr node, std::shared_ptr<rerun::RecordingStream> stream) = 0;
55 const std::string & topic,
56 const std::shared_ptr<std::unordered_map<std::string, std::string>> entity_roots) = 0;
66 virtual void end() = 0;
76 std::shared_ptr<rerun::RecordingStream>
stream_;
83template <
typename MsgType>
92 const auto msg_type = rosidl_generator_traits::name<MsgType>();
107 rclcpp::Node::SharedPtr node, std::shared_ptr<rerun::RecordingStream> stream)
override
120 const std::string & topic,
121 const std::shared_ptr<std::unordered_map<std::string, std::string>> entity_roots)
override
155 [
this](
const typename MsgType::ConstSharedPtr msg) {
log_message(msg); });
168 virtual void log_message(
typename MsgType::ConstSharedPtr msg) = 0;
Intermediate class for display items.
Definition: display.hpp:35
virtual void start()=0
Start to display.
virtual void end()=0
End to display.
virtual bool is_initialized() const
Return true if the initialization is completed.
Definition: display.hpp:72
virtual void initialize(rclcpp::Node::SharedPtr node, std::shared_ptr< rerun::RecordingStream > stream)=0
Initialize attributes.
rclcpp::Node::SharedPtr node_
Node shared pointer.
Definition: display.hpp:75
bool is_initialized_
Whether the object has been initialized.
Definition: display.hpp:77
virtual ~Display()=default
std::shared_ptr< rerun::RecordingStream > stream_
RecordingStream shared pointer.
Definition: display.hpp:76
virtual void set_property(const std::string &topic, const std::shared_ptr< std::unordered_map< std::string, std::string > > entity_roots)=0
Set attributes of property.
Inherited plugin class to display ROS topics.
Definition: display.hpp:85
static constexpr const char * TIMELINE_NAME
Entity name of timeline record.
Definition: display.hpp:140
virtual void subscribe()
Start to subscribing the specified topic.
Definition: display.hpp:146
void set_property(const std::string &topic, const std::shared_ptr< std::unordered_map< std::string, std::string > > entity_roots) override
Set status of attributes.
Definition: display.hpp:119
rclcpp::Subscription< MsgType >::SharedPtr subscription_
Subscription of the topic.
Definition: display.hpp:171
void initialize(rclcpp::Node::SharedPtr node, std::shared_ptr< rerun::RecordingStream > stream) override
Initialize the instance specifying the root ROS node and recording stream.
Definition: display.hpp:106
RosTopicDisplay()
Construct an instance.
Definition: display.hpp:90
~RosTopicDisplay() override
Destruct an instance.
Definition: display.hpp:99
virtual void unsubscribe()
End to subscribing the topic.
Definition: display.hpp:161
void end() override
End to display.
Definition: display.hpp:135
virtual void log_message(typename MsgType::ConstSharedPtr msg)=0
Log subscribed ROS message to recording stream.
bool is_initialized() const override
Return true if the initialization is completed.
Definition: display.hpp:137
void start() override
Start to display.
Definition: display.hpp:130
RosTopicProperty property_
Topic property.
Definition: display.hpp:172
Struct representing a property of ROS msg display instance.
Definition: property.hpp:29
const std::string & topic() const noexcept
Get ROS topic name.
Definition: property.hpp:78
void set_entity_roots(const std::shared_ptr< std::unordered_map< std::string, std::string > > entity_roots)
Set entity path of record.
Definition: property.hpp:62
void set_type(const std::string &type)
Set ROS message type name.
Definition: property.hpp:50
bool is_initialized() const
Definition: property.hpp:118
void set_topic(const std::string &topic)
Set ROS topic name.
Definition: property.hpp:56
Definition: display.hpp:30