Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.64 KB | None | 0 0
  1. # This Python file uses the following encoding: utf-8
  2. """autogenerated by genpy from gazebo_msgs/SpawnModelRequest.msg. Do not edit."""
  3. import sys
  4. python3 = True if sys.hexversion > 0x03000000 else False
  5. import genpy
  6. import struct
  7.  
  8. import geometry_msgs.msg
  9.  
  10. class SpawnModelRequest(genpy.Message):
  11. _md5sum = "6d0eba5753761cd57e6263a056b79930"
  12. _type = "gazebo_msgs/SpawnModelRequest"
  13. _has_header = False #flag to mark the presence of a Header object
  14. _full_text = """string model_name
  15. string model_xml
  16. string robot_namespace
  17. geometry_msgs/Pose initial_pose
  18. string reference_frame
  19.  
  20.  
  21.  
  22.  
  23. ================================================================================
  24. MSG: geometry_msgs/Pose
  25. # A representation of pose in free space, composed of position and orientation.
  26. Point position
  27. Quaternion orientation
  28.  
  29. ================================================================================
  30. MSG: geometry_msgs/Point
  31. # This contains the position of a point in free space
  32. float64 x
  33. float64 y
  34. float64 z
  35.  
  36. ================================================================================
  37. MSG: geometry_msgs/Quaternion
  38. # This represents an orientation in free space in quaternion form.
  39.  
  40. float64 x
  41. float64 y
  42. float64 z
  43. float64 w
  44. """
  45. __slots__ = ['model_name','model_xml','robot_namespace','initial_pose','reference_frame']
  46. _slot_types = ['string','string','string','geometry_msgs/Pose','string']
  47.  
  48. def __init__(self, *args, **kwds):
  49. """
  50. Constructor. Any message fields that are implicitly/explicitly
  51. set to None will be assigned a default value. The recommend
  52. use is keyword arguments as this is more robust to future message
  53. changes. You cannot mix in-order arguments and keyword arguments.
  54.  
  55. The available fields are:
  56. model_name,model_xml,robot_namespace,initial_pose,reference_frame
  57.  
  58. :param args: complete set of field values, in .msg order
  59. :param kwds: use keyword arguments corresponding to message field names
  60. to set specific fields.
  61. """
  62. if args or kwds:
  63. super(SpawnModelRequest, self).__init__(*args, **kwds)
  64. #message fields cannot be None, assign default values for those that are
  65. if self.model_name is None:
  66. self.model_name = ''
  67. if self.model_xml is None:
  68. self.model_xml = ''
  69. if self.robot_namespace is None:
  70. self.robot_namespace = ''
  71. if self.initial_pose is None:
  72. self.initial_pose = geometry_msgs.msg.Pose()
  73. if self.reference_frame is None:
  74. self.reference_frame = ''
  75. else:
  76. self.model_name = ''
  77. self.model_xml = ''
  78. self.robot_namespace = ''
  79. self.initial_pose = geometry_msgs.msg.Pose()
  80. self.reference_frame = ''
  81.  
  82. def _get_types(self):
  83. """
  84. internal API method
  85. """
  86. return self._slot_types
  87.  
  88. def serialize(self, buff):
  89. """
  90. serialize message into buffer
  91. :param buff: buffer, ``StringIO``
  92. """
  93. try:
  94. _x = self.model_name
  95. length = len(_x)
  96. if python3 and type(_x) == str:
  97. _x = _x.encode('utf-8')
  98. length = len(_x)
  99. buff.write(struct.pack('<I%ss'%length, length, _x))
  100. _x = self.model_xml
  101. length = len(_x)
  102. if python3 and type(_x) == str:
  103. _x = _x.encode('utf-8')
  104. length = len(_x)
  105. buff.write(struct.pack('<I%ss'%length, length, _x))
  106. _x = self.robot_namespace
  107. length = len(_x)
  108. if python3 and type(_x) == str:
  109. _x = _x.encode('utf-8')
  110. length = len(_x)
  111. buff.write(struct.pack('<I%ss'%length, length, _x))
  112. _x = self
  113. buff.write(_get_struct_7d().pack(_x.initial_pose.position.x, _x.initial_pose.position.y, _x.initial_pose.position.z, _x.initial_pose.orientation.x, _x.initial_pose.orientation.y, _x.initial_pose.orientation.z, _x.initial_pose.orientation.w))
  114. _x = self.reference_frame
  115. length = len(_x)
  116. if python3 and type(_x) == str:
  117. _x = _x.encode('utf-8')
  118. length = len(_x)
  119. buff.write(struct.pack('<I%ss'%length, length, _x))
  120. except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
  121. except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
  122.  
  123. def deserialize(self, str):
  124. """
  125. unpack serialized message in str into this message instance
  126. :param str: byte array of serialized message, ``str``
  127. """
  128. try:
  129. if self.initial_pose is None:
  130. self.initial_pose = geometry_msgs.msg.Pose()
  131. end = 0
  132. start = end
  133. end += 4
  134. (length,) = _struct_I.unpack(str[start:end])
  135. start = end
  136. end += length
  137. if python3:
  138. self.model_name = str[start:end].decode('utf-8')
  139. else:
  140. self.model_name = str[start:end]
  141. start = end
  142. end += 4
  143. (length,) = _struct_I.unpack(str[start:end])
  144. start = end
  145. end += length
  146. if python3:
  147. self.model_xml = str[start:end].decode('utf-8')
  148. else:
  149. self.model_xml = str[start:end]
  150. start = end
  151. end += 4
  152. (length,) = _struct_I.unpack(str[start:end])
  153. start = end
  154. end += length
  155. if python3:
  156. self.robot_namespace = str[start:end].decode('utf-8')
  157. else:
  158. self.robot_namespace = str[start:end]
  159. _x = self
  160. start = end
  161. end += 56
  162. (_x.initial_pose.position.x, _x.initial_pose.position.y, _x.initial_pose.position.z, _x.initial_pose.orientation.x, _x.initial_pose.orientation.y, _x.initial_pose.orientation.z, _x.initial_pose.orientation.w,) = _get_struct_7d().unpack(str[start:end])
  163. start = end
  164. end += 4
  165. (length,) = _struct_I.unpack(str[start:end])
  166. start = end
  167. end += length
  168. if python3:
  169. self.reference_frame = str[start:end].decode('utf-8')
  170. else:
  171. self.reference_frame = str[start:end]
  172. return self
  173. except struct.error as e:
  174. raise genpy.DeserializationError(e) #most likely buffer underfill
  175.  
  176.  
  177. def serialize_numpy(self, buff, numpy):
  178. """
  179. serialize message with numpy array types into buffer
  180. :param buff: buffer, ``StringIO``
  181. :param numpy: numpy python module
  182. """
  183. try:
  184. _x = self.model_name
  185. length = len(_x)
  186. if python3 or type(_x) == unicode:
  187. _x = _x.encode('utf-8')
  188. length = len(_x)
  189. buff.write(struct.pack('<I%ss'%length, length, _x))
  190. _x = self.model_xml
  191. length = len(_x)
  192. if python3 or type(_x) == unicode:
  193. _x = _x.encode('utf-8')
  194. length = len(_x)
  195. buff.write(struct.pack('<I%ss'%length, length, _x))
  196. _x = self.robot_namespace
  197. length = len(_x)
  198. if python3 or type(_x) == unicode:
  199. _x = _x.encode('utf-8')
  200. length = len(_x)
  201. buff.write(struct.pack('<I%ss'%length, length, _x))
  202. _x = self
  203. buff.write(_get_struct_7d().pack(_x.initial_pose.position.x, _x.initial_pose.position.y, _x.initial_pose.position.z, _x.initial_pose.orientation.x, _x.initial_pose.orientation.y, _x.initial_pose.orientation.z, _x.initial_pose.orientation.w))
  204. _x = self.reference_frame
  205. length = len(_x)
  206. if python3 or type(_x) == unicode:
  207. _x = _x.encode('utf-8')
  208. length = len(_x)
  209. buff.write(struct.pack('<I%ss'%length, length, _x))
  210. except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
  211. except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
  212.  
  213. def deserialize_numpy(self, str, numpy):
  214. """
  215. unpack serialized message in str into this message instance using numpy for array types
  216. :param str: byte array of serialized message, ``str``
  217. :param numpy: numpy python module
  218. """
  219. try:
  220. if self.initial_pose is None:
  221. self.initial_pose = geometry_msgs.msg.Pose()
  222. end = 0
  223. start = end
  224. end += 4
  225. (length,) = _struct_I.unpack(str[start:end])
  226. start = end
  227. end += length
  228. if python3:
  229. self.model_name = str[start:end].decode('utf-8')
  230. else:
  231. self.model_name = str[start:end]
  232. start = end
  233. end += 4
  234. (length,) = _struct_I.unpack(str[start:end])
  235. start = end
  236. end += length
  237. if python3:
  238. self.model_xml = str[start:end].decode('utf-8')
  239. else:
  240. self.model_xml = str[start:end]
  241. start = end
  242. end += 4
  243. (length,) = _struct_I.unpack(str[start:end])
  244. start = end
  245. end += length
  246. if python3:
  247. self.robot_namespace = str[start:end].decode('utf-8')
  248. else:
  249. self.robot_namespace = str[start:end]
  250. _x = self
  251. start = end
  252. end += 56
  253. (_x.initial_pose.position.x, _x.initial_pose.position.y, _x.initial_pose.position.z, _x.initial_pose.orientation.x, _x.initial_pose.orientation.y, _x.initial_pose.orientation.z, _x.initial_pose.orientation.w,) = _get_struct_7d().unpack(str[start:end])
  254. start = end
  255. end += 4
  256. (length,) = _struct_I.unpack(str[start:end])
  257. start = end
  258. end += length
  259. if python3:
  260. self.reference_frame = str[start:end].decode('utf-8')
  261. else:
  262. self.reference_frame = str[start:end]
  263. return self
  264. except struct.error as e:
  265. raise genpy.DeserializationError(e) #most likely buffer underfill
  266.  
  267. _struct_I = genpy.struct_I
  268. def _get_struct_I():
  269. global _struct_I
  270. return _struct_I
  271. _struct_7d = None
  272. def _get_struct_7d():
  273. global _struct_7d
  274. if _struct_7d is None:
  275. _struct_7d = struct.Struct("<7d")
  276. return _struct_7d
  277. # This Python file uses the following encoding: utf-8
  278. """autogenerated by genpy from gazebo_msgs/SpawnModelResponse.msg. Do not edit."""
  279. import sys
  280. python3 = True if sys.hexversion > 0x03000000 else False
  281. import genpy
  282. import struct
  283.  
  284.  
  285. class SpawnModelResponse(genpy.Message):
  286. _md5sum = "2ec6f3eff0161f4257b808b12bc830c2"
  287. _type = "gazebo_msgs/SpawnModelResponse"
  288. _has_header = False #flag to mark the presence of a Header object
  289. _full_text = """bool success
  290. string status_message
  291.  
  292. """
  293. __slots__ = ['success','status_message']
  294. _slot_types = ['bool','string']
  295.  
  296. def __init__(self, *args, **kwds):
  297. """
  298. Constructor. Any message fields that are implicitly/explicitly
  299. set to None will be assigned a default value. The recommend
  300. use is keyword arguments as this is more robust to future message
  301. changes. You cannot mix in-order arguments and keyword arguments.
  302.  
  303. The available fields are:
  304. success,status_message
  305.  
  306. :param args: complete set of field values, in .msg order
  307. :param kwds: use keyword arguments corresponding to message field names
  308. to set specific fields.
  309. """
  310. if args or kwds:
  311. super(SpawnModelResponse, self).__init__(*args, **kwds)
  312. #message fields cannot be None, assign default values for those that are
  313. if self.success is None:
  314. self.success = False
  315. if self.status_message is None:
  316. self.status_message = ''
  317. else:
  318. self.success = False
  319. self.status_message = ''
  320.  
  321. def _get_types(self):
  322. """
  323. internal API method
  324. """
  325. return self._slot_types
  326.  
  327. def serialize(self, buff):
  328. """
  329. serialize message into buffer
  330. :param buff: buffer, ``StringIO``
  331. """
  332. try:
  333. buff.write(_get_struct_B().pack(self.success))
  334. _x = self.status_message
  335. length = len(_x)
  336. if python3 or type(_x) == unicode:
  337. _x = _x.encode('utf-8')
  338. length = len(_x)
  339. buff.write(struct.pack('<I%ss'%length, length, _x))
  340. except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
  341. except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
  342.  
  343. def deserialize(self, str):
  344. """
  345. unpack serialized message in str into this message instance
  346. :param str: byte array of serialized message, ``str``
  347. """
  348. try:
  349. end = 0
  350. start = end
  351. end += 1
  352. (self.success,) = _get_struct_B().unpack(str[start:end])
  353. self.success = bool(self.success)
  354. start = end
  355. end += 4
  356. (length,) = _struct_I.unpack(str[start:end])
  357. start = end
  358. end += length
  359. if python3:
  360. self.status_message = str[start:end].decode('utf-8')
  361. else:
  362. self.status_message = str[start:end]
  363. return self
  364. except struct.error as e:
  365. raise genpy.DeserializationError(e) #most likely buffer underfill
  366.  
  367.  
  368. def serialize_numpy(self, buff, numpy):
  369. """
  370. serialize message with numpy array types into buffer
  371. :param buff: buffer, ``StringIO``
  372. :param numpy: numpy python module
  373. """
  374. try:
  375. buff.write(_get_struct_B().pack(self.success))
  376. _x = self.status_message
  377. length = len(_x)
  378. if python3 or type(_x) == unicode:
  379. _x = _x.encode('utf-8')
  380. length = len(_x)
  381. buff.write(struct.pack('<I%ss'%length, length, _x))
  382. except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
  383. except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
  384.  
  385. def deserialize_numpy(self, str, numpy):
  386. """
  387. unpack serialized message in str into this message instance using numpy for array types
  388. :param str: byte array of serialized message, ``str``
  389. :param numpy: numpy python module
  390. """
  391. try:
  392. end = 0
  393. start = end
  394. end += 1
  395. (self.success,) = _get_struct_B().unpack(str[start:end])
  396. self.success = bool(self.success)
  397. start = end
  398. end += 4
  399. (length,) = _struct_I.unpack(str[start:end])
  400. start = end
  401. end += length
  402. if python3:
  403. self.status_message = str[start:end].decode('utf-8')
  404. else:
  405. self.status_message = str[start:end]
  406. return self
  407. except struct.error as e:
  408. raise genpy.DeserializationError(e) #most likely buffer underfill
  409.  
  410. _struct_I = genpy.struct_I
  411. def _get_struct_I():
  412. global _struct_I
  413. return _struct_I
  414. _struct_B = None
  415. def _get_struct_B():
  416. global _struct_B
  417. if _struct_B is None:
  418. _struct_B = struct.Struct("<B")
  419. return _struct_B
  420. class SpawnModel(object):
  421. _type = 'gazebo_msgs/SpawnModel'
  422. _md5sum = '9ed9c82c96abe1a00c3e8cdaeee24413'
  423. _request_class = SpawnModelRequest
  424. _response_class = SpawnModelResponse
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement