Hello Viet,
Techncially, "readImage" is a method for an object of class ros.msg.sensor_msgs.Image (and CompressedImage). There isn't really a big distinction, other than that you'll see this error if you try to call it with any input that is not an object of the required type.
Walter is likely on the right track here. The LatestMessage property of a subscriber is empty until it receives a message. Likely there was simply a timing issue with the virtual machine or the Gazebo communication, and that line ran before the message was received. Like Walter suggested, I'd suggest putting an if ~isempty(sub.LatestMessage) call in to check before you run anything that depends on the message. Or use "receive" on the subscriber to wait for the next message to come in (works best if messages are sent on that topic on a regular interval).
-Cam
1 Comment
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/513497-undefined-function-readimage-for-input-arguments-of-type-double-in-pickandplaceworkflowingazebo#comment_816771
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/513497-undefined-function-readimage-for-input-arguments-of-type-double-in-pickandplaceworkflowingazebo#comment_816771
Sign in to comment.