0
$\begingroup$

Rosanswers logo

Hi there, I am trying to write visualization markers (import visualization_msgs.Marker) onto a file however I get an error - and I believe the error is because Marker does not implement Serializable.

Is there any way of getting around this :/?

Thank you, really appreciate it

P.S. im trying to store the markers onto a file and then use the markers for later


Originally posted by JustARandomGuy on ROS Answers with karma: 23 on 2013-01-14

Post score: 2


Original comments

Comment by Dan Lazewatsky on 2013-01-14:
How are you trying to serialize your markers?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

What do you mean with "implements serializable"? The Marker type is of course serializable. All ROS message types are serializable. Here an example:

import roslib
roslib.load_manifest("visualization_msgs")
import visualization_msgs.msg
m=visualization_msgs.msg.Marker()
a=str(m)

In [55]: a
Out[55]: "header: \n  seq: 0\n  stamp: \n    secs: 0\n    nsecs: 0\n  frame_id: ''\nns: ad\nid: 0\ntype: 0\naction: 0\npose: \n  position: \n    x: 0.0\n    y: 0.0\n    z: 0.0\n  orientation: \n    x: 0.0\n    y: 0.0\n    z: 0.0\n    w: 0.0\nscale: \n  x: 0.0\n  y: 0.0\n  z: 0.0\ncolor: \n  r: 0.0\n  g: 0.0\n  b: 0.0\n  a: 0.0\nlifetime: \n  secs: 0\n  nsecs: 0\nframe_locked: False\npoints: []\ncolors: []\ntext: asdfadf\nmesh_resource: adfa\nmesh_use_embedded_materials: False"

Here the message has been serialized in the yaml format and stored a string variable. You can also use the methods the methods "Marker.serialize" and "Marker.serialize_numpy" in conjunction with the io.StringIO class


Originally posted by Pablo Iñigo Blasco with karma: 2982 on 2013-01-14

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.