7 const std::string topic_type,
9 topic_name_(topic_name),
10 topic_type_(topic_type),
11 refresh_duration_(refresh_duration)
24 display_ = std::make_shared<QLabel>();
37 display_ = std::make_shared<QLCDNumber>();
38 std::static_pointer_cast<QLCDNumber>(
display_)->setFrameShape(QFrame::Shape::NoFrame);
43 display_ = std::make_shared<QLabel>(
"Unsupported topic type");
47 if (topic_type ==
"std_msgs/Bool")
49 else if (topic_type ==
"std_msgs/Duration")
51 else if (topic_type ==
"std_msgs/Float32")
53 else if (topic_type ==
"std_msgs/Float64")
55 else if (topic_type ==
"std_msgs/Int8")
57 else if (topic_type ==
"std_msgs/Int16")
59 else if (topic_type ==
"std_msgs/Int32")
61 else if (topic_type ==
"std_msgs/Int64")
63 else if (topic_type ==
"std_msgs/String")
65 else if (topic_type ==
"std_msgs/Time")
67 else if (topic_type ==
"std_msgs/UInt8")
69 else if (topic_type ==
"std_msgs/UInt16")
71 else if (topic_type ==
"std_msgs/UInt32")
73 else if (topic_type ==
"std_msgs/UInt64")
122 std::shared_ptr<QLCDNumber> lcd(std::dynamic_pointer_cast<QLCDNumber>(
display_));
127 lcd->setDigitCount(5);
128 else if (number < 10000)
129 lcd->setDigitCount(7);
130 else if (number < 1000000)
131 lcd->setDigitCount(9);
132 else if (number < 100000000)
133 lcd->setDigitCount(11);
135 lcd->setDigitCount(20);
144 QString label(
"False");
148 std::static_pointer_cast<QLabel>(
display_)->setText(label);
158 t = t.addSecs(msg->data.sec);
159 t = t.addMSecs(msg->data.nsec / 1e6);
160 std::static_pointer_cast<QLabel>(
display_)->setText(t.toString(
"hh:mm:ss:zzz"));
169 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
171 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
180 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
182 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
191 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
193 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
202 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
204 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
213 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
215 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
224 long unsigned digits_counting(msg->data > 0 ? msg->data : -msg->data);
226 int32_t casted(msg->data);
227 std::static_pointer_cast<QLCDNumber>(
display_)->display(casted);
236 std::static_pointer_cast<QLabel>(
display_)->setText(QString::fromStdString(msg->data));
246 time.setMSecsSinceEpoch(msg->data.sec * 1e3 + msg->data.nsec / 1e6);
247 std::static_pointer_cast<QLabel>(
display_)->setText(time.toString(Qt::DateFormat::ISODate));
257 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
267 std::static_pointer_cast<QLCDNumber>(
display_)->display(msg->data);
276 uint16_t casted(msg->data);
278 std::static_pointer_cast<QLCDNumber>(
display_)->display(casted);
287 uint16_t casted(msg->data);
289 std::static_pointer_cast<QLCDNumber>(
display_)->display(casted);
void setMaximumRefreshRate(const ros::Duration d)
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)
TopicInfo(const std::string topic_name, const std::string topic_type, const ros::Duration refresh_duration=ros::Duration(0))
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)
ros::Duration refresh_duration_
geometry_msgs::TransformStamped t
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_
ros::Duration maximumRefreshRate()
void int16Callback(const std_msgs::Int16ConstPtr &msg)
std::shared_ptr< QWidget > display_
void uint8Callback(const std_msgs::UInt8ConstPtr &msg)
#define ROS_ERROR_STREAM(args)
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)