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