$search
00001 """autogenerated by genmsg_py from EthercatDebug.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import sr_robot_msgs.msg 00006 import std_msgs.msg 00007 00008 class EthercatDebug(roslib.message.Message): 00009 _md5sum = "ed9e30784a7d4571ecf4d526e7ff529f" 00010 _type = "sr_robot_msgs/EthercatDebug" 00011 _has_header = True #flag to mark the presence of a Header object 00012 _full_text = """Header header 00013 00014 int16[] sensors 00015 FromMotorDataType motor_data_type 00016 int16 which_motors 00017 int32 which_motor_data_arrived 00018 int32 which_motor_data_had_errors 00019 int16[] motor_data_packet_torque 00020 int16[] motor_data_packet_misc 00021 int32 tactile_data_type 00022 int16 tactile_data_valid 00023 int16[] tactile 00024 int16 idle_time_us 00025 00026 ================================================================================ 00027 MSG: std_msgs/Header 00028 # Standard metadata for higher-level stamped data types. 00029 # This is generally used to communicate timestamped data 00030 # in a particular coordinate frame. 00031 # 00032 # sequence ID: consecutively increasing ID 00033 uint32 seq 00034 #Two-integer timestamp that is expressed as: 00035 # * stamp.secs: seconds (stamp_secs) since epoch 00036 # * stamp.nsecs: nanoseconds since stamp_secs 00037 # time-handling sugar is provided by the client library 00038 time stamp 00039 #Frame this data is associated with 00040 # 0: no frame 00041 # 1: global frame 00042 string frame_id 00043 00044 ================================================================================ 00045 MSG: sr_robot_msgs/FromMotorDataType 00046 int16 data 00047 """ 00048 __slots__ = ['header','sensors','motor_data_type','which_motors','which_motor_data_arrived','which_motor_data_had_errors','motor_data_packet_torque','motor_data_packet_misc','tactile_data_type','tactile_data_valid','tactile','idle_time_us'] 00049 _slot_types = ['Header','int16[]','sr_robot_msgs/FromMotorDataType','int16','int32','int32','int16[]','int16[]','int32','int16','int16[]','int16'] 00050 00051 def __init__(self, *args, **kwds): 00052 """ 00053 Constructor. Any message fields that are implicitly/explicitly 00054 set to None will be assigned a default value. The recommend 00055 use is keyword arguments as this is more robust to future message 00056 changes. You cannot mix in-order arguments and keyword arguments. 00057 00058 The available fields are: 00059 header,sensors,motor_data_type,which_motors,which_motor_data_arrived,which_motor_data_had_errors,motor_data_packet_torque,motor_data_packet_misc,tactile_data_type,tactile_data_valid,tactile,idle_time_us 00060 00061 @param args: complete set of field values, in .msg order 00062 @param kwds: use keyword arguments corresponding to message field names 00063 to set specific fields. 00064 """ 00065 if args or kwds: 00066 super(EthercatDebug, self).__init__(*args, **kwds) 00067 #message fields cannot be None, assign default values for those that are 00068 if self.header is None: 00069 self.header = std_msgs.msg._Header.Header() 00070 if self.sensors is None: 00071 self.sensors = [] 00072 if self.motor_data_type is None: 00073 self.motor_data_type = sr_robot_msgs.msg.FromMotorDataType() 00074 if self.which_motors is None: 00075 self.which_motors = 0 00076 if self.which_motor_data_arrived is None: 00077 self.which_motor_data_arrived = 0 00078 if self.which_motor_data_had_errors is None: 00079 self.which_motor_data_had_errors = 0 00080 if self.motor_data_packet_torque is None: 00081 self.motor_data_packet_torque = [] 00082 if self.motor_data_packet_misc is None: 00083 self.motor_data_packet_misc = [] 00084 if self.tactile_data_type is None: 00085 self.tactile_data_type = 0 00086 if self.tactile_data_valid is None: 00087 self.tactile_data_valid = 0 00088 if self.tactile is None: 00089 self.tactile = [] 00090 if self.idle_time_us is None: 00091 self.idle_time_us = 0 00092 else: 00093 self.header = std_msgs.msg._Header.Header() 00094 self.sensors = [] 00095 self.motor_data_type = sr_robot_msgs.msg.FromMotorDataType() 00096 self.which_motors = 0 00097 self.which_motor_data_arrived = 0 00098 self.which_motor_data_had_errors = 0 00099 self.motor_data_packet_torque = [] 00100 self.motor_data_packet_misc = [] 00101 self.tactile_data_type = 0 00102 self.tactile_data_valid = 0 00103 self.tactile = [] 00104 self.idle_time_us = 0 00105 00106 def _get_types(self): 00107 """ 00108 internal API method 00109 """ 00110 return self._slot_types 00111 00112 def serialize(self, buff): 00113 """ 00114 serialize message into buffer 00115 @param buff: buffer 00116 @type buff: StringIO 00117 """ 00118 try: 00119 _x = self 00120 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00121 _x = self.header.frame_id 00122 length = len(_x) 00123 buff.write(struct.pack('<I%ss'%length, length, _x)) 00124 length = len(self.sensors) 00125 buff.write(_struct_I.pack(length)) 00126 pattern = '<%sh'%length 00127 buff.write(struct.pack(pattern, *self.sensors)) 00128 _x = self 00129 buff.write(_struct_2h2i.pack(_x.motor_data_type.data, _x.which_motors, _x.which_motor_data_arrived, _x.which_motor_data_had_errors)) 00130 length = len(self.motor_data_packet_torque) 00131 buff.write(_struct_I.pack(length)) 00132 pattern = '<%sh'%length 00133 buff.write(struct.pack(pattern, *self.motor_data_packet_torque)) 00134 length = len(self.motor_data_packet_misc) 00135 buff.write(_struct_I.pack(length)) 00136 pattern = '<%sh'%length 00137 buff.write(struct.pack(pattern, *self.motor_data_packet_misc)) 00138 _x = self 00139 buff.write(_struct_ih.pack(_x.tactile_data_type, _x.tactile_data_valid)) 00140 length = len(self.tactile) 00141 buff.write(_struct_I.pack(length)) 00142 pattern = '<%sh'%length 00143 buff.write(struct.pack(pattern, *self.tactile)) 00144 buff.write(_struct_h.pack(self.idle_time_us)) 00145 except struct.error as se: self._check_types(se) 00146 except TypeError as te: self._check_types(te) 00147 00148 def deserialize(self, str): 00149 """ 00150 unpack serialized message in str into this message instance 00151 @param str: byte array of serialized message 00152 @type str: str 00153 """ 00154 try: 00155 if self.header is None: 00156 self.header = std_msgs.msg._Header.Header() 00157 if self.motor_data_type is None: 00158 self.motor_data_type = sr_robot_msgs.msg.FromMotorDataType() 00159 end = 0 00160 _x = self 00161 start = end 00162 end += 12 00163 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00164 start = end 00165 end += 4 00166 (length,) = _struct_I.unpack(str[start:end]) 00167 start = end 00168 end += length 00169 self.header.frame_id = str[start:end] 00170 start = end 00171 end += 4 00172 (length,) = _struct_I.unpack(str[start:end]) 00173 pattern = '<%sh'%length 00174 start = end 00175 end += struct.calcsize(pattern) 00176 self.sensors = struct.unpack(pattern, str[start:end]) 00177 _x = self 00178 start = end 00179 end += 12 00180 (_x.motor_data_type.data, _x.which_motors, _x.which_motor_data_arrived, _x.which_motor_data_had_errors,) = _struct_2h2i.unpack(str[start:end]) 00181 start = end 00182 end += 4 00183 (length,) = _struct_I.unpack(str[start:end]) 00184 pattern = '<%sh'%length 00185 start = end 00186 end += struct.calcsize(pattern) 00187 self.motor_data_packet_torque = struct.unpack(pattern, str[start:end]) 00188 start = end 00189 end += 4 00190 (length,) = _struct_I.unpack(str[start:end]) 00191 pattern = '<%sh'%length 00192 start = end 00193 end += struct.calcsize(pattern) 00194 self.motor_data_packet_misc = struct.unpack(pattern, str[start:end]) 00195 _x = self 00196 start = end 00197 end += 6 00198 (_x.tactile_data_type, _x.tactile_data_valid,) = _struct_ih.unpack(str[start:end]) 00199 start = end 00200 end += 4 00201 (length,) = _struct_I.unpack(str[start:end]) 00202 pattern = '<%sh'%length 00203 start = end 00204 end += struct.calcsize(pattern) 00205 self.tactile = struct.unpack(pattern, str[start:end]) 00206 start = end 00207 end += 2 00208 (self.idle_time_us,) = _struct_h.unpack(str[start:end]) 00209 return self 00210 except struct.error as e: 00211 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00212 00213 00214 def serialize_numpy(self, buff, numpy): 00215 """ 00216 serialize message with numpy array types into buffer 00217 @param buff: buffer 00218 @type buff: StringIO 00219 @param numpy: numpy python module 00220 @type numpy module 00221 """ 00222 try: 00223 _x = self 00224 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00225 _x = self.header.frame_id 00226 length = len(_x) 00227 buff.write(struct.pack('<I%ss'%length, length, _x)) 00228 length = len(self.sensors) 00229 buff.write(_struct_I.pack(length)) 00230 pattern = '<%sh'%length 00231 buff.write(self.sensors.tostring()) 00232 _x = self 00233 buff.write(_struct_2h2i.pack(_x.motor_data_type.data, _x.which_motors, _x.which_motor_data_arrived, _x.which_motor_data_had_errors)) 00234 length = len(self.motor_data_packet_torque) 00235 buff.write(_struct_I.pack(length)) 00236 pattern = '<%sh'%length 00237 buff.write(self.motor_data_packet_torque.tostring()) 00238 length = len(self.motor_data_packet_misc) 00239 buff.write(_struct_I.pack(length)) 00240 pattern = '<%sh'%length 00241 buff.write(self.motor_data_packet_misc.tostring()) 00242 _x = self 00243 buff.write(_struct_ih.pack(_x.tactile_data_type, _x.tactile_data_valid)) 00244 length = len(self.tactile) 00245 buff.write(_struct_I.pack(length)) 00246 pattern = '<%sh'%length 00247 buff.write(self.tactile.tostring()) 00248 buff.write(_struct_h.pack(self.idle_time_us)) 00249 except struct.error as se: self._check_types(se) 00250 except TypeError as te: self._check_types(te) 00251 00252 def deserialize_numpy(self, str, numpy): 00253 """ 00254 unpack serialized message in str into this message instance using numpy for array types 00255 @param str: byte array of serialized message 00256 @type str: str 00257 @param numpy: numpy python module 00258 @type numpy: module 00259 """ 00260 try: 00261 if self.header is None: 00262 self.header = std_msgs.msg._Header.Header() 00263 if self.motor_data_type is None: 00264 self.motor_data_type = sr_robot_msgs.msg.FromMotorDataType() 00265 end = 0 00266 _x = self 00267 start = end 00268 end += 12 00269 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00270 start = end 00271 end += 4 00272 (length,) = _struct_I.unpack(str[start:end]) 00273 start = end 00274 end += length 00275 self.header.frame_id = str[start:end] 00276 start = end 00277 end += 4 00278 (length,) = _struct_I.unpack(str[start:end]) 00279 pattern = '<%sh'%length 00280 start = end 00281 end += struct.calcsize(pattern) 00282 self.sensors = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length) 00283 _x = self 00284 start = end 00285 end += 12 00286 (_x.motor_data_type.data, _x.which_motors, _x.which_motor_data_arrived, _x.which_motor_data_had_errors,) = _struct_2h2i.unpack(str[start:end]) 00287 start = end 00288 end += 4 00289 (length,) = _struct_I.unpack(str[start:end]) 00290 pattern = '<%sh'%length 00291 start = end 00292 end += struct.calcsize(pattern) 00293 self.motor_data_packet_torque = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length) 00294 start = end 00295 end += 4 00296 (length,) = _struct_I.unpack(str[start:end]) 00297 pattern = '<%sh'%length 00298 start = end 00299 end += struct.calcsize(pattern) 00300 self.motor_data_packet_misc = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length) 00301 _x = self 00302 start = end 00303 end += 6 00304 (_x.tactile_data_type, _x.tactile_data_valid,) = _struct_ih.unpack(str[start:end]) 00305 start = end 00306 end += 4 00307 (length,) = _struct_I.unpack(str[start:end]) 00308 pattern = '<%sh'%length 00309 start = end 00310 end += struct.calcsize(pattern) 00311 self.tactile = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length) 00312 start = end 00313 end += 2 00314 (self.idle_time_us,) = _struct_h.unpack(str[start:end]) 00315 return self 00316 except struct.error as e: 00317 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00318 00319 _struct_I = roslib.message.struct_I 00320 _struct_ih = struct.Struct("<ih") 00321 _struct_3I = struct.Struct("<3I") 00322 _struct_2h2i = struct.Struct("<2h2i") 00323 _struct_h = struct.Struct("<h")