Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save PeterMitrano/7daa8a993d7d05bd6f440daff7299f6a to your computer and use it in GitHub Desktop.
Save PeterMitrano/7daa8a993d7d05bd6f440daff7299f6a to your computer and use it in GitHub Desktop.
Quick example of how to serialize then deserialize a ROS msg in python 3
from io import BytesIO
from geometry_msgs.msg import Point
p = Point(x=2, y=4)
print(p)
buff = BytesIO()
p.serialize(buff)
serialized_bytes = buff.getvalue()
p2 = Point()
p2.deserialize(serialized_bytes)
print(p2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment