Class: Sensor_msgs::PointField
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Sensor_msgs::PointField
- Defined in:
- lib/sensor_msgs/PointField.rb
Constant Summary collapse
- INT8 =
Pseudo-constants
1
- UINT8 =
2
- INT16 =
3
- UINT16 =
4
- INT32 =
5
- UINT32 =
6
- FLOAT32 =
7
- FLOAT64 =
8
- @@struct_LCL =
::ROS::Struct.new("LCL")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['string','uint32','uint8','uint32']
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#datatype ⇒ Object
Returns the value of attribute datatype.
-
#name ⇒ Object
Returns the value of attribute name.
-
#offset ⇒ Object
Returns the value of attribute offset.
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 = {}) ⇒ PointField
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ PointField
Constructor. You can set the default values using keyword operators.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/sensor_msgs/PointField.rb', line 63 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:name] @name = args[:name] else @name = '' end if args[:offset] @offset = args[:offset] else @offset = 0 end if args[:datatype] @datatype = args[:datatype] else @datatype = 0 end if args[:count] @count = args[:count] else @count = 0 end end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
49 50 51 |
# File 'lib/sensor_msgs/PointField.rb', line 49 def count @count end |
#datatype ⇒ Object
Returns the value of attribute datatype.
49 50 51 |
# File 'lib/sensor_msgs/PointField.rb', line 49 def datatype @datatype end |
#name ⇒ Object
Returns the value of attribute name.
49 50 51 |
# File 'lib/sensor_msgs/PointField.rb', line 49 def name @name end |
#offset ⇒ Object
Returns the value of attribute offset.
49 50 51 |
# File 'lib/sensor_msgs/PointField.rb', line 49 def offset @offset end |
Class Method Details
.md5sum ⇒ Object
8 9 10 |
# File 'lib/sensor_msgs/PointField.rb', line 8 def self.md5sum "268eacb2962780ceac86cbd17e328150" end |
.type ⇒ Object
12 13 14 |
# File 'lib/sensor_msgs/PointField.rb', line 12 def self.type "sensor_msgs/PointField" end |
Instance Method Details
#_get_types ⇒ String
internal API method
89 90 91 |
# File 'lib/sensor_msgs/PointField.rb', line 89 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
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/sensor_msgs/PointField.rb', line 109 def deserialize(str) begin end_point = 0 start = end_point end_point += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) start = end_point end_point += length @name = str[start..(end_point-1)] start = end_point end_point += ROS::Struct::calc_size('LCL') (@offset, @datatype, @count,) = @@struct_LCL.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/sensor_msgs/PointField.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 34 35 36 37 38 |
# File 'lib/sensor_msgs/PointField.rb', line 20 def "# This message holds the description of one point entry in the # PointCloud2 message format. uint8 INT8 = 1 uint8 UINT8 = 2 uint8 INT16 = 3 uint8 UINT16 = 4 uint8 INT32 = 5 uint8 UINT32 = 6 uint8 FLOAT32 = 7 uint8 FLOAT64 = 8 string name # Name of field uint32 offset # Offset from start of point struct uint8 datatype # Datatype enumeration, see above uint32 count # How many elements in the field " end |
#serialize(buff) ⇒ Object
serialize message into buffer
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/sensor_msgs/PointField.rb', line 95 def serialize(buff) begin _x = @name length = _x.length buff.write([length, _x].pack("La#{length}")) buff.write(@@struct_LCL.pack(@offset, @datatype, @count)) rescue => exception raise "some erro in serialize: #{exception}" end end |