mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-26 11:43:25 +00:00
Show number of messages received in topic viewer
This commit is contained in:
@@ -40,6 +40,7 @@ function viewTopicsList() {
|
||||
let rosdistro;
|
||||
|
||||
function viewTopic(topic) {
|
||||
let counter = 0;
|
||||
let index = '<a href=topics.html>Topics</a>';
|
||||
title.innerHTML = `${index}: ${topic}`;
|
||||
topicMessage.style.display = 'block';
|
||||
@@ -51,6 +52,7 @@ function viewTopic(topic) {
|
||||
});
|
||||
|
||||
new ROSLIB.Topic({ ros: ros, name: topic }).subscribe(function(msg) {
|
||||
counter++;
|
||||
document.title = topic;
|
||||
if (mouseDown) return;
|
||||
|
||||
@@ -62,7 +64,8 @@ function viewTopic(topic) {
|
||||
}
|
||||
}
|
||||
|
||||
topicMessage.innerHTML = yamlStringify(msg); // JSON.stringify(msg, null, 4);
|
||||
let txt = `<div class=counter>${counter} received</div>${yamlStringify(msg)}`; // JSON.stringify(msg, null, 4);
|
||||
topicMessage.innerHTML = txt;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
white-space: pre;
|
||||
font-family: monospace;
|
||||
}
|
||||
.counter { color: #b9b9b9; margin-bottom: 1em; }
|
||||
#topic-type { font-family: monospace; font-size: 0.5em; vertical-align: super; font-weight: normal; }
|
||||
.topic { font-family: monospace; }
|
||||
body.closed { background-color: rgb(207, 207, 207); }
|
||||
|
||||
Reference in New Issue
Block a user