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