Ask Your Question

Visualization Marker + Serializable

asked 2013-01-14 06:46:43 -0500

JustARandomGuy gravatar image

updated 2013-01-14 06:59:28 -0500

Eric Perko gravatar image

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

edit retag flag offensive close merge delete


How are you trying to serialize your markers?

Dan Lazewatsky gravatar image Dan Lazewatsky  ( 2013-01-14 07:41:33 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2013-01-14 09:18:31 -0500

updated 2013-01-14 09:20:04 -0500

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
import visualization_msgs.msg

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-01-14 06:46:43 -0500

Seen: 120 times

Last updated: Jan 14 '13