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