Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to subscribe float32 data

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?