00001 """autogenerated by genpy from sr_robot_msgs/contrlr.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 contrlr(genpy.Message):
00009 _md5sum = "7b2aa60305c5a9ab0ff05803e4d2ab85"
00010 _type = "sr_robot_msgs/contrlr"
00011 _has_header = False
00012 _full_text = """# the contrlr name (e.g. smart_motor_ff2)
00013 string contrlr_name
00014
00015 # specify here a list of parameter_name:value
00016 # e.g. p:10 sets the p value of the controller to 10
00017 # the possible parameters are:
00018 #int16 p
00019 #int16 i
00020 #int16 d
00021 #int16 imax
00022 #int16 target
00023 #int16 sensor
00024 #int16 valve
00025 #int16 deadband
00026 #int16 offset
00027 #int16 shift
00028 #int16 max
00029 #
00030 ## parameters for the motors
00031 #int16 motor_maxforce
00032 #int16 motor_safeforce
00033 #int16 force_p
00034 #int16 force_i
00035 #int16 force_d
00036 #int16 force_imax
00037 #int16 force_out_shift
00038 #int16 force_deadband
00039 #int16 force_offset
00040 #int16 sensor_imax
00041 #int16 sensor_deadband
00042 #int16 sensor_offset
00043 #int16 max_temperature
00044 #int16 max_current
00045
00046 string[] list_of_parameters
00047
00048 # the size of the list_of_parameters you are sending
00049 uint8 length_of_list
00050
00051
00052
00053 """
00054 __slots__ = ['contrlr_name','list_of_parameters','length_of_list']
00055 _slot_types = ['string','string[]','uint8']
00056
00057 def __init__(self, *args, **kwds):
00058 """
00059 Constructor. Any message fields that are implicitly/explicitly
00060 set to None will be assigned a default value. The recommend
00061 use is keyword arguments as this is more robust to future message
00062 changes. You cannot mix in-order arguments and keyword arguments.
00063
00064 The available fields are:
00065 contrlr_name,list_of_parameters,length_of_list
00066
00067 :param args: complete set of field values, in .msg order
00068 :param kwds: use keyword arguments corresponding to message field names
00069 to set specific fields.
00070 """
00071 if args or kwds:
00072 super(contrlr, self).__init__(*args, **kwds)
00073
00074 if self.contrlr_name is None:
00075 self.contrlr_name = ''
00076 if self.list_of_parameters is None:
00077 self.list_of_parameters = []
00078 if self.length_of_list is None:
00079 self.length_of_list = 0
00080 else:
00081 self.contrlr_name = ''
00082 self.list_of_parameters = []
00083 self.length_of_list = 0
00084
00085 def _get_types(self):
00086 """
00087 internal API method
00088 """
00089 return self._slot_types
00090
00091 def serialize(self, buff):
00092 """
00093 serialize message into buffer
00094 :param buff: buffer, ``StringIO``
00095 """
00096 try:
00097 _x = self.contrlr_name
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 length = len(self.list_of_parameters)
00104 buff.write(_struct_I.pack(length))
00105 for val1 in self.list_of_parameters:
00106 length = len(val1)
00107 if python3 or type(val1) == unicode:
00108 val1 = val1.encode('utf-8')
00109 length = len(val1)
00110 buff.write(struct.pack('<I%ss'%length, length, val1))
00111 buff.write(_struct_B.pack(self.length_of_list))
00112 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00113 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00114
00115 def deserialize(self, str):
00116 """
00117 unpack serialized message in str into this message instance
00118 :param str: byte array of serialized message, ``str``
00119 """
00120 try:
00121 end = 0
00122 start = end
00123 end += 4
00124 (length,) = _struct_I.unpack(str[start:end])
00125 start = end
00126 end += length
00127 if python3:
00128 self.contrlr_name = str[start:end].decode('utf-8')
00129 else:
00130 self.contrlr_name = str[start:end]
00131 start = end
00132 end += 4
00133 (length,) = _struct_I.unpack(str[start:end])
00134 self.list_of_parameters = []
00135 for i in range(0, length):
00136 start = end
00137 end += 4
00138 (length,) = _struct_I.unpack(str[start:end])
00139 start = end
00140 end += length
00141 if python3:
00142 val1 = str[start:end].decode('utf-8')
00143 else:
00144 val1 = str[start:end]
00145 self.list_of_parameters.append(val1)
00146 start = end
00147 end += 1
00148 (self.length_of_list,) = _struct_B.unpack(str[start:end])
00149 return self
00150 except struct.error as e:
00151 raise genpy.DeserializationError(e)
00152
00153
00154 def serialize_numpy(self, buff, numpy):
00155 """
00156 serialize message with numpy array types into buffer
00157 :param buff: buffer, ``StringIO``
00158 :param numpy: numpy python module
00159 """
00160 try:
00161 _x = self.contrlr_name
00162 length = len(_x)
00163 if python3 or type(_x) == unicode:
00164 _x = _x.encode('utf-8')
00165 length = len(_x)
00166 buff.write(struct.pack('<I%ss'%length, length, _x))
00167 length = len(self.list_of_parameters)
00168 buff.write(_struct_I.pack(length))
00169 for val1 in self.list_of_parameters:
00170 length = len(val1)
00171 if python3 or type(val1) == unicode:
00172 val1 = val1.encode('utf-8')
00173 length = len(val1)
00174 buff.write(struct.pack('<I%ss'%length, length, val1))
00175 buff.write(_struct_B.pack(self.length_of_list))
00176 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00177 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00178
00179 def deserialize_numpy(self, str, numpy):
00180 """
00181 unpack serialized message in str into this message instance using numpy for array types
00182 :param str: byte array of serialized message, ``str``
00183 :param numpy: numpy python module
00184 """
00185 try:
00186 end = 0
00187 start = end
00188 end += 4
00189 (length,) = _struct_I.unpack(str[start:end])
00190 start = end
00191 end += length
00192 if python3:
00193 self.contrlr_name = str[start:end].decode('utf-8')
00194 else:
00195 self.contrlr_name = str[start:end]
00196 start = end
00197 end += 4
00198 (length,) = _struct_I.unpack(str[start:end])
00199 self.list_of_parameters = []
00200 for i in range(0, length):
00201 start = end
00202 end += 4
00203 (length,) = _struct_I.unpack(str[start:end])
00204 start = end
00205 end += length
00206 if python3:
00207 val1 = str[start:end].decode('utf-8')
00208 else:
00209 val1 = str[start:end]
00210 self.list_of_parameters.append(val1)
00211 start = end
00212 end += 1
00213 (self.length_of_list,) = _struct_B.unpack(str[start:end])
00214 return self
00215 except struct.error as e:
00216 raise genpy.DeserializationError(e)
00217
00218 _struct_I = genpy.struct_I
00219 _struct_B = struct.Struct("<B")