$search
00001 """autogenerated by genmsg_py from HysteresisRun.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class HysteresisRun(roslib.message.Message): 00007 _md5sum = "53b5a9cc98e4aeb9e2e39c07ea2a59f5" 00008 _type = "joint_qualification_controllers/HysteresisRun" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """float32[] time 00011 float32[] effort 00012 float32[] position 00013 float32[] velocity 00014 uint8 dir 00015 uint8 UP=0 00016 uint8 DOWN=1 00017 00018 """ 00019 # Pseudo-constants 00020 UP = 0 00021 DOWN = 1 00022 00023 __slots__ = ['time','effort','position','velocity','dir'] 00024 _slot_types = ['float32[]','float32[]','float32[]','float32[]','uint8'] 00025 00026 def __init__(self, *args, **kwds): 00027 """ 00028 Constructor. Any message fields that are implicitly/explicitly 00029 set to None will be assigned a default value. The recommend 00030 use is keyword arguments as this is more robust to future message 00031 changes. You cannot mix in-order arguments and keyword arguments. 00032 00033 The available fields are: 00034 time,effort,position,velocity,dir 00035 00036 @param args: complete set of field values, in .msg order 00037 @param kwds: use keyword arguments corresponding to message field names 00038 to set specific fields. 00039 """ 00040 if args or kwds: 00041 super(HysteresisRun, self).__init__(*args, **kwds) 00042 #message fields cannot be None, assign default values for those that are 00043 if self.time is None: 00044 self.time = [] 00045 if self.effort is None: 00046 self.effort = [] 00047 if self.position is None: 00048 self.position = [] 00049 if self.velocity is None: 00050 self.velocity = [] 00051 if self.dir is None: 00052 self.dir = 0 00053 else: 00054 self.time = [] 00055 self.effort = [] 00056 self.position = [] 00057 self.velocity = [] 00058 self.dir = 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 length = len(self.time) 00074 buff.write(_struct_I.pack(length)) 00075 pattern = '<%sf'%length 00076 buff.write(struct.pack(pattern, *self.time)) 00077 length = len(self.effort) 00078 buff.write(_struct_I.pack(length)) 00079 pattern = '<%sf'%length 00080 buff.write(struct.pack(pattern, *self.effort)) 00081 length = len(self.position) 00082 buff.write(_struct_I.pack(length)) 00083 pattern = '<%sf'%length 00084 buff.write(struct.pack(pattern, *self.position)) 00085 length = len(self.velocity) 00086 buff.write(_struct_I.pack(length)) 00087 pattern = '<%sf'%length 00088 buff.write(struct.pack(pattern, *self.velocity)) 00089 buff.write(_struct_B.pack(self.dir)) 00090 except struct.error as se: self._check_types(se) 00091 except TypeError as te: self._check_types(te) 00092 00093 def deserialize(self, str): 00094 """ 00095 unpack serialized message in str into this message instance 00096 @param str: byte array of serialized message 00097 @type str: str 00098 """ 00099 try: 00100 end = 0 00101 start = end 00102 end += 4 00103 (length,) = _struct_I.unpack(str[start:end]) 00104 pattern = '<%sf'%length 00105 start = end 00106 end += struct.calcsize(pattern) 00107 self.time = struct.unpack(pattern, str[start:end]) 00108 start = end 00109 end += 4 00110 (length,) = _struct_I.unpack(str[start:end]) 00111 pattern = '<%sf'%length 00112 start = end 00113 end += struct.calcsize(pattern) 00114 self.effort = struct.unpack(pattern, str[start:end]) 00115 start = end 00116 end += 4 00117 (length,) = _struct_I.unpack(str[start:end]) 00118 pattern = '<%sf'%length 00119 start = end 00120 end += struct.calcsize(pattern) 00121 self.position = struct.unpack(pattern, str[start:end]) 00122 start = end 00123 end += 4 00124 (length,) = _struct_I.unpack(str[start:end]) 00125 pattern = '<%sf'%length 00126 start = end 00127 end += struct.calcsize(pattern) 00128 self.velocity = struct.unpack(pattern, str[start:end]) 00129 start = end 00130 end += 1 00131 (self.dir,) = _struct_B.unpack(str[start:end]) 00132 return self 00133 except struct.error as e: 00134 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00135 00136 00137 def serialize_numpy(self, buff, numpy): 00138 """ 00139 serialize message with numpy array types into buffer 00140 @param buff: buffer 00141 @type buff: StringIO 00142 @param numpy: numpy python module 00143 @type numpy module 00144 """ 00145 try: 00146 length = len(self.time) 00147 buff.write(_struct_I.pack(length)) 00148 pattern = '<%sf'%length 00149 buff.write(self.time.tostring()) 00150 length = len(self.effort) 00151 buff.write(_struct_I.pack(length)) 00152 pattern = '<%sf'%length 00153 buff.write(self.effort.tostring()) 00154 length = len(self.position) 00155 buff.write(_struct_I.pack(length)) 00156 pattern = '<%sf'%length 00157 buff.write(self.position.tostring()) 00158 length = len(self.velocity) 00159 buff.write(_struct_I.pack(length)) 00160 pattern = '<%sf'%length 00161 buff.write(self.velocity.tostring()) 00162 buff.write(_struct_B.pack(self.dir)) 00163 except struct.error as se: self._check_types(se) 00164 except TypeError as te: self._check_types(te) 00165 00166 def deserialize_numpy(self, str, numpy): 00167 """ 00168 unpack serialized message in str into this message instance using numpy for array types 00169 @param str: byte array of serialized message 00170 @type str: str 00171 @param numpy: numpy python module 00172 @type numpy: module 00173 """ 00174 try: 00175 end = 0 00176 start = end 00177 end += 4 00178 (length,) = _struct_I.unpack(str[start:end]) 00179 pattern = '<%sf'%length 00180 start = end 00181 end += struct.calcsize(pattern) 00182 self.time = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 00183 start = end 00184 end += 4 00185 (length,) = _struct_I.unpack(str[start:end]) 00186 pattern = '<%sf'%length 00187 start = end 00188 end += struct.calcsize(pattern) 00189 self.effort = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 00190 start = end 00191 end += 4 00192 (length,) = _struct_I.unpack(str[start:end]) 00193 pattern = '<%sf'%length 00194 start = end 00195 end += struct.calcsize(pattern) 00196 self.position = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 00197 start = end 00198 end += 4 00199 (length,) = _struct_I.unpack(str[start:end]) 00200 pattern = '<%sf'%length 00201 start = end 00202 end += struct.calcsize(pattern) 00203 self.velocity = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 00204 start = end 00205 end += 1 00206 (self.dir,) = _struct_B.unpack(str[start:end]) 00207 return self 00208 except struct.error as e: 00209 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00210 00211 _struct_I = roslib.message.struct_I 00212 _struct_B = struct.Struct("<B")