$search
00001 """autogenerated by genmsg_py from RawFTData.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import ethercat_hardware.msg 00006 00007 class RawFTData(roslib.message.Message): 00008 _md5sum = "85f5ed45095367bfb8fb2e57954c0b89" 00009 _type = "ethercat_hardware/RawFTData" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """# Raw Data from WG035 F/T input via WG006 (gripper MCB). 00012 RawFTDataSample[] samples # The realtime loop receives upto 4 new samples each 1hKhz cycle 00013 int64 sample_count # Counts number of samples 00014 int64 missed_samples # Counts number of samples that were missed 00015 ================================================================================ 00016 MSG: ethercat_hardware/RawFTDataSample 00017 # One raw Data sample from WG035 F/T input via WG006 (gripper MCB). 00018 uint64 sample_count 00019 int16[] data 00020 uint16 vhalf 00021 """ 00022 __slots__ = ['samples','sample_count','missed_samples'] 00023 _slot_types = ['ethercat_hardware/RawFTDataSample[]','int64','int64'] 00024 00025 def __init__(self, *args, **kwds): 00026 """ 00027 Constructor. Any message fields that are implicitly/explicitly 00028 set to None will be assigned a default value. The recommend 00029 use is keyword arguments as this is more robust to future message 00030 changes. You cannot mix in-order arguments and keyword arguments. 00031 00032 The available fields are: 00033 samples,sample_count,missed_samples 00034 00035 @param args: complete set of field values, in .msg order 00036 @param kwds: use keyword arguments corresponding to message field names 00037 to set specific fields. 00038 """ 00039 if args or kwds: 00040 super(RawFTData, self).__init__(*args, **kwds) 00041 #message fields cannot be None, assign default values for those that are 00042 if self.samples is None: 00043 self.samples = [] 00044 if self.sample_count is None: 00045 self.sample_count = 0 00046 if self.missed_samples is None: 00047 self.missed_samples = 0 00048 else: 00049 self.samples = [] 00050 self.sample_count = 0 00051 self.missed_samples = 0 00052 00053 def _get_types(self): 00054 """ 00055 internal API method 00056 """ 00057 return self._slot_types 00058 00059 def serialize(self, buff): 00060 """ 00061 serialize message into buffer 00062 @param buff: buffer 00063 @type buff: StringIO 00064 """ 00065 try: 00066 length = len(self.samples) 00067 buff.write(_struct_I.pack(length)) 00068 for val1 in self.samples: 00069 buff.write(_struct_Q.pack(val1.sample_count)) 00070 length = len(val1.data) 00071 buff.write(_struct_I.pack(length)) 00072 pattern = '<%sh'%length 00073 buff.write(struct.pack(pattern, *val1.data)) 00074 buff.write(_struct_H.pack(val1.vhalf)) 00075 _x = self 00076 buff.write(_struct_2q.pack(_x.sample_count, _x.missed_samples)) 00077 except struct.error as se: self._check_types(se) 00078 except TypeError as te: self._check_types(te) 00079 00080 def deserialize(self, str): 00081 """ 00082 unpack serialized message in str into this message instance 00083 @param str: byte array of serialized message 00084 @type str: str 00085 """ 00086 try: 00087 end = 0 00088 start = end 00089 end += 4 00090 (length,) = _struct_I.unpack(str[start:end]) 00091 self.samples = [] 00092 for i in range(0, length): 00093 val1 = ethercat_hardware.msg.RawFTDataSample() 00094 start = end 00095 end += 8 00096 (val1.sample_count,) = _struct_Q.unpack(str[start:end]) 00097 start = end 00098 end += 4 00099 (length,) = _struct_I.unpack(str[start:end]) 00100 pattern = '<%sh'%length 00101 start = end 00102 end += struct.calcsize(pattern) 00103 val1.data = struct.unpack(pattern, str[start:end]) 00104 start = end 00105 end += 2 00106 (val1.vhalf,) = _struct_H.unpack(str[start:end]) 00107 self.samples.append(val1) 00108 _x = self 00109 start = end 00110 end += 16 00111 (_x.sample_count, _x.missed_samples,) = _struct_2q.unpack(str[start:end]) 00112 return self 00113 except struct.error as e: 00114 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00115 00116 00117 def serialize_numpy(self, buff, numpy): 00118 """ 00119 serialize message with numpy array types into buffer 00120 @param buff: buffer 00121 @type buff: StringIO 00122 @param numpy: numpy python module 00123 @type numpy module 00124 """ 00125 try: 00126 length = len(self.samples) 00127 buff.write(_struct_I.pack(length)) 00128 for val1 in self.samples: 00129 buff.write(_struct_Q.pack(val1.sample_count)) 00130 length = len(val1.data) 00131 buff.write(_struct_I.pack(length)) 00132 pattern = '<%sh'%length 00133 buff.write(val1.data.tostring()) 00134 buff.write(_struct_H.pack(val1.vhalf)) 00135 _x = self 00136 buff.write(_struct_2q.pack(_x.sample_count, _x.missed_samples)) 00137 except struct.error as se: self._check_types(se) 00138 except TypeError as te: self._check_types(te) 00139 00140 def deserialize_numpy(self, str, numpy): 00141 """ 00142 unpack serialized message in str into this message instance using numpy for array types 00143 @param str: byte array of serialized message 00144 @type str: str 00145 @param numpy: numpy python module 00146 @type numpy: module 00147 """ 00148 try: 00149 end = 0 00150 start = end 00151 end += 4 00152 (length,) = _struct_I.unpack(str[start:end]) 00153 self.samples = [] 00154 for i in range(0, length): 00155 val1 = ethercat_hardware.msg.RawFTDataSample() 00156 start = end 00157 end += 8 00158 (val1.sample_count,) = _struct_Q.unpack(str[start:end]) 00159 start = end 00160 end += 4 00161 (length,) = _struct_I.unpack(str[start:end]) 00162 pattern = '<%sh'%length 00163 start = end 00164 end += struct.calcsize(pattern) 00165 val1.data = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length) 00166 start = end 00167 end += 2 00168 (val1.vhalf,) = _struct_H.unpack(str[start:end]) 00169 self.samples.append(val1) 00170 _x = self 00171 start = end 00172 end += 16 00173 (_x.sample_count, _x.missed_samples,) = _struct_2q.unpack(str[start:end]) 00174 return self 00175 except struct.error as e: 00176 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00177 00178 _struct_I = roslib.message.struct_I 00179 _struct_Q = struct.Struct("<Q") 00180 _struct_H = struct.Struct("<H") 00181 _struct_2q = struct.Struct("<2q")