Go to the documentation of this file.00001 """autogenerated by genpy from PhidgetServo/ServoType.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 ServoType(genpy.Message):
00009 _md5sum = "1838b6e393c9a582039957a5d550ab79"
00010 _type = "PhidgetServo/ServoType"
00011 _has_header = False
00012 _full_text = """#Deprecated. Prefer to use the one in corobot_msgs package, which is exactly the same
00013
00014 #
00015 # Morgan Cormier <mcormier@coroware.com>
00016 #
00017 # Service used to set the type of servo motor connected at the specified index on the phidget servo controller
00018 #
00019 # Index is the index of the servo motor connected to the phidget device.
00020 # The maximum value of index depends on the Phidget device and how many connections it accepts
00021 #
00022 # type is the type of motor. See enum CPhidget_ServoType of the Phidget library for the list of type.
00023
00024 int8 index
00025
00026 int8 type
00027
00028 """
00029 __slots__ = ['index','type']
00030 _slot_types = ['int8','int8']
00031
00032 def __init__(self, *args, **kwds):
00033 """
00034 Constructor. Any message fields that are implicitly/explicitly
00035 set to None will be assigned a default value. The recommend
00036 use is keyword arguments as this is more robust to future message
00037 changes. You cannot mix in-order arguments and keyword arguments.
00038
00039 The available fields are:
00040 index,type
00041
00042 :param args: complete set of field values, in .msg order
00043 :param kwds: use keyword arguments corresponding to message field names
00044 to set specific fields.
00045 """
00046 if args or kwds:
00047 super(ServoType, self).__init__(*args, **kwds)
00048
00049 if self.index is None:
00050 self.index = 0
00051 if self.type is None:
00052 self.type = 0
00053 else:
00054 self.index = 0
00055 self.type = 0
00056
00057 def _get_types(self):
00058 """
00059 internal API method
00060 """
00061 return self._slot_types
00062
00063 def serialize(self, buff):
00064 """
00065 serialize message into buffer
00066 :param buff: buffer, ``StringIO``
00067 """
00068 try:
00069 _x = self
00070 buff.write(_struct_2b.pack(_x.index, _x.type))
00071 except struct.error as se: self._check_types(se)
00072 except TypeError as te: self._check_types(te)
00073
00074 def deserialize(self, str):
00075 """
00076 unpack serialized message in str into this message instance
00077 :param str: byte array of serialized message, ``str``
00078 """
00079 try:
00080 end = 0
00081 _x = self
00082 start = end
00083 end += 2
00084 (_x.index, _x.type,) = _struct_2b.unpack(str[start:end])
00085 return self
00086 except struct.error as e:
00087 raise genpy.DeserializationError(e)
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
00098 buff.write(_struct_2b.pack(_x.index, _x.type))
00099 except struct.error as se: self._check_types(se)
00100 except TypeError as te: self._check_types(te)
00101
00102 def deserialize_numpy(self, str, numpy):
00103 """
00104 unpack serialized message in str into this message instance using numpy for array types
00105 :param str: byte array of serialized message, ``str``
00106 :param numpy: numpy python module
00107 """
00108 try:
00109 end = 0
00110 _x = self
00111 start = end
00112 end += 2
00113 (_x.index, _x.type,) = _struct_2b.unpack(str[start:end])
00114 return self
00115 except struct.error as e:
00116 raise genpy.DeserializationError(e)
00117
00118 _struct_I = genpy.struct_I
00119 _struct_2b = struct.Struct("<2b")