0
$\begingroup$

Rosanswers logo

According to the roslibjs documentation, we should be able to get the data back from the robot by using a listener:

// Publish the Topic
var cmdVel = new ROSLIB.Topic({
    ros: ros,
    name: '/turtle1/cmd_vel',
    messageType: 'geometry_msgs/Twist'
});

// Subscribe to the Topic
var listener = new ROSLIB.Topic({
    ros: ros,
    name: '/listener',
    messageType: 'std_msgs/String'
});

listener.subscribe(function (message) {
    console.log("Recieved Message on: " + listener.name + ": " + message.data);
});

However, when I tried to use this, there was a compilation error that said property 'data does not exist on type 'message'.

I really need to get the turtle-robot data back to my web browser, any help with this matter would be highly appreciated.

Many thanks!


Originally posted by nerdyTurtle on ROS Answers with karma: 18 on 2016-11-17

Post score: 0


Original comments

Comment by gvdhoorn on 2016-11-18:
Could you please use the Preformatted Text button next time when copy-pasting console text, source code, etc? It's the one with 101010 on it. That will make things much easier to read.

Thanks.

Comment by nerdyTurtle on 2016-11-28:
@gvdhoorn will do!

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I was using Typescript, so I had to do add the following to the Typings file:

data:{
    ros: Ros,
    name: string,
    serviceType: string
}

Originally posted by nerdyTurtle with karma: 18 on 2016-11-29

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.