Ask Your Question

how to subscribe float32 data

asked 2015-05-12 17:10:41 -0500

minerva gravatar image

Im trying to subscribe gazebo topics and see the datas on a webpage.

var cmdSonarTopic = new ROSLIB.Topic({
ros : ros,
name : '/gazebo/sensor/Sonar0',
messageType : 'sensor_msgs/Range' });

cmdSonarTopic.subscribe(function(message) {
console.log('Received message on ' + + ': ' +  message.header.range);   });

But on browser console the message i see is "Received message on /gazebo/sensor/Sonar0: undifined ". Range's data type is float32. How can i make it right?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-05-13 05:00:39 -0500

minerva gravatar image

sorry guys its my mistake. range data should be out of header scope.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-05-12 17:10:41 -0500

Seen: 84 times

Last updated: May 12 '15