_ModelState.py
Go to the documentation of this file.
00001 """autogenerated by genpy from gazebo_msgs/ModelState.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 ModelState(genpy.Message):
00010   _md5sum = "9330fd35f2fcd82d457e54bd54e10593"
00011   _type = "gazebo_msgs/ModelState"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# Set Gazebo Model pose and twist
00014 string model_name           # model to set state (pose and twist)
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 entity (Body/Model)
00018                             # leave empty or "world" or "map" defaults to world-frame
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 MSG: geometry_msgs/Twist
00045 # This expresses velocity in free space broken into it's linear and angular parts. 
00046 Vector3  linear
00047 Vector3  angular
00048 
00049 ================================================================================
00050 MSG: geometry_msgs/Vector3
00051 # This represents a vector in free space. 
00052 
00053 float64 x
00054 float64 y
00055 float64 z
00056 """
00057   __slots__ = ['model_name','pose','twist','reference_frame']
00058   _slot_types = ['string','geometry_msgs/Pose','geometry_msgs/Twist','string']
00059 
00060   def __init__(self, *args, **kwds):
00061     """
00062     Constructor. Any message fields that are implicitly/explicitly
00063     set to None will be assigned a default value. The recommend
00064     use is keyword arguments as this is more robust to future message
00065     changes.  You cannot mix in-order arguments and keyword arguments.
00066 
00067     The available fields are:
00068        model_name,pose,twist,reference_frame
00069 
00070     :param args: complete set of field values, in .msg order
00071     :param kwds: use keyword arguments corresponding to message field names
00072     to set specific fields.
00073     """
00074     if args or kwds:
00075       super(ModelState, self).__init__(*args, **kwds)
00076       #message fields cannot be None, assign default values for those that are
00077       if self.model_name is None:
00078         self.model_name = ''
00079       if self.pose is None:
00080         self.pose = geometry_msgs.msg.Pose()
00081       if self.twist is None:
00082         self.twist = geometry_msgs.msg.Twist()
00083       if self.reference_frame is None:
00084         self.reference_frame = ''
00085     else:
00086       self.model_name = ''
00087       self.pose = geometry_msgs.msg.Pose()
00088       self.twist = geometry_msgs.msg.Twist()
00089       self.reference_frame = ''
00090 
00091   def _get_types(self):
00092     """
00093     internal API method
00094     """
00095     return self._slot_types
00096 
00097   def serialize(self, buff):
00098     """
00099     serialize message into buffer
00100     :param buff: buffer, ``StringIO``
00101     """
00102     try:
00103       _x = self.model_name
00104       length = len(_x)
00105       if python3 or type(_x) == unicode:
00106         _x = _x.encode('utf-8')
00107         length = len(_x)
00108       buff.write(struct.pack('<I%ss'%length, length, _x))
00109       _x = self
00110       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))
00111       _x = self.reference_frame
00112       length = len(_x)
00113       if python3 or type(_x) == unicode:
00114         _x = _x.encode('utf-8')
00115         length = len(_x)
00116       buff.write(struct.pack('<I%ss'%length, length, _x))
00117     except struct.error as se: self._check_types(se)
00118     except TypeError as te: self._check_types(te)
00119 
00120   def deserialize(self, str):
00121     """
00122     unpack serialized message in str into this message instance
00123     :param str: byte array of serialized message, ``str``
00124     """
00125     try:
00126       if self.pose is None:
00127         self.pose = geometry_msgs.msg.Pose()
00128       if self.twist is None:
00129         self.twist = geometry_msgs.msg.Twist()
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.model_name = str[start:end].decode('utf-8')
00138       else:
00139         self.model_name = str[start:end]
00140       _x = self
00141       start = end
00142       end += 104
00143       (_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])
00144       start = end
00145       end += 4
00146       (length,) = _struct_I.unpack(str[start:end])
00147       start = end
00148       end += length
00149       if python3:
00150         self.reference_frame = str[start:end].decode('utf-8')
00151       else:
00152         self.reference_frame = str[start:end]
00153       return self
00154     except struct.error as e:
00155       raise genpy.DeserializationError(e) #most likely buffer underfill
00156 
00157 
00158   def serialize_numpy(self, buff, numpy):
00159     """
00160     serialize message with numpy array types into buffer
00161     :param buff: buffer, ``StringIO``
00162     :param numpy: numpy python module
00163     """
00164     try:
00165       _x = self.model_name
00166       length = len(_x)
00167       if python3 or type(_x) == unicode:
00168         _x = _x.encode('utf-8')
00169         length = len(_x)
00170       buff.write(struct.pack('<I%ss'%length, length, _x))
00171       _x = self
00172       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))
00173       _x = self.reference_frame
00174       length = len(_x)
00175       if python3 or type(_x) == unicode:
00176         _x = _x.encode('utf-8')
00177         length = len(_x)
00178       buff.write(struct.pack('<I%ss'%length, length, _x))
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, ``str``
00186     :param numpy: numpy python module
00187     """
00188     try:
00189       if self.pose is None:
00190         self.pose = geometry_msgs.msg.Pose()
00191       if self.twist is None:
00192         self.twist = geometry_msgs.msg.Twist()
00193       end = 0
00194       start = end
00195       end += 4
00196       (length,) = _struct_I.unpack(str[start:end])
00197       start = end
00198       end += length
00199       if python3:
00200         self.model_name = str[start:end].decode('utf-8')
00201       else:
00202         self.model_name = str[start:end]
00203       _x = self
00204       start = end
00205       end += 104
00206       (_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])
00207       start = end
00208       end += 4
00209       (length,) = _struct_I.unpack(str[start:end])
00210       start = end
00211       end += length
00212       if python3:
00213         self.reference_frame = str[start:end].decode('utf-8')
00214       else:
00215         self.reference_frame = str[start:end]
00216       return self
00217     except struct.error as e:
00218       raise genpy.DeserializationError(e) #most likely buffer underfill
00219 
00220 _struct_I = genpy.struct_I
00221 _struct_13d = struct.Struct("<13d")


gazebo_msgs
Author(s): John Hsu
autogenerated on Sun Jan 5 2014 11:34:32