Created
March 4, 2021 15:58
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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