This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
[store points] evaluate format #23
Comments
|
Open Questions:
|
To store direct python structures like this position_start = Pose()
position_start.position.x = 0.73
position_start.position.y = -0.2
position_start.position.z = 0.3 would give additional advantages:
Should we extend rospy_message_converter to allow such output? |
We could do something along those lines: import inspect
import genpy
def recreate_rep(msg):
if not isinstance(msg, genpy.Message):
return str(msg)
arguments = {}
for a in dir(msg):
if not (a.startswith("_") or "serialize" in a) and not callable(getattr(msg, a)):
arguments[a] = recreate_rep(getattr(msg, a))
args_string = ', '.join('{}={}'.format(key, value) for key, value in arguments.items())
repr_string = "%s(%s)" % (msg.__class__.__name__ , args_string)
return repr_string so this from geometry_msgs.msg import Pose, Point
recreate_rep(Pose(position=Point(x=2, z=3))) results in
and eval works again. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
for easy storage
The text was updated successfully, but these errors were encountered: