Class: Actionlib_tutorials::AveragingResult
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Actionlib_tutorials::AveragingResult
- Defined in:
- lib/actionlib_tutorials/AveragingResult.rb
Constant Summary collapse
- @@struct_f2 =
::ROS::Struct.new("f2")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['float32','float32']
Instance Attribute Summary collapse
-
#mean ⇒ Object
Returns the value of attribute mean.
-
#std_dev ⇒ Object
Returns the value of attribute std_dev.
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 = {}) ⇒ AveragingResult
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ AveragingResult
Constructor. You can set the default values using keyword operators.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/actionlib_tutorials/AveragingResult.rb', line 40 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:mean] @mean = args[:mean] else @mean = 0.0 end if args[:std_dev] @std_dev = args[:std_dev] else @std_dev = 0.0 end end |
Instance Attribute Details
#mean ⇒ Object
Returns the value of attribute mean.
28 29 30 |
# File 'lib/actionlib_tutorials/AveragingResult.rb', line 28 def mean @mean end |
#std_dev ⇒ Object
Returns the value of attribute std_dev.
28 29 30 |
# File 'lib/actionlib_tutorials/AveragingResult.rb', line 28 def std_dev @std_dev end |
Class Method Details
.md5sum ⇒ Object
8 9 10 |
# File 'lib/actionlib_tutorials/AveragingResult.rb', line 8 def self.md5sum "d5c7decf6df75ffb4367a05c1bcc7612" end |
.type ⇒ Object
12 13 14 |
# File 'lib/actionlib_tutorials/AveragingResult.rb', line 12 def self.type "actionlib_tutorials/AveragingResult" end |
Instance Method Details
#_get_types ⇒ String
internal API method
56 57 58 |
# File 'lib/actionlib_tutorials/AveragingResult.rb', line 56 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
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/actionlib_tutorials/AveragingResult.rb', line 73 def deserialize(str) begin end_point = 0 start = end_point end_point += ROS::Struct::calc_size('f2') (@mean, @std_dev,) = @@struct_f2.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/actionlib_tutorials/AveragingResult.rb', line 16 def has_header? false end |
#message_definition ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/actionlib_tutorials/AveragingResult.rb', line 20 def "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ====== #result definition float32 mean float32 std_dev " end |
#serialize(buff) ⇒ Object
serialize message into buffer
62 63 64 65 66 67 68 69 |
# File 'lib/actionlib_tutorials/AveragingResult.rb', line 62 def serialize(buff) begin buff.write(@@struct_f2.pack(@mean, @std_dev)) rescue => exception raise "some erro in serialize: #{exception}" end end |