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


gazebo_msgs
Author(s): John Hsu
autogenerated on Mon Oct 6 2014 12:14:33