_Servo.py
Go to the documentation of this file.
00001 """autogenerated by genpy from r2_msgs/ServoRequest.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 ServoRequest(genpy.Message):
00009   _md5sum = "84ae688f7219fea2850abe26519fc2d0"
00010   _type = "r2_msgs/ServoRequest"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string joint
00013 bool state
00014 
00015 """
00016   __slots__ = ['joint','state']
00017   _slot_types = ['string','bool']
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        joint,state
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(ServoRequest, self).__init__(*args, **kwds)
00035       #message fields cannot be None, assign default values for those that are
00036       if self.joint is None:
00037         self.joint = ''
00038       if self.state is None:
00039         self.state = False
00040     else:
00041       self.joint = ''
00042       self.state = False
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.joint
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.state))
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.joint = str[start:end].decode('utf-8')
00080       else:
00081         self.joint = str[start:end]
00082       start = end
00083       end += 1
00084       (self.state,) = _struct_B.unpack(str[start:end])
00085       self.state = bool(self.state)
00086       return self
00087     except struct.error as e:
00088       raise genpy.DeserializationError(e) #most likely buffer underfill
00089 
00090 
00091   def serialize_numpy(self, buff, numpy):
00092     """
00093     serialize message with numpy array types into buffer
00094     :param buff: buffer, ``StringIO``
00095     :param numpy: numpy python module
00096     """
00097     try:
00098       _x = self.joint
00099       length = len(_x)
00100       if python3 or type(_x) == unicode:
00101         _x = _x.encode('utf-8')
00102         length = len(_x)
00103       buff.write(struct.pack('<I%ss'%length, length, _x))
00104       buff.write(_struct_B.pack(self.state))
00105     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00106     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00107 
00108   def deserialize_numpy(self, str, numpy):
00109     """
00110     unpack serialized message in str into this message instance using numpy for array types
00111     :param str: byte array of serialized message, ``str``
00112     :param numpy: numpy python module
00113     """
00114     try:
00115       end = 0
00116       start = end
00117       end += 4
00118       (length,) = _struct_I.unpack(str[start:end])
00119       start = end
00120       end += length
00121       if python3:
00122         self.joint = str[start:end].decode('utf-8')
00123       else:
00124         self.joint = str[start:end]
00125       start = end
00126       end += 1
00127       (self.state,) = _struct_B.unpack(str[start:end])
00128       self.state = bool(self.state)
00129       return self
00130     except struct.error as e:
00131       raise genpy.DeserializationError(e) #most likely buffer underfill
00132 
00133 _struct_I = genpy.struct_I
00134 _struct_B = struct.Struct("<B")
00135 """autogenerated by genpy from r2_msgs/ServoResponse.msg. Do not edit."""
00136 import sys
00137 python3 = True if sys.hexversion > 0x03000000 else False
00138 import genpy
00139 import struct
00140 
00141 
00142 class ServoResponse(genpy.Message):
00143   _md5sum = "86791dcf1de997ec7de5a0de7e4dcfcc"
00144   _type = "r2_msgs/ServoResponse"
00145   _has_header = False #flag to mark the presence of a Header object
00146   _full_text = """int32 status
00147 
00148 
00149 """
00150   __slots__ = ['status']
00151   _slot_types = ['int32']
00152 
00153   def __init__(self, *args, **kwds):
00154     """
00155     Constructor. Any message fields that are implicitly/explicitly
00156     set to None will be assigned a default value. The recommend
00157     use is keyword arguments as this is more robust to future message
00158     changes.  You cannot mix in-order arguments and keyword arguments.
00159 
00160     The available fields are:
00161        status
00162 
00163     :param args: complete set of field values, in .msg order
00164     :param kwds: use keyword arguments corresponding to message field names
00165     to set specific fields.
00166     """
00167     if args or kwds:
00168       super(ServoResponse, self).__init__(*args, **kwds)
00169       #message fields cannot be None, assign default values for those that are
00170       if self.status is None:
00171         self.status = 0
00172     else:
00173       self.status = 0
00174 
00175   def _get_types(self):
00176     """
00177     internal API method
00178     """
00179     return self._slot_types
00180 
00181   def serialize(self, buff):
00182     """
00183     serialize message into buffer
00184     :param buff: buffer, ``StringIO``
00185     """
00186     try:
00187       buff.write(_struct_i.pack(self.status))
00188     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00189     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00190 
00191   def deserialize(self, str):
00192     """
00193     unpack serialized message in str into this message instance
00194     :param str: byte array of serialized message, ``str``
00195     """
00196     try:
00197       end = 0
00198       start = end
00199       end += 4
00200       (self.status,) = _struct_i.unpack(str[start:end])
00201       return self
00202     except struct.error as e:
00203       raise genpy.DeserializationError(e) #most likely buffer underfill
00204 
00205 
00206   def serialize_numpy(self, buff, numpy):
00207     """
00208     serialize message with numpy array types into buffer
00209     :param buff: buffer, ``StringIO``
00210     :param numpy: numpy python module
00211     """
00212     try:
00213       buff.write(_struct_i.pack(self.status))
00214     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00215     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00216 
00217   def deserialize_numpy(self, str, numpy):
00218     """
00219     unpack serialized message in str into this message instance using numpy for array types
00220     :param str: byte array of serialized message, ``str``
00221     :param numpy: numpy python module
00222     """
00223     try:
00224       end = 0
00225       start = end
00226       end += 4
00227       (self.status,) = _struct_i.unpack(str[start:end])
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_i = struct.Struct("<i")
00234 class Servo(object):
00235   _type          = 'r2_msgs/Servo'
00236   _md5sum = 'e20c77f9e16ee3e6c3b899e416826344'
00237   _request_class  = ServoRequest
00238   _response_class = ServoResponse


r2_msgs
Author(s): Paul Dinh
autogenerated on Sat Jul 26 2014 06:34:21