Class: Actionlib_tutorials::AveragingActionGoal

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

Constant Summary collapse

@@struct_l =
::ROS::Struct.new("l")
@@struct_L3 =
::ROS::Struct.new("L3")
@@struct_L2 =
::ROS::Struct.new("L2")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['Header','actionlib_msgs/GoalID','actionlib_tutorials/AveragingGoal']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ AveragingActionGoal

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :header (Header)

    initialize value

  • :goal_id (actionlib_msgs/GoalID)

    initialize value

  • :goal (actionlib_tutorials/AveragingGoal)

    initialize value



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/actionlib_tutorials/AveragingActionGoal.rb', line 85

def initialize(args={})
  # message fields cannot be None, assign default values for those that are
  if args[:header]
    @header = args[:header]
  else
    @header = Std_msgs::Header.new
  end
  if args[:goal_id]
    @goal_id = args[:goal_id]
  else
    @goal_id = Actionlib_msgs::GoalID.new
  end
  if args[:goal]
    @goal = args[:goal]
  else
    @goal = Actionlib_tutorials::AveragingGoal.new
  end
end

Instance Attribute Details

#goalObject

Returns the value of attribute goal.



70
71
72
# File 'lib/actionlib_tutorials/AveragingActionGoal.rb', line 70

def goal
  @goal
end

#goal_idObject

Returns the value of attribute goal_id.



70
71
72
# File 'lib/actionlib_tutorials/AveragingActionGoal.rb', line 70

def goal_id
  @goal_id
end

#headerObject

Returns the value of attribute header.



70
71
72
# File 'lib/actionlib_tutorials/AveragingActionGoal.rb', line 70

def header
  @header
end

Class Method Details

.md5sumObject



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

def self.md5sum
  "1561825b734ebd6039851c501e3fb570"
end

.typeObject



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

def self.type
  "actionlib_tutorials/AveragingActionGoal"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



106
107
108
# File 'lib/actionlib_tutorials/AveragingActionGoal.rb', line 106

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


131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/actionlib_tutorials/AveragingActionGoal.rb', line 131

def deserialize(str)

  begin
    if @header == nil
      @header = Std_msgs::Header.new
    end
    if @goal_id == nil
      @goal_id = Actionlib_msgs::GoalID.new
    end
    if @goal == nil
      @goal = Actionlib_tutorials::AveragingGoal.new
    end
    end_point = 0
    start = end_point
    end_point += ROS::Struct::calc_size('L3')
    (@header.seq, @header.stamp.secs, @header.stamp.nsecs,) = @@struct_L3.unpack(str[start..(end_point-1)])
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    start = end_point
    end_point += length
    @header.frame_id = str[start..(end_point-1)]
    start = end_point
    end_point += ROS::Struct::calc_size('L2')
    (@goal_id.stamp.secs, @goal_id.stamp.nsecs,) = @@struct_L2.unpack(str[start..(end_point-1)])
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    start = end_point
    end_point += length
    @goal_id.id = str[start..(end_point-1)]
    start = end_point
    end_point += ROS::Struct::calc_size('l')
    (@goal.samples,) = @@struct_l.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)


20
21
22
# File 'lib/actionlib_tutorials/AveragingActionGoal.rb', line 20

def has_header?
  true
end

#message_definitionObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/actionlib_tutorials/AveragingActionGoal.rb', line 24

def message_definition
  "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======

Header header
actionlib_msgs/GoalID goal_id
AveragingGoal goal

================================================================================
MSG: std_msgs/Header
# Standard metadata for higher-level stamped data types.
# This is generally used to communicate timestamped data 
# in a particular coordinate frame.
# 
# sequence ID: consecutively increasing ID 
uint32 seq
#Two-integer timestamp that is expressed as:
# * stamp.secs: seconds (stamp_secs) since epoch
# * stamp.nsecs: nanoseconds since stamp_secs
# time-handling sugar is provided by the client library
time stamp
#Frame this data is associated with
# 0: no frame
# 1: global frame
string frame_id

================================================================================
MSG: actionlib_msgs/GoalID
# The stamp should store the time at which this goal was requested.
# It is used by an action server when it tries to preempt all
# goals that were requested before a certain time
time stamp

# The id provides a way to associate feedback and
# result message with specific goal requests. The id
# specified must be unique.
string id


================================================================================
MSG: actionlib_tutorials/AveragingGoal
# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
#goal definition
int32 samples

"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/actionlib_tutorials/AveragingActionGoal.rb', line 112

def serialize(buff)
  begin
    buff.write(@@struct_L3.pack(@header.seq, @header.stamp.secs, @header.stamp.nsecs))
    _x = @header.frame_id
    length = _x.length
    buff.write([length, _x].pack("La#{length}"))
    buff.write(@@struct_L2.pack(@goal_id.stamp.secs, @goal_id.stamp.nsecs))
    _x = @goal_id.id
    length = _x.length
    buff.write([length, _x].pack("La#{length}"))
    buff.write(@@struct_l.pack(@goal.samples))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end