00001 """autogenerated by genmsg_py from JointConstraint.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class JointConstraint(roslib.message.Message):
00007 _md5sum = "c02a15146bec0ce13564807805b008f0"
00008 _type = "motion_planning_msgs/JointConstraint"
00009 _has_header = False
00010 _full_text = """# Constrain the position of a joint to be within a certain bound
00011 string joint_name
00012
00013 # the bound to be achieved is [position - tolerance_below, position + tolerance_above]
00014 float64 position
00015 float64 tolerance_above
00016 float64 tolerance_below
00017
00018 # A weighting factor for this constraint
00019 float64 weight
00020 """
00021 __slots__ = ['joint_name','position','tolerance_above','tolerance_below','weight']
00022 _slot_types = ['string','float64','float64','float64','float64']
00023
00024 def __init__(self, *args, **kwds):
00025 """
00026 Constructor. Any message fields that are implicitly/explicitly
00027 set to None will be assigned a default value. The recommend
00028 use is keyword arguments as this is more robust to future message
00029 changes. You cannot mix in-order arguments and keyword arguments.
00030
00031 The available fields are:
00032 joint_name,position,tolerance_above,tolerance_below,weight
00033
00034 @param args: complete set of field values, in .msg order
00035 @param kwds: use keyword arguments corresponding to message field names
00036 to set specific fields.
00037 """
00038 if args or kwds:
00039 super(JointConstraint, self).__init__(*args, **kwds)
00040
00041 if self.joint_name is None:
00042 self.joint_name = ''
00043 if self.position is None:
00044 self.position = 0.
00045 if self.tolerance_above is None:
00046 self.tolerance_above = 0.
00047 if self.tolerance_below is None:
00048 self.tolerance_below = 0.
00049 if self.weight is None:
00050 self.weight = 0.
00051 else:
00052 self.joint_name = ''
00053 self.position = 0.
00054 self.tolerance_above = 0.
00055 self.tolerance_below = 0.
00056 self.weight = 0.
00057
00058 def _get_types(self):
00059 """
00060 internal API method
00061 """
00062 return self._slot_types
00063
00064 def serialize(self, buff):
00065 """
00066 serialize message into buffer
00067 @param buff: buffer
00068 @type buff: StringIO
00069 """
00070 try:
00071 _x = self.joint_name
00072 length = len(_x)
00073 buff.write(struct.pack('<I%ss'%length, length, _x))
00074 _x = self
00075 buff.write(_struct_4d.pack(_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight))
00076 except struct.error, se: self._check_types(se)
00077 except TypeError, te: self._check_types(te)
00078
00079 def deserialize(self, str):
00080 """
00081 unpack serialized message in str into this message instance
00082 @param str: byte array of serialized message
00083 @type str: str
00084 """
00085 try:
00086 end = 0
00087 start = end
00088 end += 4
00089 (length,) = _struct_I.unpack(str[start:end])
00090 start = end
00091 end += length
00092 self.joint_name = str[start:end]
00093 _x = self
00094 start = end
00095 end += 32
00096 (_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight,) = _struct_4d.unpack(str[start:end])
00097 return self
00098 except struct.error, e:
00099 raise roslib.message.DeserializationError(e)
00100
00101
00102 def serialize_numpy(self, buff, numpy):
00103 """
00104 serialize message with numpy array types into buffer
00105 @param buff: buffer
00106 @type buff: StringIO
00107 @param numpy: numpy python module
00108 @type numpy module
00109 """
00110 try:
00111 _x = self.joint_name
00112 length = len(_x)
00113 buff.write(struct.pack('<I%ss'%length, length, _x))
00114 _x = self
00115 buff.write(_struct_4d.pack(_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight))
00116 except struct.error, se: self._check_types(se)
00117 except TypeError, te: self._check_types(te)
00118
00119 def deserialize_numpy(self, str, numpy):
00120 """
00121 unpack serialized message in str into this message instance using numpy for array types
00122 @param str: byte array of serialized message
00123 @type str: str
00124 @param numpy: numpy python module
00125 @type numpy: module
00126 """
00127 try:
00128 end = 0
00129 start = end
00130 end += 4
00131 (length,) = _struct_I.unpack(str[start:end])
00132 start = end
00133 end += length
00134 self.joint_name = str[start:end]
00135 _x = self
00136 start = end
00137 end += 32
00138 (_x.position, _x.tolerance_above, _x.tolerance_below, _x.weight,) = _struct_4d.unpack(str[start:end])
00139 return self
00140 except struct.error, e:
00141 raise roslib.message.DeserializationError(e)
00142
00143 _struct_I = roslib.message.struct_I
00144 _struct_4d = struct.Struct("<4d")