Class: Geometry_msgs::Polygon
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Geometry_msgs::Polygon
- Defined in:
- lib/geometry_msgs/Polygon.rb
Constant Summary collapse
- @@struct_f3 =
::ROS::Struct.new("f3")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['geometry_msgs/Point32[]']
Instance Attribute Summary collapse
-
#points ⇒ Object
Returns the value of attribute points.
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 = {}) ⇒ Polygon
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ Polygon
Constructor. You can set the default values using keyword operators.
51 52 53 54 55 56 57 58 |
# File 'lib/geometry_msgs/Polygon.rb', line 51 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:points] @points = args[:points] else @points = [] end end |
Instance Attribute Details
#points ⇒ Object
Returns the value of attribute points.
40 41 42 |
# File 'lib/geometry_msgs/Polygon.rb', line 40 def points @points end |
Class Method Details
.md5sum ⇒ Object
9 10 11 |
# File 'lib/geometry_msgs/Polygon.rb', line 9 def self.md5sum "cd60a26494a087f577976f0329fa120e" end |
.type ⇒ Object
13 14 15 |
# File 'lib/geometry_msgs/Polygon.rb', line 13 def self.type "geometry_msgs/Polygon" end |
Instance Method Details
#_get_types ⇒ String
internal API method
62 63 64 |
# File 'lib/geometry_msgs/Polygon.rb', line 62 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
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/geometry_msgs/Polygon.rb', line 84 def deserialize(str) begin end_point = 0 start = end_point end_point += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) @points = [] length.times do val1 = Geometry_msgs::Point32.new _x = val1 start = end_point end_point += ROS::Struct::calc_size('f3') (_x.x, _x.y, _x.z,) = @@struct_f3.unpack(str[start..(end_point-1)]) @points.push(val1) end return self rescue => exception raise "message DeserializationError: #{exception}" #most likely buffer underfill end end |
#has_header? ⇒ Boolean
17 18 19 |
# File 'lib/geometry_msgs/Polygon.rb', line 17 def has_header? false end |
#message_definition ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/geometry_msgs/Polygon.rb', line 21 def "#A specification of a polygon where the first and last points are assumed to be connected Point32[] points ================================================================================ MSG: geometry_msgs/Point32 # 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
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/geometry_msgs/Polygon.rb', line 68 def serialize(buff) begin length = @points.length buff.write(@@struct_L.pack(length)) for val1 in @points _x = val1 buff.write(@@struct_f3.pack(_x.x, _x.y, _x.z)) end rescue => exception raise "some erro in serialize: #{exception}" end end |