Class: Visualization_msgs::MenuEntry
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Visualization_msgs::MenuEntry
- Defined in:
- lib/visualization_msgs/MenuEntry.rb
Constant Summary collapse
- FEEDBACK =
Pseudo-constants
0
- ROSRUN =
1
- ROSLAUNCH =
2
- @@struct_C =
::ROS::Struct.new("C")
- @@struct_L2 =
::ROS::Struct.new("L2")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['uint32','uint32','string','string','uint8']
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#command_type ⇒ Object
Returns the value of attribute command_type.
-
#id ⇒ Object
Returns the value of attribute id.
-
#parent_id ⇒ Object
Returns the value of attribute parent_id.
-
#title ⇒ Object
Returns the value of attribute title.
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 = {}) ⇒ MenuEntry
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ MenuEntry
Constructor. You can set the default values using keyword operators.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 99 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:id] @id = args[:id] else @id = 0 end if args[:parent_id] @parent_id = args[:parent_id] else @parent_id = 0 end if args[:title] @title = args[:title] else @title = '' end if args[:command] @command = args[:command] else @command = '' end if args[:command_type] @command_type = args[:command_type] else @command_type = 0 end end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
83 84 85 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 83 def command @command end |
#command_type ⇒ Object
Returns the value of attribute command_type.
83 84 85 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 83 def command_type @command_type end |
#id ⇒ Object
Returns the value of attribute id.
83 84 85 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 83 def id @id end |
#parent_id ⇒ Object
Returns the value of attribute parent_id.
83 84 85 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 83 def parent_id @parent_id end |
#title ⇒ Object
Returns the value of attribute title.
83 84 85 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 83 def title @title end |
Class Method Details
.md5sum ⇒ Object
8 9 10 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 8 def self.md5sum "b90ec63024573de83b57aa93eb39be2d" end |
.type ⇒ Object
12 13 14 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 12 def self.type "visualization_msgs/MenuEntry" end |
Instance Method Details
#_get_types ⇒ String
internal API method
130 131 132 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 130 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
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 154 def deserialize(str) begin end_point = 0 start = end_point end_point += ROS::Struct::calc_size('L2') (@id, @parent_id,) = @@struct_L2.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 @title = 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 @command = str[start..(end_point-1)] start = end_point end_point += ROS::Struct::calc_size('C') (@command_type,) = @@struct_C.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/visualization_msgs/MenuEntry.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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 20 def "# MenuEntry message. # Each InteractiveMarker message has an array of MenuEntry messages. # A collection of MenuEntries together describe a # menu/submenu/subsubmenu/etc tree, though they are stored in a flat # array. The tree structure is represented by giving each menu entry # an ID number and a \"parent_id\" field. Top-level entries are the # ones with parent_id = 0. Menu entries are ordered within their # level the same way they are ordered in the containing array. Parent # entries must appear before their children. # Example: # - id = 3 # parent_id = 0 # title = \"fun\" # - id = 2 # parent_id = 0 # title = \"robot\" # - id = 4 # parent_id = 2 # title = \"pr2\" # - id = 5 # parent_id = 2 # title = \"turtle\" # # Gives a menu tree like this: # - fun # - robot # - pr2 # - turtle # ID is a number for each menu entry. Must be unique within the # control, and should never be 0. uint32 id # ID of the parent of this menu entry, if it is a submenu. If this # menu entry is a top-level entry, set parent_id to 0. uint32 parent_id # menu / entry title string title # Arguments to command indicated by command_type (below) string command # Command_type stores the type of response desired when this menu # entry is clicked. # FEEDBACK: send an InteractiveMarkerFeedback message with menu_entry_id set to this entry's id. # ROSRUN: execute \"rosrun\" with arguments given in the command field (above). # ROSLAUNCH: execute \"roslaunch\" with arguments given in the command field (above). uint8 FEEDBACK=0 uint8 ROSRUN=1 uint8 ROSLAUNCH=2 uint8 command_type " end |
#serialize(buff) ⇒ Object
serialize message into buffer
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/visualization_msgs/MenuEntry.rb', line 136 def serialize(buff) begin buff.write(@@struct_L2.pack(@id, @parent_id)) _x = @title length = _x.length buff.write([length, _x].pack("La#{length}")) _x = @command length = _x.length buff.write([length, _x].pack("La#{length}")) buff.write(@@struct_C.pack(@command_type)) rescue => exception raise "some erro in serialize: #{exception}" end end |