Class: Roscpp_tutorials::TwoIntsResponse
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Roscpp_tutorials::TwoIntsResponse
- Defined in:
- lib/roscpp_tutorials/TwoInts.rb
Constant Summary collapse
- @@struct_q =
::ROS::Struct.new("q")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['int64']
Instance Attribute Summary collapse
-
#sum ⇒ Object
Returns the value of attribute sum.
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 = {}) ⇒ TwoIntsResponse
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ TwoIntsResponse
Constructor. You can set the default values using keyword operators.
121 122 123 124 125 126 127 128 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 121 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:sum] @sum = args[:sum] else @sum = 0 end end |
Instance Attribute Details
#sum ⇒ Object
Returns the value of attribute sum.
110 111 112 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 110 def sum @sum end |
Class Method Details
.md5sum ⇒ Object
92 93 94 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 92 def self.md5sum "b88405221c77b1878a3cbbfff53428d7" end |
.type ⇒ Object
96 97 98 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 96 def self.type "roscpp_tutorials/TwoIntsResponse" end |
Instance Method Details
#_get_types ⇒ String
internal API method
132 133 134 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 132 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
149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 149 def deserialize(str) begin end_point = 0 start = end_point end_point += ROS::Struct::calc_size('q') (@sum,) = @@struct_q.unpack(str[start..(end_point-1)]) return self rescue => exception raise "message DeserializationError: #{exception}" #most likely buffer underfill end end |
#has_header? ⇒ Boolean
100 101 102 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 100 def has_header? false end |
#message_definition ⇒ Object
104 105 106 107 108 109 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 104 def "int64 sum " end |
#serialize(buff) ⇒ Object
serialize message into buffer
138 139 140 141 142 143 144 145 |
# File 'lib/roscpp_tutorials/TwoInts.rb', line 138 def serialize(buff) begin buff.write(@@struct_q.pack(@sum)) rescue => exception raise "some erro in serialize: #{exception}" end end |