00001 """autogenerated by genpy from gazebo_msgs/LinkState.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 LinkState(genpy.Message):
00010 _md5sum = "0818ebbf28ce3a08d48ab1eaa7309ebe"
00011 _type = "gazebo_msgs/LinkState"
00012 _has_header = False
00013 _full_text = """# @todo: FIXME: sets pose and twist of a link. All children link poses/twists of the URDF tree are not updated accordingly, but should be.
00014 string link_name # link name, link_names are in gazebo scoped name notation, [model_name::body_name]
00015 geometry_msgs/Pose pose # desired pose in reference frame
00016 geometry_msgs/Twist twist # desired twist in reference frame
00017 string reference_frame # set pose/twist relative to the frame of this link/body
00018 # leave empty or "world" or "map" defaults to world-frame
00019
00020 ================================================================================
00021 MSG: geometry_msgs/Pose
00022 # A representation of pose in free space, composed of postion and orientation.
00023 Point position
00024 Quaternion orientation
00025
00026 ================================================================================
00027 MSG: geometry_msgs/Point
00028 # This contains the position of a point in free space
00029 float64 x
00030 float64 y
00031 float64 z
00032
00033 ================================================================================
00034 MSG: geometry_msgs/Quaternion
00035 # This represents an orientation in free space in quaternion form.
00036
00037 float64 x
00038 float64 y
00039 float64 z
00040 float64 w
00041
00042 ================================================================================
00043 MSG: geometry_msgs/Twist
00044 # This expresses velocity in free space broken into its linear and angular parts.
00045 Vector3 linear
00046 Vector3 angular
00047
00048 ================================================================================
00049 MSG: geometry_msgs/Vector3
00050 # This represents a vector in free space.
00051
00052 float64 x
00053 float64 y
00054 float64 z
00055 """
00056 __slots__ = ['link_name','pose','twist','reference_frame']
00057 _slot_types = ['string','geometry_msgs/Pose','geometry_msgs/Twist','string']
00058
00059 def __init__(self, *args, **kwds):
00060 """
00061 Constructor. Any message fields that are implicitly/explicitly
00062 set to None will be assigned a default value. The recommend
00063 use is keyword arguments as this is more robust to future message
00064 changes. You cannot mix in-order arguments and keyword arguments.
00065
00066 The available fields are:
00067 link_name,pose,twist,reference_frame
00068
00069 :param args: complete set of field values, in .msg order
00070 :param kwds: use keyword arguments corresponding to message field names
00071 to set specific fields.
00072 """
00073 if args or kwds:
00074 super(LinkState, self).__init__(*args, **kwds)
00075
00076 if self.link_name is None:
00077 self.link_name = ''
00078 if self.pose is None:
00079 self.pose = geometry_msgs.msg.Pose()
00080 if self.twist is None:
00081 self.twist = geometry_msgs.msg.Twist()
00082 if self.reference_frame is None:
00083 self.reference_frame = ''
00084 else:
00085 self.link_name = ''
00086 self.pose = geometry_msgs.msg.Pose()
00087 self.twist = geometry_msgs.msg.Twist()
00088 self.reference_frame = ''
00089
00090 def _get_types(self):
00091 """
00092 internal API method
00093 """
00094 return self._slot_types
00095
00096 def serialize(self, buff):
00097 """
00098 serialize message into buffer
00099 :param buff: buffer, ``StringIO``
00100 """
00101 try:
00102 _x = self.link_name
00103 length = len(_x)
00104 if python3 or type(_x) == unicode:
00105 _x = _x.encode('utf-8')
00106 length = len(_x)
00107 buff.write(struct.pack('<I%ss'%length, length, _x))
00108 _x = self
00109 buff.write(_struct_13d.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, _x.twist.linear.x, _x.twist.linear.y, _x.twist.linear.z, _x.twist.angular.x, _x.twist.angular.y, _x.twist.angular.z))
00110 _x = self.reference_frame
00111 length = len(_x)
00112 if python3 or type(_x) == unicode:
00113 _x = _x.encode('utf-8')
00114 length = len(_x)
00115 buff.write(struct.pack('<I%ss'%length, length, _x))
00116 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00117 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00118
00119 def deserialize(self, str):
00120 """
00121 unpack serialized message in str into this message instance
00122 :param str: byte array of serialized message, ``str``
00123 """
00124 try:
00125 if self.pose is None:
00126 self.pose = geometry_msgs.msg.Pose()
00127 if self.twist is None:
00128 self.twist = geometry_msgs.msg.Twist()
00129 end = 0
00130 start = end
00131 end += 4
00132 (length,) = _struct_I.unpack(str[start:end])
00133 start = end
00134 end += length
00135 if python3:
00136 self.link_name = str[start:end].decode('utf-8')
00137 else:
00138 self.link_name = str[start:end]
00139 _x = self
00140 start = end
00141 end += 104
00142 (_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, _x.twist.linear.x, _x.twist.linear.y, _x.twist.linear.z, _x.twist.angular.x, _x.twist.angular.y, _x.twist.angular.z,) = _struct_13d.unpack(str[start:end])
00143 start = end
00144 end += 4
00145 (length,) = _struct_I.unpack(str[start:end])
00146 start = end
00147 end += length
00148 if python3:
00149 self.reference_frame = str[start:end].decode('utf-8')
00150 else:
00151 self.reference_frame = str[start:end]
00152 return self
00153 except struct.error as e:
00154 raise genpy.DeserializationError(e)
00155
00156
00157 def serialize_numpy(self, buff, numpy):
00158 """
00159 serialize message with numpy array types into buffer
00160 :param buff: buffer, ``StringIO``
00161 :param numpy: numpy python module
00162 """
00163 try:
00164 _x = self.link_name
00165 length = len(_x)
00166 if python3 or type(_x) == unicode:
00167 _x = _x.encode('utf-8')
00168 length = len(_x)
00169 buff.write(struct.pack('<I%ss'%length, length, _x))
00170 _x = self
00171 buff.write(_struct_13d.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, _x.twist.linear.x, _x.twist.linear.y, _x.twist.linear.z, _x.twist.angular.x, _x.twist.angular.y, _x.twist.angular.z))
00172 _x = self.reference_frame
00173 length = len(_x)
00174 if python3 or type(_x) == unicode:
00175 _x = _x.encode('utf-8')
00176 length = len(_x)
00177 buff.write(struct.pack('<I%ss'%length, length, _x))
00178 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00179 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00180
00181 def deserialize_numpy(self, str, numpy):
00182 """
00183 unpack serialized message in str into this message instance using numpy for array types
00184 :param str: byte array of serialized message, ``str``
00185 :param numpy: numpy python module
00186 """
00187 try:
00188 if self.pose is None:
00189 self.pose = geometry_msgs.msg.Pose()
00190 if self.twist is None:
00191 self.twist = geometry_msgs.msg.Twist()
00192 end = 0
00193 start = end
00194 end += 4
00195 (length,) = _struct_I.unpack(str[start:end])
00196 start = end
00197 end += length
00198 if python3:
00199 self.link_name = str[start:end].decode('utf-8')
00200 else:
00201 self.link_name = str[start:end]
00202 _x = self
00203 start = end
00204 end += 104
00205 (_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, _x.twist.linear.x, _x.twist.linear.y, _x.twist.linear.z, _x.twist.angular.x, _x.twist.angular.y, _x.twist.angular.z,) = _struct_13d.unpack(str[start:end])
00206 start = end
00207 end += 4
00208 (length,) = _struct_I.unpack(str[start:end])
00209 start = end
00210 end += length
00211 if python3:
00212 self.reference_frame = str[start:end].decode('utf-8')
00213 else:
00214 self.reference_frame = str[start:end]
00215 return self
00216 except struct.error as e:
00217 raise genpy.DeserializationError(e)
00218
00219 _struct_I = genpy.struct_I
00220 _struct_13d = struct.Struct("<13d")