Class: Visualization_msgs::ImageMarker
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Visualization_msgs::ImageMarker
- Defined in:
- lib/visualization_msgs/ImageMarker.rb
Constant Summary collapse
- CIRCLE =
Pseudo-constants
0
- LINE_STRIP =
1
- LINE_LIST =
2
- POLYGON =
3
- POINTS =
4
- ADD =
0
- REMOVE =
1
- @@struct_f4 =
::ROS::Struct.new("f4")
- @@struct_L3 =
::ROS::Struct.new("L3")
- @@struct_l3d3f5Cf4l2 =
::ROS::Struct.new("l3d3f5Cf4l2")
- @@struct_d3 =
::ROS::Struct.new("d3")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['Header','string','int32','int32','int32','geometry_msgs/Point','float32','std_msgs/ColorRGBA','uint8','std_msgs/ColorRGBA','duration','geometry_msgs/Point[]','std_msgs/ColorRGBA[]']
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#fill_color ⇒ Object
Returns the value of attribute fill_color.
-
#filled ⇒ Object
Returns the value of attribute filled.
-
#header ⇒ Object
Returns the value of attribute header.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lifetime ⇒ Object
Returns the value of attribute lifetime.
-
#ns ⇒ Object
Returns the value of attribute ns.
-
#outline_color ⇒ Object
Returns the value of attribute outline_color.
-
#outline_colors ⇒ Object
Returns the value of attribute outline_colors.
-
#points ⇒ Object
Returns the value of attribute points.
-
#position ⇒ Object
Returns the value of attribute position.
-
#scale ⇒ Object
Returns the value of attribute scale.
-
#type ⇒ Object
Returns the value of attribute type.
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 = {}) ⇒ ImageMarker
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ ImageMarker
Constructor. You can set the default values using keyword operators.
118 119 120 121 122 123 124 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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 118 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[:ns] @ns = args[:ns] else @ns = '' end if args[:id] @id = args[:id] else @id = 0 end if args[:type] @type = args[:type] else @type = 0 end if args[:action] @action = args[:action] else @action = 0 end if args[:position] @position = args[:position] else @position = Geometry_msgs::Point.new end if args[:scale] @scale = args[:scale] else @scale = 0.0 end if args[:outline_color] @outline_color = args[:outline_color] else @outline_color = Std_msgs::ColorRGBA.new end if args[:filled] @filled = args[:filled] else @filled = 0 end if args[:fill_color] @fill_color = args[:fill_color] else @fill_color = Std_msgs::ColorRGBA.new end if args[:lifetime] @lifetime = args[:lifetime] else @lifetime = ROS::Duration.new end if args[:points] @points = args[:points] else @points = [] end if args[:outline_colors] @outline_colors = args[:outline_colors] else @outline_colors = [] end end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def action @action end |
#fill_color ⇒ Object
Returns the value of attribute fill_color.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def fill_color @fill_color end |
#filled ⇒ Object
Returns the value of attribute filled.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def filled @filled end |
#header ⇒ Object
Returns the value of attribute header.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def header @header end |
#id ⇒ Object
Returns the value of attribute id.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def id @id end |
#lifetime ⇒ Object
Returns the value of attribute lifetime.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def lifetime @lifetime end |
#ns ⇒ Object
Returns the value of attribute ns.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def ns @ns end |
#outline_color ⇒ Object
Returns the value of attribute outline_color.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def outline_color @outline_color end |
#outline_colors ⇒ Object
Returns the value of attribute outline_colors.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def outline_colors @outline_colors end |
#points ⇒ Object
Returns the value of attribute points.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def points @points end |
#position ⇒ Object
Returns the value of attribute position.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def position @position end |
#scale ⇒ Object
Returns the value of attribute scale.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def scale @scale end |
#type ⇒ Object
Returns the value of attribute type.
92 93 94 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 92 def type @type end |
Class Method Details
.md5sum ⇒ Object
12 13 14 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 12 def self.md5sum "1de93c67ec8858b831025a08fbf1b35c" end |
.type ⇒ Object
16 17 18 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 16 def self.type "visualization_msgs/ImageMarker" end |
Instance Method Details
#_get_types ⇒ String
internal API method
189 190 191 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 189 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
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 225 def deserialize(str) begin if @header == nil @header = Std_msgs::Header.new end if @position == nil @position = Geometry_msgs::Point.new end if @outline_color == nil @outline_color = Std_msgs::ColorRGBA.new end if @fill_color == nil @fill_color = Std_msgs::ColorRGBA.new end if @lifetime == nil @lifetime = ROS::Duration.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 += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) start = end_point end_point += length @ns = str[start..(end_point-1)] start = end_point end_point += ROS::Struct::calc_size('l3d3f5Cf4l2') (@id, @type, @action, @position.x, @position.y, @position.z, @scale, @outline_color.r, @outline_color.g, @outline_color.b, @outline_color.a, @filled, @fill_color.r, @fill_color.g, @fill_color.b, @fill_color.a, @lifetime.secs, @lifetime.nsecs,) = @@struct_l3d3f5Cf4l2.unpack(str[start..(end_point-1)]) start = end_point end_point += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) @points = [] 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)]) @points.push(val1) end start = end_point end_point += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) @outline_colors = [] length.times do val1 = Std_msgs::ColorRGBA.new _x = val1 start = end_point end_point += ROS::Struct::calc_size('f4') (_x.r, _x.g, _x.b, _x.a,) = @@struct_f4.unpack(str[start..(end_point-1)]) @outline_colors.push(val1) end return self rescue => exception raise "message DeserializationError: #{exception}" #most likely buffer underfill end end |
#has_header? ⇒ Boolean
20 21 22 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 20 def has_header? true end |
#message_definition ⇒ Object
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 78 79 80 81 82 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 24 def "uint8 CIRCLE=0 uint8 LINE_STRIP=1 uint8 LINE_LIST=2 uint8 POLYGON=3 uint8 POINTS=4 uint8 ADD=0 uint8 REMOVE=1 Header header string ns # namespace, used with id to form a unique id int32 id # unique id within the namespace int32 type # CIRCLE/LINE_STRIP/etc. int32 action # ADD/REMOVE geometry_msgs/Point position # 2D, in pixel-coords float32 scale # the diameter for a circle, etc. std_msgs/ColorRGBA outline_color uint8 filled # whether to fill in the shape with color std_msgs/ColorRGBA fill_color # color [0.0-1.0] duration lifetime # How long the object should last before being automatically deleted. 0 means forever geometry_msgs/Point[] points # used for LINE_STRIP/LINE_LIST/POINTS/etc., 2D in pixel coords std_msgs/ColorRGBA[] outline_colors # a color for each line, point, etc. ================================================================================ 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 ================================================================================ MSG: std_msgs/ColorRGBA float32 r float32 g float32 b float32 a " end |
#serialize(buff) ⇒ Object
serialize message into buffer
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 |
# File 'lib/visualization_msgs/ImageMarker.rb', line 195 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}")) _x = @ns length = _x.length buff.write([length, _x].pack("La#{length}")) buff.write(@@struct_l3d3f5Cf4l2.pack(@id, @type, @action, @position.x, @position.y, @position.z, @scale, @outline_color.r, @outline_color.g, @outline_color.b, @outline_color.a, @filled, @fill_color.r, @fill_color.g, @fill_color.b, @fill_color.a, @lifetime.secs, @lifetime.nsecs)) length = @points.length buff.write(@@struct_L.pack(length)) for val1 in @points _x = val1 buff.write(@@struct_d3.pack(_x.x, _x.y, _x.z)) end length = @outline_colors.length buff.write(@@struct_L.pack(length)) for val1 in @outline_colors _x = val1 buff.write(@@struct_f4.pack(_x.r, _x.g, _x.b, _x.a)) end rescue => exception raise "some erro in serialize: #{exception}" end end |