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