00001 """autogenerated by genpy from pr2_gazebo_plugins/ModelJointsState.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 geometry_msgs.msg
00008
00009 class ModelJointsState(genpy.Message):
00010 _md5sum = "f700a74958b6566fae4cd77fbb80ffd4"
00011 _type = "pr2_gazebo_plugins/ModelJointsState"
00012 _has_header = False
00013 _full_text = """geometry_msgs/Pose[] model_pose # set as single element array if user wishes to specify model pose, otherwise, leave empty
00014 string[] joint_names # list of joint names
00015 float64[] joint_positions # list of desired joint positions, should match joint_names
00016
00017 ================================================================================
00018 MSG: geometry_msgs/Pose
00019 # A representation of pose in free space, composed of postion and orientation.
00020 Point position
00021 Quaternion orientation
00022
00023 ================================================================================
00024 MSG: geometry_msgs/Point
00025 # This contains the position of a point in free space
00026 float64 x
00027 float64 y
00028 float64 z
00029
00030 ================================================================================
00031 MSG: geometry_msgs/Quaternion
00032 # This represents an orientation in free space in quaternion form.
00033
00034 float64 x
00035 float64 y
00036 float64 z
00037 float64 w
00038
00039 """
00040 __slots__ = ['model_pose','joint_names','joint_positions']
00041 _slot_types = ['geometry_msgs/Pose[]','string[]','float64[]']
00042
00043 def __init__(self, *args, **kwds):
00044 """
00045 Constructor. Any message fields that are implicitly/explicitly
00046 set to None will be assigned a default value. The recommend
00047 use is keyword arguments as this is more robust to future message
00048 changes. You cannot mix in-order arguments and keyword arguments.
00049
00050 The available fields are:
00051 model_pose,joint_names,joint_positions
00052
00053 :param args: complete set of field values, in .msg order
00054 :param kwds: use keyword arguments corresponding to message field names
00055 to set specific fields.
00056 """
00057 if args or kwds:
00058 super(ModelJointsState, self).__init__(*args, **kwds)
00059
00060 if self.model_pose is None:
00061 self.model_pose = []
00062 if self.joint_names is None:
00063 self.joint_names = []
00064 if self.joint_positions is None:
00065 self.joint_positions = []
00066 else:
00067 self.model_pose = []
00068 self.joint_names = []
00069 self.joint_positions = []
00070
00071 def _get_types(self):
00072 """
00073 internal API method
00074 """
00075 return self._slot_types
00076
00077 def serialize(self, buff):
00078 """
00079 serialize message into buffer
00080 :param buff: buffer, ``StringIO``
00081 """
00082 try:
00083 length = len(self.model_pose)
00084 buff.write(_struct_I.pack(length))
00085 for val1 in self.model_pose:
00086 _v1 = val1.position
00087 _x = _v1
00088 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00089 _v2 = val1.orientation
00090 _x = _v2
00091 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00092 length = len(self.joint_names)
00093 buff.write(_struct_I.pack(length))
00094 for val1 in self.joint_names:
00095 length = len(val1)
00096 if python3 or type(val1) == unicode:
00097 val1 = val1.encode('utf-8')
00098 length = len(val1)
00099 buff.write(struct.pack('<I%ss'%length, length, val1))
00100 length = len(self.joint_positions)
00101 buff.write(_struct_I.pack(length))
00102 pattern = '<%sd'%length
00103 buff.write(struct.pack(pattern, *self.joint_positions))
00104 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00105 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00106
00107 def deserialize(self, str):
00108 """
00109 unpack serialized message in str into this message instance
00110 :param str: byte array of serialized message, ``str``
00111 """
00112 try:
00113 if self.model_pose is None:
00114 self.model_pose = None
00115 end = 0
00116 start = end
00117 end += 4
00118 (length,) = _struct_I.unpack(str[start:end])
00119 self.model_pose = []
00120 for i in range(0, length):
00121 val1 = geometry_msgs.msg.Pose()
00122 _v3 = val1.position
00123 _x = _v3
00124 start = end
00125 end += 24
00126 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00127 _v4 = val1.orientation
00128 _x = _v4
00129 start = end
00130 end += 32
00131 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00132 self.model_pose.append(val1)
00133 start = end
00134 end += 4
00135 (length,) = _struct_I.unpack(str[start:end])
00136 self.joint_names = []
00137 for i in range(0, length):
00138 start = end
00139 end += 4
00140 (length,) = _struct_I.unpack(str[start:end])
00141 start = end
00142 end += length
00143 if python3:
00144 val1 = str[start:end].decode('utf-8')
00145 else:
00146 val1 = str[start:end]
00147 self.joint_names.append(val1)
00148 start = end
00149 end += 4
00150 (length,) = _struct_I.unpack(str[start:end])
00151 pattern = '<%sd'%length
00152 start = end
00153 end += struct.calcsize(pattern)
00154 self.joint_positions = struct.unpack(pattern, str[start:end])
00155 return self
00156 except struct.error as e:
00157 raise genpy.DeserializationError(e)
00158
00159
00160 def serialize_numpy(self, buff, numpy):
00161 """
00162 serialize message with numpy array types into buffer
00163 :param buff: buffer, ``StringIO``
00164 :param numpy: numpy python module
00165 """
00166 try:
00167 length = len(self.model_pose)
00168 buff.write(_struct_I.pack(length))
00169 for val1 in self.model_pose:
00170 _v5 = val1.position
00171 _x = _v5
00172 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00173 _v6 = val1.orientation
00174 _x = _v6
00175 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00176 length = len(self.joint_names)
00177 buff.write(_struct_I.pack(length))
00178 for val1 in self.joint_names:
00179 length = len(val1)
00180 if python3 or type(val1) == unicode:
00181 val1 = val1.encode('utf-8')
00182 length = len(val1)
00183 buff.write(struct.pack('<I%ss'%length, length, val1))
00184 length = len(self.joint_positions)
00185 buff.write(_struct_I.pack(length))
00186 pattern = '<%sd'%length
00187 buff.write(self.joint_positions.tostring())
00188 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00189 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00190
00191 def deserialize_numpy(self, str, numpy):
00192 """
00193 unpack serialized message in str into this message instance using numpy for array types
00194 :param str: byte array of serialized message, ``str``
00195 :param numpy: numpy python module
00196 """
00197 try:
00198 if self.model_pose is None:
00199 self.model_pose = None
00200 end = 0
00201 start = end
00202 end += 4
00203 (length,) = _struct_I.unpack(str[start:end])
00204 self.model_pose = []
00205 for i in range(0, length):
00206 val1 = geometry_msgs.msg.Pose()
00207 _v7 = val1.position
00208 _x = _v7
00209 start = end
00210 end += 24
00211 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00212 _v8 = val1.orientation
00213 _x = _v8
00214 start = end
00215 end += 32
00216 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00217 self.model_pose.append(val1)
00218 start = end
00219 end += 4
00220 (length,) = _struct_I.unpack(str[start:end])
00221 self.joint_names = []
00222 for i in range(0, length):
00223 start = end
00224 end += 4
00225 (length,) = _struct_I.unpack(str[start:end])
00226 start = end
00227 end += length
00228 if python3:
00229 val1 = str[start:end].decode('utf-8')
00230 else:
00231 val1 = str[start:end]
00232 self.joint_names.append(val1)
00233 start = end
00234 end += 4
00235 (length,) = _struct_I.unpack(str[start:end])
00236 pattern = '<%sd'%length
00237 start = end
00238 end += struct.calcsize(pattern)
00239 self.joint_positions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00240 return self
00241 except struct.error as e:
00242 raise genpy.DeserializationError(e)
00243
00244 _struct_I = genpy.struct_I
00245 _struct_4d = struct.Struct("<4d")
00246 _struct_3d = struct.Struct("<3d")