ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
2

ByteMultiArray publish fails if data > 10 bytes

asked 2017-11-27 12:32:47 -0500

fpgamcu gravatar image

updated 2017-11-27 14:02:26 -0500

gvdhoorn gravatar image

I have next code:

data = file.read()  
arr = ByteMultiArray()  
arr.data = list(bytearray(data))  
arr.layout.dim.append(MultiArrayDimension())  
arr.layout.dim[0].label = "soundfile"  
arr.layout.dim[0].size = len(arr.data)  
arr.layout.dim[0].stride = len(arr.data)  
arr.layout.data_offset = 0  
pub.publish(arr)

When data 10 and less publish succeed When data > 10 I have

rospy.exceptions.ROSSerializationException: field data[] exceeds specified width [byte]
edit retag flag offensive close merge delete

Comments

Yeah! I met the same problem. Did you fixed it?

daydreamhippo gravatar image daydreamhippo  ( 2023-02-23 01:50:31 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-11-29 06:03:16 -0500

At first glance the problem looks like the stride value you are giving it. The stride is the number of bytes for each element in the array in this case 1, it definitely shouldn't be the array length. Try setting the stride to 1 and see if that fixes the problem.

edit flag offensive delete link more

Comments

With stride = 1 still same error.

fpgamcu gravatar image fpgamcu  ( 2017-11-29 06:22:30 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-11-27 12:30:34 -0500

Seen: 246 times

Last updated: Nov 29 '17