Class: Actionlib_tutorials::AveragingFeedback

Inherits:
ROS::Message
  • Object
show all
Defined in:
lib/actionlib_tutorials/AveragingFeedback.rb

Constant Summary collapse

@@struct_lf3 =
::ROS::Struct.new("lf3")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['int32','float32','float32','float32']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ AveragingFeedback

Constructor. You can set the default values using keyword operators.

Parameters:

  • args (Hash) (defaults to: {})

    keyword for initializing values

Options Hash (args):

  • :sample (int32)

    initialize value

  • :data (float32)

    initialize value

  • :mean (float32)

    initialize value

  • :std_dev (float32)

    initialize value



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 46

def initialize(args={})
  # message fields cannot be None, assign default values for those that are
  if args[:sample]
    @sample = args[:sample]
  else
    @sample = 0
  end
  if args[:data]
    @data = args[:data]
  else
    @data = 0.0
  end
  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

#dataObject

Returns the value of attribute data.



32
33
34
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 32

def data
  @data
end

#meanObject

Returns the value of attribute mean.



32
33
34
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 32

def mean
  @mean
end

#sampleObject

Returns the value of attribute sample.



32
33
34
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 32

def sample
  @sample
end

#std_devObject

Returns the value of attribute std_dev.



32
33
34
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 32

def std_dev
  @std_dev
end

Class Method Details

.md5sumObject



8
9
10
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 8

def self.md5sum
  "9e8dfc53c2f2a032ca33fa80ec46fd4f"
end

.typeObject



12
13
14
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 12

def self.type
  "actionlib_tutorials/AveragingFeedback"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



72
73
74
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 72

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


89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 89

def deserialize(str)

  begin
    end_point = 0
    start = end_point
    end_point += ROS::Struct::calc_size('lf3')
    (@sample, @data, @mean, @std_dev,) = @@struct_lf3.unpack(str[start..(end_point-1)])
    return self
  rescue => exception
    raise "message DeserializationError: #{exception}" #most likely buffer underfill
  end
end

#has_header?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 16

def has_header?
  false
end

#message_definitionObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 20

def message_definition
  "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
#feedback
int32 sample
float32 data
float32 mean
float32 std_dev



"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



78
79
80
81
82
83
84
85
# File 'lib/actionlib_tutorials/AveragingFeedback.rb', line 78

def serialize(buff)
  begin
    buff.write(@@struct_lf3.pack(@sample, @data, @mean, @std_dev))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end