_JointConstraint.py
Go to the documentation of this file.
00001 """autogenerated by genpy from arm_navigation_msgs/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 
00008 class JointConstraint(genpy.Message):
00009   _md5sum = "c02a15146bec0ce13564807805b008f0"
00010   _type = "arm_navigation_msgs/JointConstraint"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# Constrain the position of a joint to be within a certain bound
00013 string joint_name
00014 
00015 # the bound to be achieved is [position - tolerance_below, position + tolerance_above]
00016 float64 position
00017 float64 tolerance_above
00018 float64 tolerance_below
00019 
00020 # A weighting factor for this constraint
00021 float64 weight
00022 """
00023   __slots__ = ['joint_name','position','tolerance_above','tolerance_below','weight']
00024   _slot_types = ['string','float64','float64','float64','float64']
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        joint_name,position,tolerance_above,tolerance_below,weight
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(JointConstraint, self).__init__(*args, **kwds)
00042       #message fields cannot be None, assign default values for those that are
00043       if self.joint_name is None:
00044         self.joint_name = ''
00045       if self.position is None:
00046         self.position = 0.
00047       if self.tolerance_above is None:
00048         self.tolerance_above = 0.
00049       if self.tolerance_below is None:
00050         self.tolerance_below = 0.
00051       if self.weight is None:
00052         self.weight = 0.
00053     else:
00054       self.joint_name = ''
00055       self.position = 0.
00056       self.tolerance_above = 0.
00057       self.tolerance_below = 0.
00058       self.weight = 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, ``StringIO``
00070     """
00071     try:
00072       _x = self.joint_name
00073       length = len(_x)
00074       if python3 or type(_x) == unicode:
00075         _x = _x.encode('utf-8')
00076         length = len(_x)
00077       buff.write(struct.pack('<I%ss'%length, length, _x))
00078       _x = self
00079       buff.write(_struct_4d.pack(_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight))
00080     except struct.error as se: self._check_types(se)
00081     except TypeError as te: self._check_types(te)
00082 
00083   def deserialize(self, str):
00084     """
00085     unpack serialized message in str into this message instance
00086     :param str: byte array of serialized message, ``str``
00087     """
00088     try:
00089       end = 0
00090       start = end
00091       end += 4
00092       (length,) = _struct_I.unpack(str[start:end])
00093       start = end
00094       end += length
00095       if python3:
00096         self.joint_name = str[start:end].decode('utf-8')
00097       else:
00098         self.joint_name = str[start:end]
00099       _x = self
00100       start = end
00101       end += 32
00102       (_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight,) = _struct_4d.unpack(str[start:end])
00103       return self
00104     except struct.error as e:
00105       raise genpy.DeserializationError(e) #most likely buffer underfill
00106 
00107 
00108   def serialize_numpy(self, buff, numpy):
00109     """
00110     serialize message with numpy array types into buffer
00111     :param buff: buffer, ``StringIO``
00112     :param numpy: numpy python module
00113     """
00114     try:
00115       _x = self.joint_name
00116       length = len(_x)
00117       if python3 or type(_x) == unicode:
00118         _x = _x.encode('utf-8')
00119         length = len(_x)
00120       buff.write(struct.pack('<I%ss'%length, length, _x))
00121       _x = self
00122       buff.write(_struct_4d.pack(_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight))
00123     except struct.error as se: self._check_types(se)
00124     except TypeError as te: self._check_types(te)
00125 
00126   def deserialize_numpy(self, str, numpy):
00127     """
00128     unpack serialized message in str into this message instance using numpy for array types
00129     :param str: byte array of serialized message, ``str``
00130     :param numpy: numpy python module
00131     """
00132     try:
00133       end = 0
00134       start = end
00135       end += 4
00136       (length,) = _struct_I.unpack(str[start:end])
00137       start = end
00138       end += length
00139       if python3:
00140         self.joint_name = str[start:end].decode('utf-8')
00141       else:
00142         self.joint_name = str[start:end]
00143       _x = self
00144       start = end
00145       end += 32
00146       (_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight,) = _struct_4d.unpack(str[start:end])
00147       return self
00148     except struct.error as e:
00149       raise genpy.DeserializationError(e) #most likely buffer underfill
00150 
00151 _struct_I = genpy.struct_I
00152 _struct_4d = struct.Struct("<4d")


arm_navigation_msgs
Author(s): Gil Jones
autogenerated on Thu Dec 12 2013 11:08:10