_SimpleMotorFlasher.py
Go to the documentation of this file.
00001 """autogenerated by genpy from sr_robot_msgs/SimpleMotorFlasherRequest.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 SimpleMotorFlasherRequest(genpy.Message):
00009   _md5sum = "95979d9c30a49ed16e3ab17fe0edb157"
00010   _type = "sr_robot_msgs/SimpleMotorFlasherRequest"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string firmware
00013 int8 motor_id
00014 
00015 """
00016   __slots__ = ['firmware','motor_id']
00017   _slot_types = ['string','int8']
00018 
00019   def __init__(self, *args, **kwds):
00020     """
00021     Constructor. Any message fields that are implicitly/explicitly
00022     set to None will be assigned a default value. The recommend
00023     use is keyword arguments as this is more robust to future message
00024     changes.  You cannot mix in-order arguments and keyword arguments.
00025 
00026     The available fields are:
00027        firmware,motor_id
00028 
00029     :param args: complete set of field values, in .msg order
00030     :param kwds: use keyword arguments corresponding to message field names
00031     to set specific fields.
00032     """
00033     if args or kwds:
00034       super(SimpleMotorFlasherRequest, self).__init__(*args, **kwds)
00035       #message fields cannot be None, assign default values for those that are
00036       if self.firmware is None:
00037         self.firmware = ''
00038       if self.motor_id is None:
00039         self.motor_id = 0
00040     else:
00041       self.firmware = ''
00042       self.motor_id = 0
00043 
00044   def _get_types(self):
00045     """
00046     internal API method
00047     """
00048     return self._slot_types
00049 
00050   def serialize(self, buff):
00051     """
00052     serialize message into buffer
00053     :param buff: buffer, ``StringIO``
00054     """
00055     try:
00056       _x = self.firmware
00057       length = len(_x)
00058       if python3 or type(_x) == unicode:
00059         _x = _x.encode('utf-8')
00060         length = len(_x)
00061       buff.write(struct.pack('<I%ss'%length, length, _x))
00062       buff.write(_struct_b.pack(self.motor_id))
00063     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00064     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
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       end = 0
00073       start = end
00074       end += 4
00075       (length,) = _struct_I.unpack(str[start:end])
00076       start = end
00077       end += length
00078       if python3:
00079         self.firmware = str[start:end].decode('utf-8')
00080       else:
00081         self.firmware = str[start:end]
00082       start = end
00083       end += 1
00084       (self.motor_id,) = _struct_b.unpack(str[start:end])
00085       return self
00086     except struct.error as e:
00087       raise genpy.DeserializationError(e) #most likely buffer underfill
00088 
00089 
00090   def serialize_numpy(self, buff, numpy):
00091     """
00092     serialize message with numpy array types into buffer
00093     :param buff: buffer, ``StringIO``
00094     :param numpy: numpy python module
00095     """
00096     try:
00097       _x = self.firmware
00098       length = len(_x)
00099       if python3 or type(_x) == unicode:
00100         _x = _x.encode('utf-8')
00101         length = len(_x)
00102       buff.write(struct.pack('<I%ss'%length, length, _x))
00103       buff.write(_struct_b.pack(self.motor_id))
00104     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00105     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00106 
00107   def deserialize_numpy(self, str, numpy):
00108     """
00109     unpack serialized message in str into this message instance using numpy for array types
00110     :param str: byte array of serialized message, ``str``
00111     :param numpy: numpy python module
00112     """
00113     try:
00114       end = 0
00115       start = end
00116       end += 4
00117       (length,) = _struct_I.unpack(str[start:end])
00118       start = end
00119       end += length
00120       if python3:
00121         self.firmware = str[start:end].decode('utf-8')
00122       else:
00123         self.firmware = str[start:end]
00124       start = end
00125       end += 1
00126       (self.motor_id,) = _struct_b.unpack(str[start:end])
00127       return self
00128     except struct.error as e:
00129       raise genpy.DeserializationError(e) #most likely buffer underfill
00130 
00131 _struct_I = genpy.struct_I
00132 _struct_b = struct.Struct("<b")
00133 """autogenerated by genpy from sr_robot_msgs/SimpleMotorFlasherResponse.msg. Do not edit."""
00134 import sys
00135 python3 = True if sys.hexversion > 0x03000000 else False
00136 import genpy
00137 import struct
00138 
00139 
00140 class SimpleMotorFlasherResponse(genpy.Message):
00141   _md5sum = "57a3be4812415ba24758cca00aebf53f"
00142   _type = "sr_robot_msgs/SimpleMotorFlasherResponse"
00143   _has_header = False #flag to mark the presence of a Header object
00144   _full_text = """int32 value
00145 
00146 int32 SUCCESS = 0
00147 int32 FAIL = 1
00148 
00149 
00150 """
00151   # Pseudo-constants
00152   SUCCESS = 0
00153   FAIL = 1
00154 
00155   __slots__ = ['value']
00156   _slot_types = ['int32']
00157 
00158   def __init__(self, *args, **kwds):
00159     """
00160     Constructor. Any message fields that are implicitly/explicitly
00161     set to None will be assigned a default value. The recommend
00162     use is keyword arguments as this is more robust to future message
00163     changes.  You cannot mix in-order arguments and keyword arguments.
00164 
00165     The available fields are:
00166        value
00167 
00168     :param args: complete set of field values, in .msg order
00169     :param kwds: use keyword arguments corresponding to message field names
00170     to set specific fields.
00171     """
00172     if args or kwds:
00173       super(SimpleMotorFlasherResponse, self).__init__(*args, **kwds)
00174       #message fields cannot be None, assign default values for those that are
00175       if self.value is None:
00176         self.value = 0
00177     else:
00178       self.value = 0
00179 
00180   def _get_types(self):
00181     """
00182     internal API method
00183     """
00184     return self._slot_types
00185 
00186   def serialize(self, buff):
00187     """
00188     serialize message into buffer
00189     :param buff: buffer, ``StringIO``
00190     """
00191     try:
00192       buff.write(_struct_i.pack(self.value))
00193     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00194     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00195 
00196   def deserialize(self, str):
00197     """
00198     unpack serialized message in str into this message instance
00199     :param str: byte array of serialized message, ``str``
00200     """
00201     try:
00202       end = 0
00203       start = end
00204       end += 4
00205       (self.value,) = _struct_i.unpack(str[start:end])
00206       return self
00207     except struct.error as e:
00208       raise genpy.DeserializationError(e) #most likely buffer underfill
00209 
00210 
00211   def serialize_numpy(self, buff, numpy):
00212     """
00213     serialize message with numpy array types into buffer
00214     :param buff: buffer, ``StringIO``
00215     :param numpy: numpy python module
00216     """
00217     try:
00218       buff.write(_struct_i.pack(self.value))
00219     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00220     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00221 
00222   def deserialize_numpy(self, str, numpy):
00223     """
00224     unpack serialized message in str into this message instance using numpy for array types
00225     :param str: byte array of serialized message, ``str``
00226     :param numpy: numpy python module
00227     """
00228     try:
00229       end = 0
00230       start = end
00231       end += 4
00232       (self.value,) = _struct_i.unpack(str[start:end])
00233       return self
00234     except struct.error as e:
00235       raise genpy.DeserializationError(e) #most likely buffer underfill
00236 
00237 _struct_I = genpy.struct_I
00238 _struct_i = struct.Struct("<i")
00239 class SimpleMotorFlasher(object):
00240   _type          = 'sr_robot_msgs/SimpleMotorFlasher'
00241   _md5sum = 'b5e4cd4b44ed54dd8f018caf24a9e0c1'
00242   _request_class  = SimpleMotorFlasherRequest
00243   _response_class = SimpleMotorFlasherResponse


sr_robot_msgs
Author(s): Ugo Cupcic/ugo@shadowrobot.com
autogenerated on Mon Oct 6 2014 07:40:06