Class: Rosgraph_msgs::Log
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Rosgraph_msgs::Log
- Defined in:
- lib/rosgraph_msgs/Log.rb
Constant Summary collapse
- DEBUG =
Pseudo-constants
1
- INFO =
2
- WARN =
4
- ERROR =
8
- FATAL =
16
- @@struct_L3 =
::ROS::Struct.new("L3")
- @@struct_c =
::ROS::Struct.new("c")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['Header','byte','string','string','string','string','uint32','string[]']
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#function ⇒ Object
Returns the value of attribute function.
-
#header ⇒ Object
Returns the value of attribute header.
-
#level ⇒ Object
Returns the value of attribute level.
-
#line ⇒ Object
Returns the value of attribute line.
-
#msg ⇒ Object
Returns the value of attribute msg.
-
#name ⇒ Object
Returns the value of attribute name.
-
#topics ⇒ Object
Returns the value of attribute topics.
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 = {}) ⇒ Log
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ Log
Constructor. You can set the default values using keyword operators.
88 89 90 91 92 93 94 95 96 97 98 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 127 128 129 130 |
# File 'lib/rosgraph_msgs/Log.rb', line 88 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[:level] @level = args[:level] else @level = 0 end if args[:name] @name = args[:name] else @name = '' end if args[:msg] @msg = args[:msg] else @msg = '' end if args[:file] @file = args[:file] else @file = '' end if args[:function] @function = args[:function] else @function = '' end if args[:line] @line = args[:line] else @line = 0 end if args[:topics] @topics = args[:topics] else @topics = [] end end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
69 70 71 |
# File 'lib/rosgraph_msgs/Log.rb', line 69 def file @file end |
#function ⇒ Object
Returns the value of attribute function.
69 70 71 |
# File 'lib/rosgraph_msgs/Log.rb', line 69 def function @function end |
#header ⇒ Object
Returns the value of attribute header.
69 70 71 |
# File 'lib/rosgraph_msgs/Log.rb', line 69 def header @header end |
#level ⇒ Object
Returns the value of attribute level.
69 70 71 |
# File 'lib/rosgraph_msgs/Log.rb', line 69 def level @level end |
#line ⇒ Object
Returns the value of attribute line.
69 70 71 |
# File 'lib/rosgraph_msgs/Log.rb', line 69 def line @line end |
#msg ⇒ Object
Returns the value of attribute msg.
69 70 71 |
# File 'lib/rosgraph_msgs/Log.rb', line 69 def msg @msg end |
#name ⇒ Object
Returns the value of attribute name.
69 70 71 |
# File 'lib/rosgraph_msgs/Log.rb', line 69 def name @name end |
#topics ⇒ Object
Returns the value of attribute topics.
69 70 71 |
# File 'lib/rosgraph_msgs/Log.rb', line 69 def topics @topics end |
Class Method Details
.md5sum ⇒ Object
9 10 11 |
# File 'lib/rosgraph_msgs/Log.rb', line 9 def self.md5sum "acffd30cd6b6de30f120938c17c593fb" end |
.type ⇒ Object
13 14 15 |
# File 'lib/rosgraph_msgs/Log.rb', line 13 def self.type "rosgraph_msgs/Log" end |
Instance Method Details
#_get_types ⇒ String
internal API method
134 135 136 |
# File 'lib/rosgraph_msgs/Log.rb', line 134 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
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/rosgraph_msgs/Log.rb', line 174 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('c') (@level,) = @@struct_c.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 @name = 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 @msg = 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 @file = 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 @function = str[start..(end_point-1)] start = end_point end_point += ROS::Struct::calc_size('L') (@line,) = @@struct_L.unpack(str[start..(end_point-1)]) start = end_point end_point += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) @topics = [] length.times do start = end_point end_point += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) start = end_point end_point += length val1 = str[start..(end_point-1)] @topics.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/rosgraph_msgs/Log.rb', line 17 def has_header? true end |
#message_definition ⇒ Object
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 |
# File 'lib/rosgraph_msgs/Log.rb', line 21 def "## ## Severity level constants ## byte DEBUG=1 #debug level byte INFO=2 #general level byte WARN=4 #warning level byte ERROR=8 #error level byte FATAL=16 #fatal/critical level ## ## Fields ## Header header byte level string name # name of the node string msg # message string file # file the message came from string function # function the message came from uint32 line # line the message came from string[] topics # topic names that the node publishes ================================================================================ 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 " end |
#serialize(buff) ⇒ Object
serialize message into buffer
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/rosgraph_msgs/Log.rb', line 140 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_c.pack(@level)) _x = @name length = _x.length buff.write([length, _x].pack("La#{length}")) _x = @msg length = _x.length buff.write([length, _x].pack("La#{length}")) _x = @file length = _x.length buff.write([length, _x].pack("La#{length}")) _x = @function length = _x.length buff.write([length, _x].pack("La#{length}")) buff.write(@@struct_L.pack(@line)) length = @topics.length buff.write(@@struct_L.pack(length)) for val1 in @topics length = val1.length buff.write([length, val1].pack("La#{length}")) end rescue => exception raise "some erro in serialize: #{exception}" end end |