ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to display a stream of terminal messages on a web GUI using roslibjs?

asked 2020-09-08 08:53:28 -0500

Py gravatar image

I'm putting together a web GUI using roslibjs and would like to display the stream of terminal messages. I understand I can subscribe to these messages on the /rosout topic but can someone provide a minimal working example of how to display these in the webpage?

Currently in my HTML I have:

<p>Terminal Message: {{ terminalMessage }}</p>

However, this is not picking up the terminal message from the Vue app in my main.js file. This is confusing because I have other data that can be binded in this way.

edit retag flag offensive close merge delete

Comments

Do you mean the console (using the debug option within the browser?) or the actual terminal running on the server side (where the roscore is?)

biaspoint gravatar image biaspoint  ( 2021-05-05 10:14:09 -0500 )edit

I meant the server side where roscore is.

Py gravatar image Py  ( 2021-05-07 06:17:12 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-05-07 06:18:25 -0500

Py gravatar image

I got a bit further with this and the following html code worked:

<div id="terminal_log" class="container tab-pane active"><br>
    <div class="overflow-auto">
        <ul class="list-inline">
            <li class="list-inline-item" v-for="x in terminalMessages">{{ x.line }}</li>
         </ul>
     </div>
 </div>

where terminalMessages is subscribed to in javascript with:

getTerminalMessages: function (){
    let terminalMessageTopic = new ROSLIB.Topic({
        ros: this.ros,
        name: '/rosout_agg',
        messageType: 'rosgraph_msgs/Log'
    })
    terminalMessageTopic.subscribe((message) => {
        this.terminalMessages.push({line: message.msg});
    })
}
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-09-08 08:53:28 -0500

Seen: 374 times

Last updated: May 07 '21