_Waypoint.py 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. # This Python file uses the following encoding: utf-8
  2. """autogenerated by genpy from waterplus_map_tools/Waypoint.msg. Do not edit."""
  3. import codecs
  4. import sys
  5. python3 = True if sys.hexversion > 0x03000000 else False
  6. import genpy
  7. import struct
  8. import geometry_msgs.msg
  9. class Waypoint(genpy.Message):
  10. _md5sum = "b5abd84eafa003e99e40f2565ee73135"
  11. _type = "waterplus_map_tools/Waypoint"
  12. _has_header = False # flag to mark the presence of a Header object
  13. _full_text = """string frame_id
  14. string name
  15. geometry_msgs/Pose pose
  16. ================================================================================
  17. MSG: geometry_msgs/Pose
  18. # A representation of pose in free space, composed of position and orientation.
  19. Point position
  20. Quaternion orientation
  21. ================================================================================
  22. MSG: geometry_msgs/Point
  23. # This contains the position of a point in free space
  24. float64 x
  25. float64 y
  26. float64 z
  27. ================================================================================
  28. MSG: geometry_msgs/Quaternion
  29. # This represents an orientation in free space in quaternion form.
  30. float64 x
  31. float64 y
  32. float64 z
  33. float64 w
  34. """
  35. __slots__ = ['frame_id','name','pose']
  36. _slot_types = ['string','string','geometry_msgs/Pose']
  37. def __init__(self, *args, **kwds):
  38. """
  39. Constructor. Any message fields that are implicitly/explicitly
  40. set to None will be assigned a default value. The recommend
  41. use is keyword arguments as this is more robust to future message
  42. changes. You cannot mix in-order arguments and keyword arguments.
  43. The available fields are:
  44. frame_id,name,pose
  45. :param args: complete set of field values, in .msg order
  46. :param kwds: use keyword arguments corresponding to message field names
  47. to set specific fields.
  48. """
  49. if args or kwds:
  50. super(Waypoint, self).__init__(*args, **kwds)
  51. # message fields cannot be None, assign default values for those that are
  52. if self.frame_id is None:
  53. self.frame_id = ''
  54. if self.name is None:
  55. self.name = ''
  56. if self.pose is None:
  57. self.pose = geometry_msgs.msg.Pose()
  58. else:
  59. self.frame_id = ''
  60. self.name = ''
  61. self.pose = geometry_msgs.msg.Pose()
  62. def _get_types(self):
  63. """
  64. internal API method
  65. """
  66. return self._slot_types
  67. def serialize(self, buff):
  68. """
  69. serialize message into buffer
  70. :param buff: buffer, ``StringIO``
  71. """
  72. try:
  73. _x = self.frame_id
  74. length = len(_x)
  75. if python3 or type(_x) == unicode:
  76. _x = _x.encode('utf-8')
  77. length = len(_x)
  78. buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
  79. _x = self.name
  80. length = len(_x)
  81. if python3 or type(_x) == unicode:
  82. _x = _x.encode('utf-8')
  83. length = len(_x)
  84. buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
  85. _x = self
  86. buff.write(_get_struct_7d().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))
  87. except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
  88. except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
  89. def deserialize(self, str):
  90. """
  91. unpack serialized message in str into this message instance
  92. :param str: byte array of serialized message, ``str``
  93. """
  94. if python3:
  95. codecs.lookup_error("rosmsg").msg_type = self._type
  96. try:
  97. if self.pose is None:
  98. self.pose = geometry_msgs.msg.Pose()
  99. end = 0
  100. start = end
  101. end += 4
  102. (length,) = _struct_I.unpack(str[start:end])
  103. start = end
  104. end += length
  105. if python3:
  106. self.frame_id = str[start:end].decode('utf-8', 'rosmsg')
  107. else:
  108. self.frame_id = str[start:end]
  109. start = end
  110. end += 4
  111. (length,) = _struct_I.unpack(str[start:end])
  112. start = end
  113. end += length
  114. if python3:
  115. self.name = str[start:end].decode('utf-8', 'rosmsg')
  116. else:
  117. self.name = str[start:end]
  118. _x = self
  119. start = end
  120. end += 56
  121. (_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,) = _get_struct_7d().unpack(str[start:end])
  122. return self
  123. except struct.error as e:
  124. raise genpy.DeserializationError(e) # most likely buffer underfill
  125. def serialize_numpy(self, buff, numpy):
  126. """
  127. serialize message with numpy array types into buffer
  128. :param buff: buffer, ``StringIO``
  129. :param numpy: numpy python module
  130. """
  131. try:
  132. _x = self.frame_id
  133. length = len(_x)
  134. if python3 or type(_x) == unicode:
  135. _x = _x.encode('utf-8')
  136. length = len(_x)
  137. buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
  138. _x = self.name
  139. length = len(_x)
  140. if python3 or type(_x) == unicode:
  141. _x = _x.encode('utf-8')
  142. length = len(_x)
  143. buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
  144. _x = self
  145. buff.write(_get_struct_7d().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))
  146. except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
  147. except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
  148. def deserialize_numpy(self, str, numpy):
  149. """
  150. unpack serialized message in str into this message instance using numpy for array types
  151. :param str: byte array of serialized message, ``str``
  152. :param numpy: numpy python module
  153. """
  154. if python3:
  155. codecs.lookup_error("rosmsg").msg_type = self._type
  156. try:
  157. if self.pose is None:
  158. self.pose = geometry_msgs.msg.Pose()
  159. end = 0
  160. start = end
  161. end += 4
  162. (length,) = _struct_I.unpack(str[start:end])
  163. start = end
  164. end += length
  165. if python3:
  166. self.frame_id = str[start:end].decode('utf-8', 'rosmsg')
  167. else:
  168. self.frame_id = str[start:end]
  169. start = end
  170. end += 4
  171. (length,) = _struct_I.unpack(str[start:end])
  172. start = end
  173. end += length
  174. if python3:
  175. self.name = str[start:end].decode('utf-8', 'rosmsg')
  176. else:
  177. self.name = str[start:end]
  178. _x = self
  179. start = end
  180. end += 56
  181. (_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,) = _get_struct_7d().unpack(str[start:end])
  182. return self
  183. except struct.error as e:
  184. raise genpy.DeserializationError(e) # most likely buffer underfill
  185. _struct_I = genpy.struct_I
  186. def _get_struct_I():
  187. global _struct_I
  188. return _struct_I
  189. _struct_7d = None
  190. def _get_struct_7d():
  191. global _struct_7d
  192. if _struct_7d is None:
  193. _struct_7d = struct.Struct("<7d")
  194. return _struct_7d