Class: Geometry_msgs::Point32
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Geometry_msgs::Point32
- Defined in:
- lib/geometry_msgs/Point32.rb
Constant Summary collapse
- @@struct_f3 =
::ROS::Struct.new("f3")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['float32','float32','float32']
Instance Attribute Summary collapse
-
#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 = {}) ⇒ Point32
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ Point32
Constructor. You can set the default values using keyword operators.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/geometry_msgs/Point32.rb', line 47 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 end |
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
34 35 36 |
# File 'lib/geometry_msgs/Point32.rb', line 34 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
34 35 36 |
# File 'lib/geometry_msgs/Point32.rb', line 34 def y @y end |
#z ⇒ Object
Returns the value of attribute z.
34 35 36 |
# File 'lib/geometry_msgs/Point32.rb', line 34 def z @z end |
Class Method Details
.md5sum ⇒ Object
8 9 10 |
# File 'lib/geometry_msgs/Point32.rb', line 8 def self.md5sum "cc153912f1453b708d221682bc23d9ac" end |
.type ⇒ Object
12 13 14 |
# File 'lib/geometry_msgs/Point32.rb', line 12 def self.type "geometry_msgs/Point32" end |
Instance Method Details
#_get_types ⇒ String
internal API method
68 69 70 |
# File 'lib/geometry_msgs/Point32.rb', line 68 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
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/geometry_msgs/Point32.rb', line 85 def deserialize(str) begin end_point = 0 start = end_point end_point += ROS::Struct::calc_size('f3') (@x, @y, @z,) = @@struct_f3.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/Point32.rb', line 16 def has_header? false end |
#message_definition ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/geometry_msgs/Point32.rb', line 20 def "# This contains the position of a point in free space(with 32 bits of precision). # It is recommeded to use Point wherever possible instead of Point32. # # This recommendation is to promote interoperability. # # This message is designed to take up less space when sending # lots of points at once, as in the case of a PointCloud. float32 x float32 y float32 z " end |
#serialize(buff) ⇒ Object
serialize message into buffer
74 75 76 77 78 79 80 81 |
# File 'lib/geometry_msgs/Point32.rb', line 74 def serialize(buff) begin buff.write(@@struct_f3.pack(@x, @y, @z)) rescue => exception raise "some erro in serialize: #{exception}" end end |