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

ROSBridge : How are data arrays represented and sent via JSON?

asked 2013-12-23 08:23:11 -0500

trianta2 gravatar image

updated 2014-01-28 17:07:22 -0500

ngrennan gravatar image

If I send a uint8[] array with 1 byte of data (of value 0x00) over ROSBridge, I receive the string "AA==" on the client end.

How does ROSbridge handle the conversion of byte arrays to strings? How can I retrieve my original data of 0x00?

edit retag flag offensive close merge delete

Comments

I don't know how exactly rosbridge handles the data, but since the websockets are used, the memory spaces of payload and trailer are allocated. With websockets data is sent in between 0x00 and 0xFF in a packet. You can examine the rosbridge_library codes to see the conversion.

mozcelikors gravatar image mozcelikors  ( 2013-12-23 10:58:25 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-12-23 12:17:08 -0500

trianta2 gravatar image

Apparently it's common for people to encode raw binary to Base64 before transmitting data via JSON objects. That's what was happening. I was able to decode the message from Base64 and retrieve my data.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-12-23 08:23:11 -0500

Seen: 1,562 times

Last updated: Dec 23 '13