_LinkPadding.py
Go to the documentation of this file.
00001 """autogenerated by genpy from arm_navigation_msgs/LinkPadding.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class LinkPadding(genpy.Message):
00009   _md5sum = "b3ea75670df55c696fedee97774d5947"
00010   _type = "arm_navigation_msgs/LinkPadding"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """#name for the link
00013 string link_name
00014 
00015 # padding to apply to the link
00016 float64 padding
00017 
00018 """
00019   __slots__ = ['link_name','padding']
00020   _slot_types = ['string','float64']
00021 
00022   def __init__(self, *args, **kwds):
00023     """
00024     Constructor. Any message fields that are implicitly/explicitly
00025     set to None will be assigned a default value. The recommend
00026     use is keyword arguments as this is more robust to future message
00027     changes.  You cannot mix in-order arguments and keyword arguments.
00028 
00029     The available fields are:
00030        link_name,padding
00031 
00032     :param args: complete set of field values, in .msg order
00033     :param kwds: use keyword arguments corresponding to message field names
00034     to set specific fields.
00035     """
00036     if args or kwds:
00037       super(LinkPadding, self).__init__(*args, **kwds)
00038       #message fields cannot be None, assign default values for those that are
00039       if self.link_name is None:
00040         self.link_name = ''
00041       if self.padding is None:
00042         self.padding = 0.
00043     else:
00044       self.link_name = ''
00045       self.padding = 0.
00046 
00047   def _get_types(self):
00048     """
00049     internal API method
00050     """
00051     return self._slot_types
00052 
00053   def serialize(self, buff):
00054     """
00055     serialize message into buffer
00056     :param buff: buffer, ``StringIO``
00057     """
00058     try:
00059       _x = self.link_name
00060       length = len(_x)
00061       if python3 or type(_x) == unicode:
00062         _x = _x.encode('utf-8')
00063         length = len(_x)
00064       buff.write(struct.pack('<I%ss'%length, length, _x))
00065       buff.write(_struct_d.pack(self.padding))
00066     except struct.error as se: self._check_types(se)
00067     except TypeError as te: self._check_types(te)
00068 
00069   def deserialize(self, str):
00070     """
00071     unpack serialized message in str into this message instance
00072     :param str: byte array of serialized message, ``str``
00073     """
00074     try:
00075       end = 0
00076       start = end
00077       end += 4
00078       (length,) = _struct_I.unpack(str[start:end])
00079       start = end
00080       end += length
00081       if python3:
00082         self.link_name = str[start:end].decode('utf-8')
00083       else:
00084         self.link_name = str[start:end]
00085       start = end
00086       end += 8
00087       (self.padding,) = _struct_d.unpack(str[start:end])
00088       return self
00089     except struct.error as e:
00090       raise genpy.DeserializationError(e) #most likely buffer underfill
00091 
00092 
00093   def serialize_numpy(self, buff, numpy):
00094     """
00095     serialize message with numpy array types into buffer
00096     :param buff: buffer, ``StringIO``
00097     :param numpy: numpy python module
00098     """
00099     try:
00100       _x = self.link_name
00101       length = len(_x)
00102       if python3 or type(_x) == unicode:
00103         _x = _x.encode('utf-8')
00104         length = len(_x)
00105       buff.write(struct.pack('<I%ss'%length, length, _x))
00106       buff.write(_struct_d.pack(self.padding))
00107     except struct.error as se: self._check_types(se)
00108     except TypeError as te: self._check_types(te)
00109 
00110   def deserialize_numpy(self, str, numpy):
00111     """
00112     unpack serialized message in str into this message instance using numpy for array types
00113     :param str: byte array of serialized message, ``str``
00114     :param numpy: numpy python module
00115     """
00116     try:
00117       end = 0
00118       start = end
00119       end += 4
00120       (length,) = _struct_I.unpack(str[start:end])
00121       start = end
00122       end += length
00123       if python3:
00124         self.link_name = str[start:end].decode('utf-8')
00125       else:
00126         self.link_name = str[start:end]
00127       start = end
00128       end += 8
00129       (self.padding,) = _struct_d.unpack(str[start:end])
00130       return self
00131     except struct.error as e:
00132       raise genpy.DeserializationError(e) #most likely buffer underfill
00133 
00134 _struct_I = genpy.struct_I
00135 _struct_d = struct.Struct("<d")


arm_navigation_msgs
Author(s): Gil Jones
autogenerated on Thu Dec 12 2013 11:08:10