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

Revision history [back]

click to hide/show revision 1
initial version

You can introspect on a message using _slots and _slot_types. Here are their values for Header.

  __slots__ = ['seq','stamp','frame_id']
  _slot_types = ['uint32','time','string']

They have different underscores because __slots__ is a Python builtin and has special meaning.

from std_msgs.msg import Header
for name, type_ in zip(Header.__slots__, Header._slot_types):
     print name, type_

prints:

seq uint32
stamp time
frame_id string