_JointCapability.py
Go to the documentation of this file.
00001 """autogenerated by genpy from nasa_r2_common_msgs/JointCapability.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 JointCapability(genpy.Message):
00009   _md5sum = "40d391c05ffb602d44b6aec475271b97"
00010   _type = "nasa_r2_common_msgs/JointCapability"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string[] name
00013 float64[] positionLimitMax
00014 float64[] positionLimitMin
00015 float64[] torqueLimit
00016 """
00017   __slots__ = ['name','positionLimitMax','positionLimitMin','torqueLimit']
00018   _slot_types = ['string[]','float64[]','float64[]','float64[]']
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        name,positionLimitMax,positionLimitMin,torqueLimit
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(JointCapability, self).__init__(*args, **kwds)
00036       #message fields cannot be None, assign default values for those that are
00037       if self.name is None:
00038         self.name = []
00039       if self.positionLimitMax is None:
00040         self.positionLimitMax = []
00041       if self.positionLimitMin is None:
00042         self.positionLimitMin = []
00043       if self.torqueLimit is None:
00044         self.torqueLimit = []
00045     else:
00046       self.name = []
00047       self.positionLimitMax = []
00048       self.positionLimitMin = []
00049       self.torqueLimit = []
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.name)
00064       buff.write(_struct_I.pack(length))
00065       for val1 in self.name:
00066         length = len(val1)
00067         if python3 or type(val1) == unicode:
00068           val1 = val1.encode('utf-8')
00069           length = len(val1)
00070         buff.write(struct.pack('<I%ss'%length, length, val1))
00071       length = len(self.positionLimitMax)
00072       buff.write(_struct_I.pack(length))
00073       pattern = '<%sd'%length
00074       buff.write(struct.pack(pattern, *self.positionLimitMax))
00075       length = len(self.positionLimitMin)
00076       buff.write(_struct_I.pack(length))
00077       pattern = '<%sd'%length
00078       buff.write(struct.pack(pattern, *self.positionLimitMin))
00079       length = len(self.torqueLimit)
00080       buff.write(_struct_I.pack(length))
00081       pattern = '<%sd'%length
00082       buff.write(struct.pack(pattern, *self.torqueLimit))
00083     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00084     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00085 
00086   def deserialize(self, str):
00087     """
00088     unpack serialized message in str into this message instance
00089     :param str: byte array of serialized message, ``str``
00090     """
00091     try:
00092       end = 0
00093       start = end
00094       end += 4
00095       (length,) = _struct_I.unpack(str[start:end])
00096       self.name = []
00097       for i in range(0, length):
00098         start = end
00099         end += 4
00100         (length,) = _struct_I.unpack(str[start:end])
00101         start = end
00102         end += length
00103         if python3:
00104           val1 = str[start:end].decode('utf-8')
00105         else:
00106           val1 = str[start:end]
00107         self.name.append(val1)
00108       start = end
00109       end += 4
00110       (length,) = _struct_I.unpack(str[start:end])
00111       pattern = '<%sd'%length
00112       start = end
00113       end += struct.calcsize(pattern)
00114       self.positionLimitMax = struct.unpack(pattern, str[start:end])
00115       start = end
00116       end += 4
00117       (length,) = _struct_I.unpack(str[start:end])
00118       pattern = '<%sd'%length
00119       start = end
00120       end += struct.calcsize(pattern)
00121       self.positionLimitMin = struct.unpack(pattern, str[start:end])
00122       start = end
00123       end += 4
00124       (length,) = _struct_I.unpack(str[start:end])
00125       pattern = '<%sd'%length
00126       start = end
00127       end += struct.calcsize(pattern)
00128       self.torqueLimit = struct.unpack(pattern, str[start:end])
00129       return self
00130     except struct.error as e:
00131       raise genpy.DeserializationError(e) #most likely buffer underfill
00132 
00133 
00134   def serialize_numpy(self, buff, numpy):
00135     """
00136     serialize message with numpy array types into buffer
00137     :param buff: buffer, ``StringIO``
00138     :param numpy: numpy python module
00139     """
00140     try:
00141       length = len(self.name)
00142       buff.write(_struct_I.pack(length))
00143       for val1 in self.name:
00144         length = len(val1)
00145         if python3 or type(val1) == unicode:
00146           val1 = val1.encode('utf-8')
00147           length = len(val1)
00148         buff.write(struct.pack('<I%ss'%length, length, val1))
00149       length = len(self.positionLimitMax)
00150       buff.write(_struct_I.pack(length))
00151       pattern = '<%sd'%length
00152       buff.write(self.positionLimitMax.tostring())
00153       length = len(self.positionLimitMin)
00154       buff.write(_struct_I.pack(length))
00155       pattern = '<%sd'%length
00156       buff.write(self.positionLimitMin.tostring())
00157       length = len(self.torqueLimit)
00158       buff.write(_struct_I.pack(length))
00159       pattern = '<%sd'%length
00160       buff.write(self.torqueLimit.tostring())
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       self.name = []
00176       for i in range(0, length):
00177         start = end
00178         end += 4
00179         (length,) = _struct_I.unpack(str[start:end])
00180         start = end
00181         end += length
00182         if python3:
00183           val1 = str[start:end].decode('utf-8')
00184         else:
00185           val1 = str[start:end]
00186         self.name.append(val1)
00187       start = end
00188       end += 4
00189       (length,) = _struct_I.unpack(str[start:end])
00190       pattern = '<%sd'%length
00191       start = end
00192       end += struct.calcsize(pattern)
00193       self.positionLimitMax = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00194       start = end
00195       end += 4
00196       (length,) = _struct_I.unpack(str[start:end])
00197       pattern = '<%sd'%length
00198       start = end
00199       end += struct.calcsize(pattern)
00200       self.positionLimitMin = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00201       start = end
00202       end += 4
00203       (length,) = _struct_I.unpack(str[start:end])
00204       pattern = '<%sd'%length
00205       start = end
00206       end += struct.calcsize(pattern)
00207       self.torqueLimit = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00208       return self
00209     except struct.error as e:
00210       raise genpy.DeserializationError(e) #most likely buffer underfill
00211 
00212 _struct_I = genpy.struct_I


nasa_r2_common_msgs
Author(s): Paul Dinh. Maintained by Jennifer Turner
autogenerated on Mon Oct 6 2014 02:42:34