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