ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I'm assuming /camera/rgb/camera_info is of the sensor_msgs/CameraInfo type. If that's the case, storing the width and height should be possible with code like the following:
var con = new ros.Connection('ws://localhost:9090');
var width = null;
var height = null;
con.setOnOpen(function() {
con.addHandler('/camera/rgb/camera_info',function(msg) {
width = msg.width;
height = msg.height;
//do something with width and height?
con.callService('/rosjs/unsubscribe',['/camera/rgb/camera_info'],function() {});
});
con.callService('/rosjs/subscribe',['/camera/rgb/camera_info',0,'sensor_msgs/CameraInfo'],function() {});
});
Note that I'm also assuming that the width and height don't change over time.