_JointConstraint.py
Go to the documentation of this file.
00001 """autogenerated by genpy from brics_actuator/JointConstraint.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import brics_actuator.msg
00008 import genpy
00009 
00010 class JointConstraint(genpy.Message):
00011   _md5sum = "f77db04949b26b64f80564df22f00ecb"
00012   _type = "brics_actuator/JointConstraint"
00013   _has_header = False #flag to mark the presence of a Header object
00014   _full_text = """string type           #smaller, greater, equal or <, >, =
00015 JointValue value
00016 
00017 ================================================================================
00018 MSG: brics_actuator/JointValue
00019 time timeStamp          #time of the data 
00020 string joint_uri
00021 string unit             #if empy expects si units, you can use boost::unit
00022 float64 value
00023 
00024 """
00025   __slots__ = ['type','value']
00026   _slot_types = ['string','brics_actuator/JointValue']
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        type,value
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(JointConstraint, self).__init__(*args, **kwds)
00044       #message fields cannot be None, assign default values for those that are
00045       if self.type is None:
00046         self.type = ''
00047       if self.value is None:
00048         self.value = brics_actuator.msg.JointValue()
00049     else:
00050       self.type = ''
00051       self.value = brics_actuator.msg.JointValue()
00052 
00053   def _get_types(self):
00054     """
00055     internal API method
00056     """
00057     return self._slot_types
00058 
00059   def serialize(self, buff):
00060     """
00061     serialize message into buffer
00062     :param buff: buffer, ``StringIO``
00063     """
00064     try:
00065       _x = self.type
00066       length = len(_x)
00067       if python3 or type(_x) == unicode:
00068         _x = _x.encode('utf-8')
00069         length = len(_x)
00070       buff.write(struct.pack('<I%ss'%length, length, _x))
00071       _x = self
00072       buff.write(_struct_2I.pack(_x.value.timeStamp.secs, _x.value.timeStamp.nsecs))
00073       _x = self.value.joint_uri
00074       length = len(_x)
00075       if python3 or type(_x) == unicode:
00076         _x = _x.encode('utf-8')
00077         length = len(_x)
00078       buff.write(struct.pack('<I%ss'%length, length, _x))
00079       _x = self.value.unit
00080       length = len(_x)
00081       if python3 or type(_x) == unicode:
00082         _x = _x.encode('utf-8')
00083         length = len(_x)
00084       buff.write(struct.pack('<I%ss'%length, length, _x))
00085       buff.write(_struct_d.pack(self.value.value))
00086     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00087     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00088 
00089   def deserialize(self, str):
00090     """
00091     unpack serialized message in str into this message instance
00092     :param str: byte array of serialized message, ``str``
00093     """
00094     try:
00095       if self.value is None:
00096         self.value = brics_actuator.msg.JointValue()
00097       end = 0
00098       start = end
00099       end += 4
00100       (length,) = _struct_I.unpack(str[start:end])
00101       start = end
00102       end += length
00103       if python3:
00104         self.type = str[start:end].decode('utf-8')
00105       else:
00106         self.type = str[start:end]
00107       _x = self
00108       start = end
00109       end += 8
00110       (_x.value.timeStamp.secs, _x.value.timeStamp.nsecs,) = _struct_2I.unpack(str[start:end])
00111       start = end
00112       end += 4
00113       (length,) = _struct_I.unpack(str[start:end])
00114       start = end
00115       end += length
00116       if python3:
00117         self.value.joint_uri = str[start:end].decode('utf-8')
00118       else:
00119         self.value.joint_uri = str[start:end]
00120       start = end
00121       end += 4
00122       (length,) = _struct_I.unpack(str[start:end])
00123       start = end
00124       end += length
00125       if python3:
00126         self.value.unit = str[start:end].decode('utf-8')
00127       else:
00128         self.value.unit = str[start:end]
00129       start = end
00130       end += 8
00131       (self.value.value,) = _struct_d.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       _x = self.type
00145       length = len(_x)
00146       if python3 or type(_x) == unicode:
00147         _x = _x.encode('utf-8')
00148         length = len(_x)
00149       buff.write(struct.pack('<I%ss'%length, length, _x))
00150       _x = self
00151       buff.write(_struct_2I.pack(_x.value.timeStamp.secs, _x.value.timeStamp.nsecs))
00152       _x = self.value.joint_uri
00153       length = len(_x)
00154       if python3 or type(_x) == unicode:
00155         _x = _x.encode('utf-8')
00156         length = len(_x)
00157       buff.write(struct.pack('<I%ss'%length, length, _x))
00158       _x = self.value.unit
00159       length = len(_x)
00160       if python3 or type(_x) == unicode:
00161         _x = _x.encode('utf-8')
00162         length = len(_x)
00163       buff.write(struct.pack('<I%ss'%length, length, _x))
00164       buff.write(_struct_d.pack(self.value.value))
00165     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00166     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00167 
00168   def deserialize_numpy(self, str, numpy):
00169     """
00170     unpack serialized message in str into this message instance using numpy for array types
00171     :param str: byte array of serialized message, ``str``
00172     :param numpy: numpy python module
00173     """
00174     try:
00175       if self.value is None:
00176         self.value = brics_actuator.msg.JointValue()
00177       end = 0
00178       start = end
00179       end += 4
00180       (length,) = _struct_I.unpack(str[start:end])
00181       start = end
00182       end += length
00183       if python3:
00184         self.type = str[start:end].decode('utf-8')
00185       else:
00186         self.type = str[start:end]
00187       _x = self
00188       start = end
00189       end += 8
00190       (_x.value.timeStamp.secs, _x.value.timeStamp.nsecs,) = _struct_2I.unpack(str[start:end])
00191       start = end
00192       end += 4
00193       (length,) = _struct_I.unpack(str[start:end])
00194       start = end
00195       end += length
00196       if python3:
00197         self.value.joint_uri = str[start:end].decode('utf-8')
00198       else:
00199         self.value.joint_uri = str[start:end]
00200       start = end
00201       end += 4
00202       (length,) = _struct_I.unpack(str[start:end])
00203       start = end
00204       end += length
00205       if python3:
00206         self.value.unit = str[start:end].decode('utf-8')
00207       else:
00208         self.value.unit = str[start:end]
00209       start = end
00210       end += 8
00211       (self.value.value,) = _struct_d.unpack(str[start:end])
00212       return self
00213     except struct.error as e:
00214       raise genpy.DeserializationError(e) #most likely buffer underfill
00215 
00216 _struct_I = genpy.struct_I
00217 _struct_2I = struct.Struct("<2I")
00218 _struct_d = struct.Struct("<d")


brics_actuator
Author(s): Alexander Bubeck
autogenerated on Sun Oct 5 2014 22:58:19