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