Class: Geometry_msgs::QuaternionStamped
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Geometry_msgs::QuaternionStamped
- Defined in:
- lib/geometry_msgs/QuaternionStamped.rb
Constant Summary collapse
- @@struct_L3 =
::ROS::Struct.new("L3")
- @@struct_d4 =
::ROS::Struct.new("d4")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['Header','geometry_msgs/Quaternion']
Instance Attribute Summary collapse
-
#header ⇒ Object
Returns the value of attribute header.
-
#quaternion ⇒ Object
Returns the value of attribute quaternion.
Class Method Summary collapse
Instance Method Summary collapse
-
#_get_types ⇒ String
internal API method.
-
#deserialize(str) ⇒ Object
unpack serialized message in str into this message instance @param [String] str: byte array of serialized message.
- #has_header? ⇒ Boolean
-
#initialize(args = {}) ⇒ QuaternionStamped
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ QuaternionStamped
Constructor. You can set the default values using keyword operators.
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/geometry_msgs/QuaternionStamped.rb', line 70 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:header] @header = args[:header] else @header = Std_msgs::Header.new end if args[:quaternion] @quaternion = args[:quaternion] else @quaternion = Geometry_msgs::Quaternion.new end end |
Instance Attribute Details
#header ⇒ Object
Returns the value of attribute header.
57 58 59 |
# File 'lib/geometry_msgs/QuaternionStamped.rb', line 57 def header @header end |
#quaternion ⇒ Object
Returns the value of attribute quaternion.
57 58 59 |
# File 'lib/geometry_msgs/QuaternionStamped.rb', line 57 def quaternion @quaternion end |
Class Method Details
.md5sum ⇒ Object
10 11 12 |
# File 'lib/geometry_msgs/QuaternionStamped.rb', line 10 def self.md5sum "e57f1e547e0e1fd13504588ffc8334e2" end |
.type ⇒ Object
14 15 16 |
# File 'lib/geometry_msgs/QuaternionStamped.rb', line 14 def self.type "geometry_msgs/QuaternionStamped" end |
Instance Method Details
#_get_types ⇒ String
internal API method
86 87 88 |
# File 'lib/geometry_msgs/QuaternionStamped.rb', line 86 def _get_types @slot_types end |
#deserialize(str) ⇒ Object
unpack serialized message in str into this message instance
@param [String] str: byte array of serialized message
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/geometry_msgs/QuaternionStamped.rb', line 107 def deserialize(str) begin if @header == nil @header = Std_msgs::Header.new end if @quaternion == nil @quaternion = Geometry_msgs::Quaternion.new end end_point = 0 start = end_point end_point += ROS::Struct::calc_size('L3') (@header.seq, @header.stamp.secs, @header.stamp.nsecs,) = @@struct_L3.unpack(str[start..(end_point-1)]) start = end_point end_point += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) start = end_point end_point += length @header.frame_id = str[start..(end_point-1)] start = end_point end_point += ROS::Struct::calc_size('d4') (@quaternion.x, @quaternion.y, @quaternion.z, @quaternion.w,) = @@struct_d4.unpack(str[start..(end_point-1)]) return self rescue => exception raise "message DeserializationError: #{exception}" #most likely buffer underfill end end |
#has_header? ⇒ Boolean
18 19 20 |
# File 'lib/geometry_msgs/QuaternionStamped.rb', line 18 def has_header? true end |
#message_definition ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/geometry_msgs/QuaternionStamped.rb', line 22 def "# This represents an orientation with reference coordinate frame and timestamp. Header header Quaternion quaternion ================================================================================ MSG: std_msgs/Header # Standard metadata for higher-level stamped data types. # This is generally used to communicate timestamped data # in a particular coordinate frame. # # sequence ID: consecutively increasing ID uint32 seq #Two-integer timestamp that is expressed as: # * stamp.secs: seconds (stamp_secs) since epoch # * stamp.nsecs: nanoseconds since stamp_secs # time-handling sugar is provided by the client library time stamp #Frame this data is associated with # 0: no frame # 1: global frame string frame_id ================================================================================ MSG: geometry_msgs/Quaternion # This represents an orientation in free space in quaternion form. float64 x float64 y float64 z float64 w " end |
#serialize(buff) ⇒ Object
serialize message into buffer
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/geometry_msgs/QuaternionStamped.rb', line 92 def serialize(buff) begin buff.write(@@struct_L3.pack(@header.seq, @header.stamp.secs, @header.stamp.nsecs)) _x = @header.frame_id length = _x.length buff.write([length, _x].pack("La#{length}")) buff.write(@@struct_d4.pack(@quaternion.x, @quaternion.y, @quaternion.z, @quaternion.w)) rescue => exception raise "some erro in serialize: #{exception}" end end |