Class: Geometry_msgs::Quaternion
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Geometry_msgs::Quaternion
- Defined in:
- lib/geometry_msgs/Quaternion.rb
Constant Summary collapse
- @@struct_d4 =
::ROS::Struct.new("d4")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['float64','float64','float64','float64']
Instance Attribute Summary collapse
-
#w ⇒ Object
Returns the value of attribute w.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
-
#z ⇒ Object
Returns the value of attribute z.
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 = {}) ⇒ Quaternion
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ Quaternion
Constructor. You can set the default values using keyword operators.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/geometry_msgs/Quaternion.rb', line 44 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:x] @x = args[:x] else @x = 0.0 end if args[:y] @y = args[:y] else @y = 0.0 end if args[:z] @z = args[:z] else @z = 0.0 end if args[:w] @w = args[:w] else @w = 0.0 end end |
Instance Attribute Details
#w ⇒ Object
Returns the value of attribute w.
30 31 32 |
# File 'lib/geometry_msgs/Quaternion.rb', line 30 def w @w end |
#x ⇒ Object
Returns the value of attribute x.
30 31 32 |
# File 'lib/geometry_msgs/Quaternion.rb', line 30 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
30 31 32 |
# File 'lib/geometry_msgs/Quaternion.rb', line 30 def y @y end |
#z ⇒ Object
Returns the value of attribute z.
30 31 32 |
# File 'lib/geometry_msgs/Quaternion.rb', line 30 def z @z end |
Class Method Details
.md5sum ⇒ Object
8 9 10 |
# File 'lib/geometry_msgs/Quaternion.rb', line 8 def self.md5sum "a779879fadf0160734f906b8c19c7004" end |
.type ⇒ Object
12 13 14 |
# File 'lib/geometry_msgs/Quaternion.rb', line 12 def self.type "geometry_msgs/Quaternion" end |
Instance Method Details
#_get_types ⇒ String
internal API method
70 71 72 |
# File 'lib/geometry_msgs/Quaternion.rb', line 70 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
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/geometry_msgs/Quaternion.rb', line 87 def deserialize(str) begin end_point = 0 start = end_point end_point += ROS::Struct::calc_size('d4') (@x, @y, @z, @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
16 17 18 |
# File 'lib/geometry_msgs/Quaternion.rb', line 16 def has_header? false end |
#message_definition ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/geometry_msgs/Quaternion.rb', line 20 def "# 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
76 77 78 79 80 81 82 83 |
# File 'lib/geometry_msgs/Quaternion.rb', line 76 def serialize(buff) begin buff.write(@@struct_d4.pack(@x, @y, @z, @w)) rescue => exception raise "some erro in serialize: #{exception}" end end |