corot / world_canvas

ROS framework for storing and accessing semantic information about the world, with an initial emphasis on needs and use cases for mobile robots.
10 stars 19 forks source link

Send binary int8[] or yaml strings? #4

Closed stonier closed 10 years ago

stonier commented 10 years ago

Which is faster, better?

Isn't serialising into bytearrays redundant? You serialise into bytearray, then ros serialises it again.

jihoonl commented 10 years ago

uint8[] is designated for binary data in ROS. So I don't think ros would serialise it twice. PointCloud2 is good usecase which uses uint8[] to compress as binary format.

http://wiki.ros.org/msg http://docs.ros.org/api/sensor_msgs/html/msg/PointCloud2.html

stonier commented 10 years ago

There will still be some serialization done even for a uint8[] data field as it will have to (at the very least) accompany those uint8 bytes with a number indicating how large the array is. But at least there will be no float -> uint8 or string -> uint8 conversions going on.

The issue here is that we would be manually converting some arbitrary 'msg' into a uint8[] byte array, setting that as the field of a message that interacts with the warehouse.

  1. we would effectively doing the job of serializing.
  2. would be far easier to introspect (thinking rostopic echo) yaml strings.
corot commented 10 years ago

Well... as by now I'm just playing with very lightweight messages, using any approach don't make a difference. Serializing/deserializing with Python is just trivial, and fast (underlying C implementation). For introspection, both server and client can publish the messages, so is not a good advantage to allow doing so with the serialized messages. What we can do is, once we have heavy annotations (i.e. with images, or meshes) prepare a testbench to measure both serializing/deserializing and bandwith.

stonier commented 10 years ago

Seems the uint8 data type is quite widely used. The data_link_toolkit also uses this when setting up their aggregating relays.

stonier commented 10 years ago

Conclusion - we're using uint8. We can close this question @corot?

corot commented 10 years ago

yes, we can :v: