Class: Roscpp_tutorials::TwoIntsRequest
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Roscpp_tutorials::TwoIntsRequest
- Defined in:
- lib/roscpp_tutorials/TwoInts.rb
Constant Summary collapse
- @@struct_q2 =
::ROS::Struct.new("q2")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['int64','int64']
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#b ⇒ Object
Returns the value of attribute b.
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 = {}) ⇒ TwoIntsRequest
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ TwoIntsRequest
Constructor. You can set the default values using keyword operators.
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 38 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:a] @a = args[:a] else @a = 0 end if args[:b] @b = args[:b] else @b = 0 end end |
Instance Attribute Details
#a ⇒ Object
Returns the value of attribute a.
26 27 28 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 26 def a @a end |
#b ⇒ Object
Returns the value of attribute b.
26 27 28 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 26 def b @b end |
Class Method Details
.md5sum ⇒ Object
8 9 10 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 8 def self.md5sum "36d09b846be0b371c5f190354dd3153e" end |
.type ⇒ Object
12 13 14 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 12 def self.type "roscpp_tutorials/TwoIntsRequest" end |
Instance Method Details
#_get_types ⇒ String
internal API method
54 55 56 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 54 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
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 71 def deserialize(str) begin end_point = 0 start = end_point end_point += ROS::Struct::calc_size('q2') (@a, @b,) = @@struct_q2.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/roscpp_tutorials/TwoInts.rb', line 16 def has_header? false end |
#message_definition ⇒ Object
20 21 22 23 24 25 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 20 def "int64 a int64 b " end |
#serialize(buff) ⇒ Object
serialize message into buffer
60 61 62 63 64 65 66 67 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 60 def serialize(buff) begin buff.write(@@struct_q2.pack(@a, @b)) rescue => exception raise "some erro in serialize: #{exception}" end end |