_HysteresisRun.py
Go to the documentation of this file.
00001 """autogenerated by genpy from joint_qualification_controllers/HysteresisRun.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class HysteresisRun(genpy.Message):
00009   _md5sum = "53b5a9cc98e4aeb9e2e39c07ea2a59f5"
00010   _type = "joint_qualification_controllers/HysteresisRun"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """float32[] time
00013 float32[] effort
00014 float32[] position
00015 float32[] velocity
00016 uint8 dir
00017 uint8 UP=0
00018 uint8 DOWN=1
00019 
00020 """
00021   # Pseudo-constants
00022   UP = 0
00023   DOWN = 1
00024 
00025   __slots__ = ['time','effort','position','velocity','dir']
00026   _slot_types = ['float32[]','float32[]','float32[]','float32[]','uint8']
00027 
00028   def __init__(self, *args, **kwds):
00029     """
00030     Constructor. Any message fields that are implicitly/explicitly
00031     set to None will be assigned a default value. The recommend
00032     use is keyword arguments as this is more robust to future message
00033     changes.  You cannot mix in-order arguments and keyword arguments.
00034 
00035     The available fields are:
00036        time,effort,position,velocity,dir
00037 
00038     :param args: complete set of field values, in .msg order
00039     :param kwds: use keyword arguments corresponding to message field names
00040     to set specific fields.
00041     """
00042     if args or kwds:
00043       super(HysteresisRun, self).__init__(*args, **kwds)
00044       #message fields cannot be None, assign default values for those that are
00045       if self.time is None:
00046         self.time = []
00047       if self.effort is None:
00048         self.effort = []
00049       if self.position is None:
00050         self.position = []
00051       if self.velocity is None:
00052         self.velocity = []
00053       if self.dir is None:
00054         self.dir = 0
00055     else:
00056       self.time = []
00057       self.effort = []
00058       self.position = []
00059       self.velocity = []
00060       self.dir = 0
00061 
00062   def _get_types(self):
00063     """
00064     internal API method
00065     """
00066     return self._slot_types
00067 
00068   def serialize(self, buff):
00069     """
00070     serialize message into buffer
00071     :param buff: buffer, ``StringIO``
00072     """
00073     try:
00074       length = len(self.time)
00075       buff.write(_struct_I.pack(length))
00076       pattern = '<%sf'%length
00077       buff.write(struct.pack(pattern, *self.time))
00078       length = len(self.effort)
00079       buff.write(_struct_I.pack(length))
00080       pattern = '<%sf'%length
00081       buff.write(struct.pack(pattern, *self.effort))
00082       length = len(self.position)
00083       buff.write(_struct_I.pack(length))
00084       pattern = '<%sf'%length
00085       buff.write(struct.pack(pattern, *self.position))
00086       length = len(self.velocity)
00087       buff.write(_struct_I.pack(length))
00088       pattern = '<%sf'%length
00089       buff.write(struct.pack(pattern, *self.velocity))
00090       buff.write(_struct_B.pack(self.dir))
00091     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00092     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00093 
00094   def deserialize(self, str):
00095     """
00096     unpack serialized message in str into this message instance
00097     :param str: byte array of serialized message, ``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 genpy.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, ``StringIO``
00141     :param numpy: numpy python module
00142     """
00143     try:
00144       length = len(self.time)
00145       buff.write(_struct_I.pack(length))
00146       pattern = '<%sf'%length
00147       buff.write(self.time.tostring())
00148       length = len(self.effort)
00149       buff.write(_struct_I.pack(length))
00150       pattern = '<%sf'%length
00151       buff.write(self.effort.tostring())
00152       length = len(self.position)
00153       buff.write(_struct_I.pack(length))
00154       pattern = '<%sf'%length
00155       buff.write(self.position.tostring())
00156       length = len(self.velocity)
00157       buff.write(_struct_I.pack(length))
00158       pattern = '<%sf'%length
00159       buff.write(self.velocity.tostring())
00160       buff.write(_struct_B.pack(self.dir))
00161     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00162     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00163 
00164   def deserialize_numpy(self, str, numpy):
00165     """
00166     unpack serialized message in str into this message instance using numpy for array types
00167     :param str: byte array of serialized message, ``str``
00168     :param numpy: numpy python module
00169     """
00170     try:
00171       end = 0
00172       start = end
00173       end += 4
00174       (length,) = _struct_I.unpack(str[start:end])
00175       pattern = '<%sf'%length
00176       start = end
00177       end += struct.calcsize(pattern)
00178       self.time = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00179       start = end
00180       end += 4
00181       (length,) = _struct_I.unpack(str[start:end])
00182       pattern = '<%sf'%length
00183       start = end
00184       end += struct.calcsize(pattern)
00185       self.effort = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00186       start = end
00187       end += 4
00188       (length,) = _struct_I.unpack(str[start:end])
00189       pattern = '<%sf'%length
00190       start = end
00191       end += struct.calcsize(pattern)
00192       self.position = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00193       start = end
00194       end += 4
00195       (length,) = _struct_I.unpack(str[start:end])
00196       pattern = '<%sf'%length
00197       start = end
00198       end += struct.calcsize(pattern)
00199       self.velocity = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00200       start = end
00201       end += 1
00202       (self.dir,) = _struct_B.unpack(str[start:end])
00203       return self
00204     except struct.error as e:
00205       raise genpy.DeserializationError(e) #most likely buffer underfill
00206 
00207 _struct_I = genpy.struct_I
00208 _struct_B = struct.Struct("<B")


joint_qualification_controllers
Author(s): Kevin Watts, Melonee Wise
autogenerated on Tue Apr 22 2014 19:39:16