Class: Nav_msgs::MapMetaData

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

Constant Summary collapse

@@struct_L2fL2d7 =
::ROS::Struct.new("L2fL2d7")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['time','float32','uint32','uint32','geometry_msgs/Pose']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ MapMetaData

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :map_load_time (time)

    initialize value

  • :resolution (float32)

    initialize value

  • :width (uint32)

    initialize value

  • :height (uint32)

    initialize value

  • :origin (geometry_msgs/Pose)

    initialize value



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/nav_msgs/MapMetaData.rb', line 77

def initialize(args={})
  # message fields cannot be None, assign default values for those that are
  if args[:map_load_time]
    @map_load_time = args[:map_load_time]
  else
    @map_load_time = ROS::Time.new
  end
  if args[:resolution]
    @resolution = args[:resolution]
  else
    @resolution = 0.0
  end
  if args[:width]
    @width = args[:width]
  else
    @width = 0
  end
  if args[:height]
    @height = args[:height]
  else
    @height = 0
  end
  if args[:origin]
    @origin = args[:origin]
  else
    @origin = Geometry_msgs::Pose.new
  end
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



62
63
64
# File 'lib/nav_msgs/MapMetaData.rb', line 62

def height
  @height
end

#map_load_timeObject

Returns the value of attribute map_load_time.



62
63
64
# File 'lib/nav_msgs/MapMetaData.rb', line 62

def map_load_time
  @map_load_time
end

#originObject

Returns the value of attribute origin.



62
63
64
# File 'lib/nav_msgs/MapMetaData.rb', line 62

def origin
  @origin
end

#resolutionObject

Returns the value of attribute resolution.



62
63
64
# File 'lib/nav_msgs/MapMetaData.rb', line 62

def resolution
  @resolution
end

#widthObject

Returns the value of attribute width.



62
63
64
# File 'lib/nav_msgs/MapMetaData.rb', line 62

def width
  @width
end

Class Method Details

.md5sumObject



12
13
14
# File 'lib/nav_msgs/MapMetaData.rb', line 12

def self.md5sum
  "10cfc8a2818024d3248802c00c95f11b"
end

.typeObject



16
17
18
# File 'lib/nav_msgs/MapMetaData.rb', line 16

def self.type
  "nav_msgs/MapMetaData"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



108
109
110
# File 'lib/nav_msgs/MapMetaData.rb', line 108

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

def deserialize(str)

  begin
    if @map_load_time == nil
      @map_load_time = ROS::Time.new
    end
    if @origin == nil
      @origin = Geometry_msgs::Pose.new
    end
    end_point = 0
    start = end_point
    end_point += ROS::Struct::calc_size('L2fL2d7')
    (@map_load_time.secs, @map_load_time.nsecs, @resolution, @width, @height, @origin.position.x, @origin.position.y, @origin.position.z, @origin.orientation.x, @origin.orientation.y, @origin.orientation.z, @origin.orientation.w,) = @@struct_L2fL2d7.unpack(str[start..(end_point-1)])
    return self
  rescue => exception
    raise "message DeserializationError: #{exception}" #most likely buffer underfill
  end
end

#has_header?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/nav_msgs/MapMetaData.rb', line 20

def has_header?
  false
end

#message_definitionObject



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
56
57
58
59
60
61
# File 'lib/nav_msgs/MapMetaData.rb', line 24

def message_definition
  "# This hold basic information about the characterists of the OccupancyGrid

# The time at which the map was loaded
time map_load_time
# The map resolution [m/cell]
float32 resolution
# Map width [cells]
uint32 width
# Map height [cells]
uint32 height
# The origin of the map [m, m, rad].  This is the real-world pose of the
# cell (0,0) in the map.
geometry_msgs/Pose origin
================================================================================
MSG: geometry_msgs/Pose
# A representation of pose in free space, composed of postion and orientation. 
Point position
Quaternion orientation

================================================================================
MSG: geometry_msgs/Point
# This contains the position of a point in free space
float64 x
float64 y
float64 z

================================================================================
MSG: geometry_msgs/Quaternion
# 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

Parameters:

  • buff (IO)

    buffer



114
115
116
117
118
119
120
121
# File 'lib/nav_msgs/MapMetaData.rb', line 114

def serialize(buff)
  begin
    buff.write(@@struct_L2fL2d7.pack(@map_load_time.secs, @map_load_time.nsecs, @resolution, @width, @height, @origin.position.x, @origin.position.y, @origin.position.z, @origin.orientation.x, @origin.orientation.y, @origin.orientation.z, @origin.orientation.w))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end