Class: Nav_msgs::GridCells

Inherits:
ROS::Message
  • Object
show all
Defined in:
lib/nav_msgs/GridCells.rb

Constant Summary collapse

@@struct_L3 =
::ROS::Struct.new("L3")
@@struct_f2 =
::ROS::Struct.new("f2")
@@struct_d3 =
::ROS::Struct.new("d3")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['Header','float32','float32','geometry_msgs/Point[]']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ GridCells

Constructor. You can set the default values using keyword operators.

Parameters:

  • args (Hash) (defaults to: {})

    keyword for initializing values

Options Hash (args):

  • :header (Header)

    initialize value

  • :cell_width (float32)

    initialize value

  • :cell_height (float32)

    initialize value

  • :cells (geometry_msgs/Point[])

    initialize value



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/nav_msgs/GridCells.rb', line 72

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[:cell_width]
    @cell_width = args[:cell_width]
  else
    @cell_width = 0.0
  end
  if args[:cell_height]
    @cell_height = args[:cell_height]
  else
    @cell_height = 0.0
  end
  if args[:cells]
    @cells = args[:cells]
  else
    @cells = []
  end
end

Instance Attribute Details

#cell_heightObject

Returns the value of attribute cell_height.



56
57
58
# File 'lib/nav_msgs/GridCells.rb', line 56

def cell_height
  @cell_height
end

#cell_widthObject

Returns the value of attribute cell_width.



56
57
58
# File 'lib/nav_msgs/GridCells.rb', line 56

def cell_width
  @cell_width
end

#cellsObject

Returns the value of attribute cells.



56
57
58
# File 'lib/nav_msgs/GridCells.rb', line 56

def cells
  @cells
end

#headerObject

Returns the value of attribute header.



56
57
58
# File 'lib/nav_msgs/GridCells.rb', line 56

def header
  @header
end

Class Method Details

.md5sumObject



10
11
12
# File 'lib/nav_msgs/GridCells.rb', line 10

def self.md5sum
  "b9e4f5df6d28e272ebde00a3994830f5"
end

.typeObject



14
15
16
# File 'lib/nav_msgs/GridCells.rb', line 14

def self.type
  "nav_msgs/GridCells"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



98
99
100
# File 'lib/nav_msgs/GridCells.rb', line 98

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


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/nav_msgs/GridCells.rb', line 125

def deserialize(str)

  begin
    if @header == nil
      @header = Std_msgs::Header.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('f2')
    (@cell_width, @cell_height,) = @@struct_f2.unpack(str[start..(end_point-1)])
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    @cells = []
    length.times do
      val1 = Geometry_msgs::Point.new
      _x = val1
      start = end_point
      end_point += ROS::Struct::calc_size('d3')
      (_x.x, _x.y, _x.z,) = @@struct_d3.unpack(str[start..(end_point-1)])
      @cells.push(val1)
    end
    return self
  rescue => exception
    raise "message DeserializationError: #{exception}" #most likely buffer underfill
  end
end

#has_header?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/nav_msgs/GridCells.rb', line 18

def has_header?
  true
end

#message_definitionObject



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
# File 'lib/nav_msgs/GridCells.rb', line 22

def message_definition
  "#an array of cells in a 2D grid
Header header
float32 cell_width
float32 cell_height
geometry_msgs/Point[] cells

================================================================================
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/Point
# This contains the position of a point in free space
float64 x
float64 y
float64 z

"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/nav_msgs/GridCells.rb', line 104

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_f2.pack(@cell_width, @cell_height))
    length = @cells.length
    buff.write(@@struct_L.pack(length))
    for val1 in @cells
      _x = val1
      buff.write(@@struct_d3.pack(_x.x, _x.y, _x.z))
    end
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end