Class: Std_msgs::ColorRGBA
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Std_msgs::ColorRGBA
- Defined in:
- lib/std_msgs/ColorRGBA.rb
Constant Summary collapse
- @@struct_f4 =
::ROS::Struct.new("f4")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['float32','float32','float32','float32']
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#b ⇒ Object
Returns the value of attribute b.
-
#g ⇒ Object
Returns the value of attribute g.
-
#r ⇒ Object
Returns the value of attribute r.
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 = {}) ⇒ ColorRGBA
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ ColorRGBA
Constructor. You can set the default values using keyword operators.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/std_msgs/ColorRGBA.rb', line 42 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:r] @r = args[:r] else @r = 0.0 end if args[:g] @g = args[:g] else @g = 0.0 end if args[:b] @b = args[:b] else @b = 0.0 end if args[:a] @a = args[:a] else @a = 0.0 end end |
Instance Attribute Details
#a ⇒ Object
Returns the value of attribute a.
28 29 30 |
# File 'lib/std_msgs/ColorRGBA.rb', line 28 def a @a end |
#b ⇒ Object
Returns the value of attribute b.
28 29 30 |
# File 'lib/std_msgs/ColorRGBA.rb', line 28 def b @b end |
#g ⇒ Object
Returns the value of attribute g.
28 29 30 |
# File 'lib/std_msgs/ColorRGBA.rb', line 28 def g @g end |
#r ⇒ Object
Returns the value of attribute r.
28 29 30 |
# File 'lib/std_msgs/ColorRGBA.rb', line 28 def r @r end |
Class Method Details
.md5sum ⇒ Object
8 9 10 |
# File 'lib/std_msgs/ColorRGBA.rb', line 8 def self.md5sum "a29a96539573343b1310c73607334b00" end |
.type ⇒ Object
12 13 14 |
# File 'lib/std_msgs/ColorRGBA.rb', line 12 def self.type "std_msgs/ColorRGBA" end |
Instance Method Details
#_get_types ⇒ String
internal API method
68 69 70 |
# File 'lib/std_msgs/ColorRGBA.rb', line 68 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
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/std_msgs/ColorRGBA.rb', line 85 def deserialize(str) begin end_point = 0 start = end_point end_point += ROS::Struct::calc_size('f4') (@r, @g, @b, @a,) = @@struct_f4.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/std_msgs/ColorRGBA.rb', line 16 def has_header? false end |
#message_definition ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/std_msgs/ColorRGBA.rb', line 20 def "float32 r float32 g float32 b float32 a " end |
#serialize(buff) ⇒ Object
serialize message into buffer
74 75 76 77 78 79 80 81 |
# File 'lib/std_msgs/ColorRGBA.rb', line 74 def serialize(buff) begin buff.write(@@struct_f4.pack(@r, @g, @b, @a)) rescue => exception raise "some erro in serialize: #{exception}" end end |