00001 """autogenerated by genmsg_py from MenuEntry.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class MenuEntry(roslib.message.Message):
00007 _md5sum = "b90ec63024573de83b57aa93eb39be2d"
00008 _type = "visualization_msgs/MenuEntry"
00009 _has_header = False
00010 _full_text = """# MenuEntry message.
00011
00012 # Each InteractiveMarker message has an array of MenuEntry messages.
00013 # A collection of MenuEntries together describe a
00014 # menu/submenu/subsubmenu/etc tree, though they are stored in a flat
00015 # array. The tree structure is represented by giving each menu entry
00016 # an ID number and a "parent_id" field. Top-level entries are the
00017 # ones with parent_id = 0. Menu entries are ordered within their
00018 # level the same way they are ordered in the containing array. Parent
00019 # entries must appear before their children.
00020
00021 # Example:
00022 # - id = 3
00023 # parent_id = 0
00024 # title = "fun"
00025 # - id = 2
00026 # parent_id = 0
00027 # title = "robot"
00028 # - id = 4
00029 # parent_id = 2
00030 # title = "pr2"
00031 # - id = 5
00032 # parent_id = 2
00033 # title = "turtle"
00034 #
00035 # Gives a menu tree like this:
00036 # - fun
00037 # - robot
00038 # - pr2
00039 # - turtle
00040
00041 # ID is a number for each menu entry. Must be unique within the
00042 # control, and should never be 0.
00043 uint32 id
00044
00045 # ID of the parent of this menu entry, if it is a submenu. If this
00046 # menu entry is a top-level entry, set parent_id to 0.
00047 uint32 parent_id
00048
00049 # menu / entry title
00050 string title
00051
00052 # Arguments to command indicated by command_type (below)
00053 string command
00054
00055 # Command_type stores the type of response desired when this menu
00056 # entry is clicked.
00057 # FEEDBACK: send an InteractiveMarkerFeedback message with menu_entry_id set to this entry's id.
00058 # ROSRUN: execute "rosrun" with arguments given in the command field (above).
00059 # ROSLAUNCH: execute "roslaunch" with arguments given in the command field (above).
00060 uint8 FEEDBACK=0
00061 uint8 ROSRUN=1
00062 uint8 ROSLAUNCH=2
00063 uint8 command_type
00064
00065 """
00066
00067 FEEDBACK = 0
00068 ROSRUN = 1
00069 ROSLAUNCH = 2
00070
00071 __slots__ = ['id','parent_id','title','command','command_type']
00072 _slot_types = ['uint32','uint32','string','string','uint8']
00073
00074 def __init__(self, *args, **kwds):
00075 """
00076 Constructor. Any message fields that are implicitly/explicitly
00077 set to None will be assigned a default value. The recommend
00078 use is keyword arguments as this is more robust to future message
00079 changes. You cannot mix in-order arguments and keyword arguments.
00080
00081 The available fields are:
00082 id,parent_id,title,command,command_type
00083
00084 @param args: complete set of field values, in .msg order
00085 @param kwds: use keyword arguments corresponding to message field names
00086 to set specific fields.
00087 """
00088 if args or kwds:
00089 super(MenuEntry, self).__init__(*args, **kwds)
00090
00091 if self.id is None:
00092 self.id = 0
00093 if self.parent_id is None:
00094 self.parent_id = 0
00095 if self.title is None:
00096 self.title = ''
00097 if self.command is None:
00098 self.command = ''
00099 if self.command_type is None:
00100 self.command_type = 0
00101 else:
00102 self.id = 0
00103 self.parent_id = 0
00104 self.title = ''
00105 self.command = ''
00106 self.command_type = 0
00107
00108 def _get_types(self):
00109 """
00110 internal API method
00111 """
00112 return self._slot_types
00113
00114 def serialize(self, buff):
00115 """
00116 serialize message into buffer
00117 @param buff: buffer
00118 @type buff: StringIO
00119 """
00120 try:
00121 _x = self
00122 buff.write(_struct_2I.pack(_x.id, _x.parent_id))
00123 _x = self.title
00124 length = len(_x)
00125 buff.write(struct.pack('<I%ss'%length, length, _x))
00126 _x = self.command
00127 length = len(_x)
00128 buff.write(struct.pack('<I%ss'%length, length, _x))
00129 buff.write(_struct_B.pack(self.command_type))
00130 except struct.error as se: self._check_types(se)
00131 except TypeError as te: self._check_types(te)
00132
00133 def deserialize(self, str):
00134 """
00135 unpack serialized message in str into this message instance
00136 @param str: byte array of serialized message
00137 @type str: str
00138 """
00139 try:
00140 end = 0
00141 _x = self
00142 start = end
00143 end += 8
00144 (_x.id, _x.parent_id,) = _struct_2I.unpack(str[start:end])
00145 start = end
00146 end += 4
00147 (length,) = _struct_I.unpack(str[start:end])
00148 start = end
00149 end += length
00150 self.title = str[start:end]
00151 start = end
00152 end += 4
00153 (length,) = _struct_I.unpack(str[start:end])
00154 start = end
00155 end += length
00156 self.command = str[start:end]
00157 start = end
00158 end += 1
00159 (self.command_type,) = _struct_B.unpack(str[start:end])
00160 return self
00161 except struct.error as e:
00162 raise roslib.message.DeserializationError(e)
00163
00164
00165 def serialize_numpy(self, buff, numpy):
00166 """
00167 serialize message with numpy array types into buffer
00168 @param buff: buffer
00169 @type buff: StringIO
00170 @param numpy: numpy python module
00171 @type numpy module
00172 """
00173 try:
00174 _x = self
00175 buff.write(_struct_2I.pack(_x.id, _x.parent_id))
00176 _x = self.title
00177 length = len(_x)
00178 buff.write(struct.pack('<I%ss'%length, length, _x))
00179 _x = self.command
00180 length = len(_x)
00181 buff.write(struct.pack('<I%ss'%length, length, _x))
00182 buff.write(_struct_B.pack(self.command_type))
00183 except struct.error as se: self._check_types(se)
00184 except TypeError as te: self._check_types(te)
00185
00186 def deserialize_numpy(self, str, numpy):
00187 """
00188 unpack serialized message in str into this message instance using numpy for array types
00189 @param str: byte array of serialized message
00190 @type str: str
00191 @param numpy: numpy python module
00192 @type numpy: module
00193 """
00194 try:
00195 end = 0
00196 _x = self
00197 start = end
00198 end += 8
00199 (_x.id, _x.parent_id,) = _struct_2I.unpack(str[start:end])
00200 start = end
00201 end += 4
00202 (length,) = _struct_I.unpack(str[start:end])
00203 start = end
00204 end += length
00205 self.title = str[start:end]
00206 start = end
00207 end += 4
00208 (length,) = _struct_I.unpack(str[start:end])
00209 start = end
00210 end += length
00211 self.command = str[start:end]
00212 start = end
00213 end += 1
00214 (self.command_type,) = _struct_B.unpack(str[start:end])
00215 return self
00216 except struct.error as e:
00217 raise roslib.message.DeserializationError(e)
00218
00219 _struct_I = roslib.message.struct_I
00220 _struct_B = struct.Struct("<B")
00221 _struct_2I = struct.Struct("<2I")