RobotWebTools / roslibjs

The Standard ROS JavaScript Library
https://robotwebtools.github.io/roslibjs
Other
693 stars 382 forks source link

Topic Types does not match : [Sensor_msgs/Image] vs [sensor_msgs/CompressedImage] #272

Closed pushkalkatara closed 3 years ago

pushkalkatara commented 7 years ago

Referred this tutorial - http://wiki.ros.org/roslibjs/Tutorials/Publishing%20video%20and%20IMU%20data%20with%20roslibjs topics type not match error. http://docs.ros.org/kinetic/api/sensor_msgs/html/msg/CompressedImage.html http://docs.ros.org/kinetic/api/sensor_msgs/html/msg/Image.html

Is this tutorial synced with updates?

pushkalkatara commented 7 years ago

Does CompressedImage take only JPEG as input?

jihoonl commented 7 years ago

This tutorial seems to have been created by someone in the community. But, I think it should work anyway. What do you mean by topics type not match error?

Does CompressedImage take only JPEG as input?

sensor_msgs/CompressedImage can accept either jpeg or png. See the format description

pushkalkatara commented 7 years ago

a b Receving the matrix on the ROS side but image_view not displaying the image.

pushkalkatara commented 7 years ago

Solved this issue recently, imageview was not able to display the image but a simple opencv workaround worked.

        image_np = cv2.imdecode(np_arr, cv2.IMREAD_COLOR)
        cv2.imshow('cv_img', image_np)
        cv2.waitKey(2)

Though the video is lagging and saturating the rosbridge. Please suggest alternatives.

T045T commented 6 years ago

Are you sure the bridge is saturated? The example you linked only sends camera frames (at 640 pixels width) every 250ms. That shouldn't be enough to cause lag, but it is just 4fps, which might be why it seems laggy.