_demonstration.py
Go to the documentation of this file.
00001 """autogenerated by genpy from lfd_common/demonstrationRequest.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import lfd_common.msg
00008 
00009 class demonstrationRequest(genpy.Message):
00010   _md5sum = "811e2bf3307e0acab2b7b6ca059a24c9"
00011   _type = "lfd_common/demonstrationRequest"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """
00014 state s
00015 
00016 ================================================================================
00017 MSG: lfd_common/state
00018 # The state vector
00019 float32[] state_vector
00020 
00021 """
00022   __slots__ = ['s']
00023   _slot_types = ['lfd_common/state']
00024 
00025   def __init__(self, *args, **kwds):
00026     """
00027     Constructor. Any message fields that are implicitly/explicitly
00028     set to None will be assigned a default value. The recommend
00029     use is keyword arguments as this is more robust to future message
00030     changes.  You cannot mix in-order arguments and keyword arguments.
00031 
00032     The available fields are:
00033        s
00034 
00035     :param args: complete set of field values, in .msg order
00036     :param kwds: use keyword arguments corresponding to message field names
00037     to set specific fields.
00038     """
00039     if args or kwds:
00040       super(demonstrationRequest, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.s is None:
00043         self.s = lfd_common.msg.state()
00044     else:
00045       self.s = lfd_common.msg.state()
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       length = len(self.s.state_vector)
00060       buff.write(_struct_I.pack(length))
00061       pattern = '<%sf'%length
00062       buff.write(struct.pack(pattern, *self.s.state_vector))
00063     except struct.error as se: self._check_types(se)
00064     except TypeError as te: self._check_types(te)
00065 
00066   def deserialize(self, str):
00067     """
00068     unpack serialized message in str into this message instance
00069     :param str: byte array of serialized message, ``str``
00070     """
00071     try:
00072       if self.s is None:
00073         self.s = lfd_common.msg.state()
00074       end = 0
00075       start = end
00076       end += 4
00077       (length,) = _struct_I.unpack(str[start:end])
00078       pattern = '<%sf'%length
00079       start = end
00080       end += struct.calcsize(pattern)
00081       self.s.state_vector = struct.unpack(pattern, str[start:end])
00082       return self
00083     except struct.error as e:
00084       raise genpy.DeserializationError(e) #most likely buffer underfill
00085 
00086 
00087   def serialize_numpy(self, buff, numpy):
00088     """
00089     serialize message with numpy array types into buffer
00090     :param buff: buffer, ``StringIO``
00091     :param numpy: numpy python module
00092     """
00093     try:
00094       length = len(self.s.state_vector)
00095       buff.write(_struct_I.pack(length))
00096       pattern = '<%sf'%length
00097       buff.write(self.s.state_vector.tostring())
00098     except struct.error as se: self._check_types(se)
00099     except TypeError as te: self._check_types(te)
00100 
00101   def deserialize_numpy(self, str, numpy):
00102     """
00103     unpack serialized message in str into this message instance using numpy for array types
00104     :param str: byte array of serialized message, ``str``
00105     :param numpy: numpy python module
00106     """
00107     try:
00108       if self.s is None:
00109         self.s = lfd_common.msg.state()
00110       end = 0
00111       start = end
00112       end += 4
00113       (length,) = _struct_I.unpack(str[start:end])
00114       pattern = '<%sf'%length
00115       start = end
00116       end += struct.calcsize(pattern)
00117       self.s.state_vector = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00118       return self
00119     except struct.error as e:
00120       raise genpy.DeserializationError(e) #most likely buffer underfill
00121 
00122 _struct_I = genpy.struct_I
00123 """autogenerated by genpy from lfd_common/demonstrationResponse.msg. Do not edit."""
00124 import sys
00125 python3 = True if sys.hexversion > 0x03000000 else False
00126 import genpy
00127 import struct
00128 
00129 
00130 class demonstrationResponse(genpy.Message):
00131   _md5sum = "5f4f858fb14b1a3741f1340ff3489c0e"
00132   _type = "lfd_common/demonstrationResponse"
00133   _has_header = False #flag to mark the presence of a Header object
00134   _full_text = """
00135 bool valid
00136 
00137 int32 a
00138 
00139 
00140 """
00141   __slots__ = ['valid','a']
00142   _slot_types = ['bool','int32']
00143 
00144   def __init__(self, *args, **kwds):
00145     """
00146     Constructor. Any message fields that are implicitly/explicitly
00147     set to None will be assigned a default value. The recommend
00148     use is keyword arguments as this is more robust to future message
00149     changes.  You cannot mix in-order arguments and keyword arguments.
00150 
00151     The available fields are:
00152        valid,a
00153 
00154     :param args: complete set of field values, in .msg order
00155     :param kwds: use keyword arguments corresponding to message field names
00156     to set specific fields.
00157     """
00158     if args or kwds:
00159       super(demonstrationResponse, self).__init__(*args, **kwds)
00160       #message fields cannot be None, assign default values for those that are
00161       if self.valid is None:
00162         self.valid = False
00163       if self.a is None:
00164         self.a = 0
00165     else:
00166       self.valid = False
00167       self.a = 0
00168 
00169   def _get_types(self):
00170     """
00171     internal API method
00172     """
00173     return self._slot_types
00174 
00175   def serialize(self, buff):
00176     """
00177     serialize message into buffer
00178     :param buff: buffer, ``StringIO``
00179     """
00180     try:
00181       _x = self
00182       buff.write(_struct_Bi.pack(_x.valid, _x.a))
00183     except struct.error as se: self._check_types(se)
00184     except TypeError as te: self._check_types(te)
00185 
00186   def deserialize(self, str):
00187     """
00188     unpack serialized message in str into this message instance
00189     :param str: byte array of serialized message, ``str``
00190     """
00191     try:
00192       end = 0
00193       _x = self
00194       start = end
00195       end += 5
00196       (_x.valid, _x.a,) = _struct_Bi.unpack(str[start:end])
00197       self.valid = bool(self.valid)
00198       return self
00199     except struct.error as e:
00200       raise genpy.DeserializationError(e) #most likely buffer underfill
00201 
00202 
00203   def serialize_numpy(self, buff, numpy):
00204     """
00205     serialize message with numpy array types into buffer
00206     :param buff: buffer, ``StringIO``
00207     :param numpy: numpy python module
00208     """
00209     try:
00210       _x = self
00211       buff.write(_struct_Bi.pack(_x.valid, _x.a))
00212     except struct.error as se: self._check_types(se)
00213     except TypeError as te: self._check_types(te)
00214 
00215   def deserialize_numpy(self, str, numpy):
00216     """
00217     unpack serialized message in str into this message instance using numpy for array types
00218     :param str: byte array of serialized message, ``str``
00219     :param numpy: numpy python module
00220     """
00221     try:
00222       end = 0
00223       _x = self
00224       start = end
00225       end += 5
00226       (_x.valid, _x.a,) = _struct_Bi.unpack(str[start:end])
00227       self.valid = bool(self.valid)
00228       return self
00229     except struct.error as e:
00230       raise genpy.DeserializationError(e) #most likely buffer underfill
00231 
00232 _struct_I = genpy.struct_I
00233 _struct_Bi = struct.Struct("<Bi")
00234 class demonstration(object):
00235   _type          = 'lfd_common/demonstration'
00236   _md5sum = '36d7246e4557dd680c8020206f232042'
00237   _request_class  = demonstrationRequest
00238   _response_class = demonstrationResponse


lfd_common
Author(s): Russell Toris
autogenerated on Thu Jan 2 2014 11:23:52