Class: Visualization_msgs::Marker
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Visualization_msgs::Marker
- Defined in:
- lib/visualization_msgs/Marker.rb
Constant Summary collapse
- ARROW =
Pseudo-constants
0
- CUBE =
1
- SPHERE =
2
- CYLINDER =
3
- LINE_STRIP =
4
- LINE_LIST =
5
- CUBE_LIST =
6
- SPHERE_LIST =
7
- POINTS =
8
- TEXT_VIEW_FACING =
9
- MESH_RESOURCE =
10
- TRIANGLE_LIST =
11
- ADD =
0
- MODIFY =
0
- DELETE =
2
- @@struct_f4 =
::ROS::Struct.new("f4")
- @@struct_L3 =
::ROS::Struct.new("L3")
- @@struct_C =
::ROS::Struct.new("C")
- @@struct_l3d10f4l2C =
::ROS::Struct.new("l3d10f4l2C")
- @@struct_d3 =
::ROS::Struct.new("d3")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['Header','string','int32','int32','int32','geometry_msgs/Pose','geometry_msgs/Vector3','std_msgs/ColorRGBA','duration','bool','geometry_msgs/Point[]','std_msgs/ColorRGBA[]','string','string','bool']
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#color ⇒ Object
Returns the value of attribute color.
-
#colors ⇒ Object
Returns the value of attribute colors.
-
#frame_locked ⇒ Object
Returns the value of attribute frame_locked.
-
#header ⇒ Object
Returns the value of attribute header.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lifetime ⇒ Object
Returns the value of attribute lifetime.
-
#mesh_resource ⇒ Object
Returns the value of attribute mesh_resource.
-
#mesh_use_embedded_materials ⇒ Object
Returns the value of attribute mesh_use_embedded_materials.
-
#ns ⇒ Object
Returns the value of attribute ns.
-
#points ⇒ Object
Returns the value of attribute points.
-
#pose ⇒ Object
Returns the value of attribute pose.
-
#scale ⇒ Object
Returns the value of attribute scale.
-
#text ⇒ Object
Returns the value of attribute text.
-
#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 = {}) ⇒ Marker
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ Marker
Constructor. You can set the default values using keyword operators.
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 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/visualization_msgs/Marker.rb', line 174 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[:pose] @pose = args[:pose] else @pose = Geometry_msgs::Pose.new end if args[:scale] @scale = args[:scale] else @scale = Geometry_msgs::Vector3.new end if args[:color] @color = args[:color] else @color = Std_msgs::ColorRGBA.new end if args[:lifetime] @lifetime = args[:lifetime] else @lifetime = ROS::Duration.new end if args[:frame_locked] @frame_locked = args[:frame_locked] else @frame_locked = false end if args[:points] @points = args[:points] else @points = [] end if args[:colors] @colors = args[:colors] else @colors = [] end if args[:text] @text = args[:text] else @text = '' end if args[:mesh_resource] @mesh_resource = args[:mesh_resource] else @mesh_resource = '' end if args[:mesh_use_embedded_materials] @mesh_use_embedded_materials = args[:mesh_use_embedded_materials] else @mesh_use_embedded_materials = false end end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def action @action end |
#color ⇒ Object
Returns the value of attribute color.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def color @color end |
#colors ⇒ Object
Returns the value of attribute colors.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def colors @colors end |
#frame_locked ⇒ Object
Returns the value of attribute frame_locked.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def frame_locked @frame_locked end |
#header ⇒ Object
Returns the value of attribute header.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def header @header end |
#id ⇒ Object
Returns the value of attribute id.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def id @id end |
#lifetime ⇒ Object
Returns the value of attribute lifetime.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def lifetime @lifetime end |
#mesh_resource ⇒ Object
Returns the value of attribute mesh_resource.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def mesh_resource @mesh_resource end |
#mesh_use_embedded_materials ⇒ Object
Returns the value of attribute mesh_use_embedded_materials.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def @mesh_use_embedded_materials end |
#ns ⇒ Object
Returns the value of attribute ns.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def ns @ns end |
#points ⇒ Object
Returns the value of attribute points.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def points @points end |
#pose ⇒ Object
Returns the value of attribute pose.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def pose @pose end |
#scale ⇒ Object
Returns the value of attribute scale.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def scale @scale end |
#text ⇒ Object
Returns the value of attribute text.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def text @text end |
#type ⇒ Object
Returns the value of attribute type.
145 146 147 |
# File 'lib/visualization_msgs/Marker.rb', line 145 def type @type end |
Class Method Details
.md5sum ⇒ Object
15 16 17 |
# File 'lib/visualization_msgs/Marker.rb', line 15 def self.md5sum "18326976df9d29249efc939e00342cde" end |
.type ⇒ Object
19 20 21 |
# File 'lib/visualization_msgs/Marker.rb', line 19 def self.type "visualization_msgs/Marker" end |
Instance Method Details
#_get_types ⇒ String
internal API method
255 256 257 |
# File 'lib/visualization_msgs/Marker.rb', line 255 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
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/visualization_msgs/Marker.rb', line 298 def deserialize(str) begin if @header == nil @header = Std_msgs::Header.new end if @pose == nil @pose = Geometry_msgs::Pose.new end if @scale == nil @scale = Geometry_msgs::Vector3.new end if @color == nil @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('l3d10f4l2C') (@id, @type, @action, @pose.position.x, @pose.position.y, @pose.position.z, @pose.orientation.x, @pose.orientation.y, @pose.orientation.z, @pose.orientation.w, @scale.x, @scale.y, @scale.z, @color.r, @color.g, @color.b, @color.a, @lifetime.secs, @lifetime.nsecs, @frame_locked,) = @@struct_l3d10f4l2C.unpack(str[start..(end_point-1)]) @frame_locked = bool(@frame_locked) 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)]) @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)]) @colors.push(val1) end start = end_point end_point += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) start = end_point end_point += length @text = 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 @mesh_resource = str[start..(end_point-1)] start = end_point end_point += ROS::Struct::calc_size('C') (@mesh_use_embedded_materials,) = @@struct_C.unpack(str[start..(end_point-1)]) @mesh_use_embedded_materials = bool(@mesh_use_embedded_materials) return self rescue => exception raise "message DeserializationError: #{exception}" #most likely buffer underfill end end |
#has_header? ⇒ Boolean
23 24 25 |
# File 'lib/visualization_msgs/Marker.rb', line 23 def has_header? true end |
#message_definition ⇒ Object
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 83 84 85 86 87 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 |
# File 'lib/visualization_msgs/Marker.rb', line 27 def "# See http://www.ros.org/wiki/rviz/DisplayTypes/Marker and http://www.ros.org/wiki/rviz/Tutorials/Markers%3A%20Basic%20Shapes for more information on using this message with rviz uint8 ARROW=0 uint8 CUBE=1 uint8 SPHERE=2 uint8 CYLINDER=3 uint8 LINE_STRIP=4 uint8 LINE_LIST=5 uint8 CUBE_LIST=6 uint8 SPHERE_LIST=7 uint8 POINTS=8 uint8 TEXT_VIEW_FACING=9 uint8 MESH_RESOURCE=10 uint8 TRIANGLE_LIST=11 uint8 ADD=0 uint8 MODIFY=0 uint8 DELETE=2 Header header # header for time/frame information string ns # Namespace to place this object in... used in conjunction with id to create a unique name for the object int32 id # object ID useful in conjunction with the namespace for manipulating and deleting the object later int32 type # Type of object int32 action # 0 add/modify an object, 1 (deprecated), 2 deletes an object geometry_msgs/Pose pose # Pose of the object geometry_msgs/Vector3 scale # Scale of the object 1,1,1 means default (usually 1 meter square) std_msgs/ColorRGBA color # Color [0.0-1.0] duration lifetime # How long the object should last before being automatically deleted. 0 means forever bool frame_locked # If this marker should be frame-locked, i.e. retransformed into its frame every timestep #Only used if the type specified has some use for them (eg. POINTS, LINE_STRIP, ...) geometry_msgs/Point[] points #Only used if the type specified has some use for them (eg. POINTS, LINE_STRIP, ...) #number of colors must either be 0 or equal to the number of points #NOTE: alpha is not yet used std_msgs/ColorRGBA[] colors # NOTE: only used for text markers string text # NOTE: only used for MESH_RESOURCE markers string mesh_resource bool mesh_use_embedded_materials ================================================================================ 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/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 ================================================================================ MSG: geometry_msgs/Vector3 # This represents a vector 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
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 291 292 293 294 |
# File 'lib/visualization_msgs/Marker.rb', line 261 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_l3d10f4l2C.pack(@id, @type, @action, @pose.position.x, @pose.position.y, @pose.position.z, @pose.orientation.x, @pose.orientation.y, @pose.orientation.z, @pose.orientation.w, @scale.x, @scale.y, @scale.z, @color.r, @color.g, @color.b, @color.a, @lifetime.secs, @lifetime.nsecs, @frame_locked)) 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 = @colors.length buff.write(@@struct_L.pack(length)) for val1 in @colors _x = val1 buff.write(@@struct_f4.pack(_x.r, _x.g, _x.b, _x.a)) end _x = @text length = _x.length buff.write([length, _x].pack("La#{length}")) _x = @mesh_resource length = _x.length buff.write([length, _x].pack("La#{length}")) buff.write(@@struct_C.pack(@mesh_use_embedded_materials)) rescue => exception raise "some erro in serialize: #{exception}" end end |