_JointPositionData.py
Go to the documentation of this file.
00001 """autogenerated by genpy from joint_qualification_controllers/JointPositionData.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 JointPositionData(genpy.Message):
00009   _md5sum = "20b7d551f5d22afac44b59b748c57bdb"
00010   _type = "joint_qualification_controllers/JointPositionData"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """float32[] time
00013 float32[] position
00014 float32[] velocity
00015 float32[] effort
00016 """
00017   __slots__ = ['time','position','velocity','effort']
00018   _slot_types = ['float32[]','float32[]','float32[]','float32[]']
00019 
00020   def __init__(self, *args, **kwds):
00021     """
00022     Constructor. Any message fields that are implicitly/explicitly
00023     set to None will be assigned a default value. The recommend
00024     use is keyword arguments as this is more robust to future message
00025     changes.  You cannot mix in-order arguments and keyword arguments.
00026 
00027     The available fields are:
00028        time,position,velocity,effort
00029 
00030     :param args: complete set of field values, in .msg order
00031     :param kwds: use keyword arguments corresponding to message field names
00032     to set specific fields.
00033     """
00034     if args or kwds:
00035       super(JointPositionData, self).__init__(*args, **kwds)
00036       #message fields cannot be None, assign default values for those that are
00037       if self.time is None:
00038         self.time = []
00039       if self.position is None:
00040         self.position = []
00041       if self.velocity is None:
00042         self.velocity = []
00043       if self.effort is None:
00044         self.effort = []
00045     else:
00046       self.time = []
00047       self.position = []
00048       self.velocity = []
00049       self.effort = []
00050 
00051   def _get_types(self):
00052     """
00053     internal API method
00054     """
00055     return self._slot_types
00056 
00057   def serialize(self, buff):
00058     """
00059     serialize message into buffer
00060     :param buff: buffer, ``StringIO``
00061     """
00062     try:
00063       length = len(self.time)
00064       buff.write(_struct_I.pack(length))
00065       pattern = '<%sf'%length
00066       buff.write(struct.pack(pattern, *self.time))
00067       length = len(self.position)
00068       buff.write(_struct_I.pack(length))
00069       pattern = '<%sf'%length
00070       buff.write(struct.pack(pattern, *self.position))
00071       length = len(self.velocity)
00072       buff.write(_struct_I.pack(length))
00073       pattern = '<%sf'%length
00074       buff.write(struct.pack(pattern, *self.velocity))
00075       length = len(self.effort)
00076       buff.write(_struct_I.pack(length))
00077       pattern = '<%sf'%length
00078       buff.write(struct.pack(pattern, *self.effort))
00079     except struct.error as se: self._check_types(se)
00080     except TypeError as te: self._check_types(te)
00081 
00082   def deserialize(self, str):
00083     """
00084     unpack serialized message in str into this message instance
00085     :param str: byte array of serialized message, ``str``
00086     """
00087     try:
00088       end = 0
00089       start = end
00090       end += 4
00091       (length,) = _struct_I.unpack(str[start:end])
00092       pattern = '<%sf'%length
00093       start = end
00094       end += struct.calcsize(pattern)
00095       self.time = struct.unpack(pattern, str[start:end])
00096       start = end
00097       end += 4
00098       (length,) = _struct_I.unpack(str[start:end])
00099       pattern = '<%sf'%length
00100       start = end
00101       end += struct.calcsize(pattern)
00102       self.position = struct.unpack(pattern, str[start:end])
00103       start = end
00104       end += 4
00105       (length,) = _struct_I.unpack(str[start:end])
00106       pattern = '<%sf'%length
00107       start = end
00108       end += struct.calcsize(pattern)
00109       self.velocity = struct.unpack(pattern, str[start:end])
00110       start = end
00111       end += 4
00112       (length,) = _struct_I.unpack(str[start:end])
00113       pattern = '<%sf'%length
00114       start = end
00115       end += struct.calcsize(pattern)
00116       self.effort = struct.unpack(pattern, str[start:end])
00117       return self
00118     except struct.error as e:
00119       raise genpy.DeserializationError(e) #most likely buffer underfill
00120 
00121 
00122   def serialize_numpy(self, buff, numpy):
00123     """
00124     serialize message with numpy array types into buffer
00125     :param buff: buffer, ``StringIO``
00126     :param numpy: numpy python module
00127     """
00128     try:
00129       length = len(self.time)
00130       buff.write(_struct_I.pack(length))
00131       pattern = '<%sf'%length
00132       buff.write(self.time.tostring())
00133       length = len(self.position)
00134       buff.write(_struct_I.pack(length))
00135       pattern = '<%sf'%length
00136       buff.write(self.position.tostring())
00137       length = len(self.velocity)
00138       buff.write(_struct_I.pack(length))
00139       pattern = '<%sf'%length
00140       buff.write(self.velocity.tostring())
00141       length = len(self.effort)
00142       buff.write(_struct_I.pack(length))
00143       pattern = '<%sf'%length
00144       buff.write(self.effort.tostring())
00145     except struct.error as se: self._check_types(se)
00146     except TypeError as te: self._check_types(te)
00147 
00148   def deserialize_numpy(self, str, numpy):
00149     """
00150     unpack serialized message in str into this message instance using numpy for array types
00151     :param str: byte array of serialized message, ``str``
00152     :param numpy: numpy python module
00153     """
00154     try:
00155       end = 0
00156       start = end
00157       end += 4
00158       (length,) = _struct_I.unpack(str[start:end])
00159       pattern = '<%sf'%length
00160       start = end
00161       end += struct.calcsize(pattern)
00162       self.time = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00163       start = end
00164       end += 4
00165       (length,) = _struct_I.unpack(str[start:end])
00166       pattern = '<%sf'%length
00167       start = end
00168       end += struct.calcsize(pattern)
00169       self.position = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00170       start = end
00171       end += 4
00172       (length,) = _struct_I.unpack(str[start:end])
00173       pattern = '<%sf'%length
00174       start = end
00175       end += struct.calcsize(pattern)
00176       self.velocity = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00177       start = end
00178       end += 4
00179       (length,) = _struct_I.unpack(str[start:end])
00180       pattern = '<%sf'%length
00181       start = end
00182       end += struct.calcsize(pattern)
00183       self.effort = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00184       return self
00185     except struct.error as e:
00186       raise genpy.DeserializationError(e) #most likely buffer underfill
00187 
00188 _struct_I = genpy.struct_I


joint_qualification_controllers
Author(s): Kevin Watts, Melonee Wise
autogenerated on Sat Dec 28 2013 17:29:55