7 const std::string topic_type) :
8 topic_name_(topic_name),
9 topic_type_(topic_type)
19 display_ = std::make_shared<QLabel>();
32 display_ = std::make_shared<QLCDNumber>();
33 std::static_pointer_cast<QLCDNumber>(
display_)->setFrameShape(QFrame::Shape::NoFrame);
38 display_ = std::make_shared<QLabel>(
"Unsupported topic type");
42 if (topic_type ==
"std_msgs/Bool")
44 else if (topic_type ==
"std_msgs/Duration")
46 else if (topic_type ==
"std_msgs/Float32")
48 else if (topic_type ==
"std_msgs/Float64")
50 else if (topic_type ==
"std_msgs/Int8")
52 else if (topic_type ==
"std_msgs/Int16")
54 else if (topic_type ==
"std_msgs/Int32")
56 else if (topic_type ==
"std_msgs/Int64")
58 else if (topic_type ==
"std_msgs/String")
60 else if (topic_type ==
"std_msgs/Time")
62 else if (topic_type ==
"std_msgs/UInt8")
64 else if (topic_type ==
"std_msgs/UInt16")
66 else if (topic_type ==
"std_msgs/UInt32")
68 else if (topic_type ==
"std_msgs/UInt64")
88 std::shared_ptr<QLCDNumber> lcd(std::dynamic_pointer_cast<QLCDNumber>(
display_));
93 lcd->setDigitCount(5);
94 else if (number < 10000)
95 lcd->setDigitCount(7);
96 else if (number < 1000000)
97 lcd->setDigitCount(9);
98 else if (number < 100000000)
99 lcd->setDigitCount(11);
101 lcd->setDigitCount(20);
107 QString label(
"False");
111 std::static_pointer_cast<QLabel>(
display_)->setText(label);
117 QString label(QString::number(msg->data.sec));
118 label.append(
" sec, ");
119 label.append(QString::number(msg->data.nsec));
120 label.append(
" nsec");
122 std::static_pointer_cast<QLabel>(
display_)->setText(label);
128 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
130 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
136 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
138 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
144 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
146 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
152 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
154 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
160 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
162 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
168 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
170 int32_t casted(msg->data);
171 std::static_pointer_cast<QLCDNumber>(
display_)->display(casted);
177 std::static_pointer_cast<QLabel>(
display_)->setText(QString::fromStdString(msg->data));
184 time.setMSecsSinceEpoch(msg->data.sec * 1e3 + msg->data.nsec / 1e6);
185 std::static_pointer_cast<QLabel>(
display_)->setText(time.toString(Qt::DateFormat::ISODate));
192 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
199 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
205 uint16_t casted(msg->data);
207 std::static_pointer_cast<QLCDNumber>(
display_)->display(casted);
213 uint16_t casted(msg->data);
215 std::static_pointer_cast<QLCDNumber>(
display_)->display(casted);
void uint64Callback(const std_msgs::UInt64ConstPtr &msg)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void int8Callback(const std_msgs::Int8ConstPtr &msg)
void adjustLCDNumberOfDigitsHandler(const long unsigned number)
const std::string topic_type_
void float32Callback(const std_msgs::Float32ConstPtr &msg)
void durationCallback(const std_msgs::DurationConstPtr &msg)
void stringCallback(const std_msgs::StringConstPtr &msg)
void float64Callback(const std_msgs::Float64ConstPtr &msg)
const std::string topic_name_
void timeCallback(const std_msgs::TimeConstPtr &msg)
std::shared_ptr< QLabel > label_
void int16Callback(const std_msgs::Int16ConstPtr &msg)
std::shared_ptr< QWidget > display_
void uint8Callback(const std_msgs::UInt8ConstPtr &msg)
#define ROS_ERROR_STREAM(args)
TopicInfo(const std::string topic_name, const std::string topic_type)
void uint32Callback(const std_msgs::UInt32ConstPtr &msg)
void int64Callback(const std_msgs::Int64ConstPtr &msg)
void int32Callback(const std_msgs::Int32ConstPtr &msg)
void uint16Callback(const std_msgs::UInt16ConstPtr &msg)
void adjustLCDNumberOfDigits(const long unsigned number)
void boolCallback(const std_msgs::BoolConstPtr &msg)