rospy can not receive custom message

asked 2022-09-07 10:02:19 -0600

gcc97 gravatar image

I customized the following two messsages and found that the rospy callback function test_cb did not work.

Point3D.msg

float32[3] point3D

PosedImage.msg

float64 timestamp
geometry_msgs/Pose pose
sensor_msgs/Image image
sensor_msgs/CameraInfo camera
Point3D[] listPoint3D

Here is the code of the subscriber node:

def test_cb(msg):
    print("Get")

rospy.Subscriber("/VO/key_posed_image", PosedImage, test_cd)
rospy.loginfo("test save_data, start...")
rospy.spin()

However, the cpp version of test_cb works well.

If I removed the listPoint3D in PosedImage, then the rospy callback function can also work well.

So, I wonder why the Point3D[] would make rospy fail to receive PosedImage.msg.

Really appreciate any hints or help.

edit retag flag offensive close merge delete

Comments

Probably, float32[3] is the culprit. The fixed-size array was introduced mainly in ROS 2. A workaround should be changing the Point3D.msg to as shown below:

float32 x
float32 y
float32 z
ravijoshi gravatar image ravijoshi  ( 2022-09-07 23:06:49 -0600 )edit