ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Visualization Marker + Serializable

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

JustARandomGuy gravatar image

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

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 -0600 )edit

1 Answer

Sort by » oldest newest most voted

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

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

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

Question Tools


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

Seen: 195 times

Last updated: Jan 14 '13