Waypoint.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. // Auto-generated. Do not edit!
  2. // (in-package waterplus_map_tools.msg)
  3. "use strict";
  4. const _serializer = _ros_msg_utils.Serialize;
  5. const _arraySerializer = _serializer.Array;
  6. const _deserializer = _ros_msg_utils.Deserialize;
  7. const _arrayDeserializer = _deserializer.Array;
  8. const _finder = _ros_msg_utils.Find;
  9. const _getByteLength = _ros_msg_utils.getByteLength;
  10. let geometry_msgs = _finder('geometry_msgs');
  11. //-----------------------------------------------------------
  12. class Waypoint {
  13. constructor(initObj={}) {
  14. if (initObj === null) {
  15. // initObj === null is a special case for deserialization where we don't initialize fields
  16. this.frame_id = null;
  17. this.name = null;
  18. this.pose = null;
  19. }
  20. else {
  21. if (initObj.hasOwnProperty('frame_id')) {
  22. this.frame_id = initObj.frame_id
  23. }
  24. else {
  25. this.frame_id = '';
  26. }
  27. if (initObj.hasOwnProperty('name')) {
  28. this.name = initObj.name
  29. }
  30. else {
  31. this.name = '';
  32. }
  33. if (initObj.hasOwnProperty('pose')) {
  34. this.pose = initObj.pose
  35. }
  36. else {
  37. this.pose = new geometry_msgs.msg.Pose();
  38. }
  39. }
  40. }
  41. static serialize(obj, buffer, bufferOffset) {
  42. // Serializes a message object of type Waypoint
  43. // Serialize message field [frame_id]
  44. bufferOffset = _serializer.string(obj.frame_id, buffer, bufferOffset);
  45. // Serialize message field [name]
  46. bufferOffset = _serializer.string(obj.name, buffer, bufferOffset);
  47. // Serialize message field [pose]
  48. bufferOffset = geometry_msgs.msg.Pose.serialize(obj.pose, buffer, bufferOffset);
  49. return bufferOffset;
  50. }
  51. static deserialize(buffer, bufferOffset=[0]) {
  52. //deserializes a message object of type Waypoint
  53. let len;
  54. let data = new Waypoint(null);
  55. // Deserialize message field [frame_id]
  56. data.frame_id = _deserializer.string(buffer, bufferOffset);
  57. // Deserialize message field [name]
  58. data.name = _deserializer.string(buffer, bufferOffset);
  59. // Deserialize message field [pose]
  60. data.pose = geometry_msgs.msg.Pose.deserialize(buffer, bufferOffset);
  61. return data;
  62. }
  63. static getMessageSize(object) {
  64. let length = 0;
  65. length += _getByteLength(object.frame_id);
  66. length += _getByteLength(object.name);
  67. return length + 64;
  68. }
  69. static datatype() {
  70. // Returns string type for a message object
  71. return 'waterplus_map_tools/Waypoint';
  72. }
  73. static md5sum() {
  74. //Returns md5sum for a message object
  75. return 'b5abd84eafa003e99e40f2565ee73135';
  76. }
  77. static messageDefinition() {
  78. // Returns full string definition for message
  79. return `
  80. string frame_id
  81. string name
  82. geometry_msgs/Pose pose
  83. ================================================================================
  84. MSG: geometry_msgs/Pose
  85. # A representation of pose in free space, composed of position and orientation.
  86. Point position
  87. Quaternion orientation
  88. ================================================================================
  89. MSG: geometry_msgs/Point
  90. # This contains the position of a point in free space
  91. float64 x
  92. float64 y
  93. float64 z
  94. ================================================================================
  95. MSG: geometry_msgs/Quaternion
  96. # This represents an orientation in free space in quaternion form.
  97. float64 x
  98. float64 y
  99. float64 z
  100. float64 w
  101. `;
  102. }
  103. static Resolve(msg) {
  104. // deep-construct a valid message object instance of whatever was passed in
  105. if (typeof msg !== 'object' || msg === null) {
  106. msg = {};
  107. }
  108. const resolved = new Waypoint(null);
  109. if (msg.frame_id !== undefined) {
  110. resolved.frame_id = msg.frame_id;
  111. }
  112. else {
  113. resolved.frame_id = ''
  114. }
  115. if (msg.name !== undefined) {
  116. resolved.name = msg.name;
  117. }
  118. else {
  119. resolved.name = ''
  120. }
  121. if (msg.pose !== undefined) {
  122. resolved.pose = geometry_msgs.msg.Pose.Resolve(msg.pose)
  123. }
  124. else {
  125. resolved.pose = new geometry_msgs.msg.Pose()
  126. }
  127. return resolved;
  128. }
  129. };
  130. module.exports = Waypoint;