ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

You probably shouldn't use numpy types, but native data types. The offsets member is supposed to be a native python long instead of numpy.uint32. Instead of:

msg_pf1.count = np.uint32(1)

just write:

msg_pf1.count = 1

You probably shouldn't use numpy types, but native data types. The offsets member is supposed to be a native python long instead of numpy.uint32. Instead of:

msg_pf1.count = np.uint32(1)

just write:

msg_pf1.count = 1

Regarding your other comment:

I'm using python/rospy. Another strange thing: I can run the script. As soon as I try to access the message (e.g. via rostopic echo) the error comes up.

This is probably because the serialization code isn't called until there is a subscriber to the topic.

You probably shouldn't use numpy types, but native data types. The offsets member field is supposed to be a native python long instead of numpy.uint32. Instead of:

msg_pf1.count msg_pf1.offset = np.uint32(1)
np.uint32(0)

just write:

msg_pf1.count msg_pf1.offset = 1

... and so on for all other fields.

Regarding your other comment:

I'm using python/rospy. Another strange thing: I can run the script. As soon as I try to access the message (e.g. via rostopic echo) the error comes up.

This is probably because the serialization code isn't called until there is a subscriber to the topic.

You probably shouldn't use numpy types, but native data types. The offsets field is supposed to be a native python long instead of numpy.uint32. Instead of:

msg_pf1.offset = np.uint32(0)

just write:

msg_pf1.offset = 1
0

... and so on for all other fields.

Regarding your other comment:

I'm using python/rospy. Another strange thing: I can run the script. As soon as I try to access the message (e.g. via rostopic echo) the error comes up.

This is probably because the serialization code isn't called until there is a subscriber to the topic.