Class: Pr2_controllers_msgs::Pr2GripperCommandFeedback

Inherits:
ROS::Message
  • Object
show all
Defined in:
lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb

Constant Summary collapse

@@struct_d2C2 =
::ROS::Struct.new("d2C2")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['float64','float64','bool','bool']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Pr2GripperCommandFeedback

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :position (float64)

    initialize value

  • :effort (float64)

    initialize value

  • :stalled (bool)

    initialize value

  • :reached_goal (bool)

    initialize value



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 44

def initialize(args={})
  # message fields cannot be None, assign default values for those that are
  if args[:position]
    @position = args[:position]
  else
    @position = 0.0
  end
  if args[:effort]
    @effort = args[:effort]
  else
    @effort = 0.0
  end
  if args[:stalled]
    @stalled = args[:stalled]
  else
    @stalled = false
  end
  if args[:reached_goal]
    @reached_goal = args[:reached_goal]
  else
    @reached_goal = false
  end
end

Instance Attribute Details

#effortObject

Returns the value of attribute effort.



30
31
32
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 30

def effort
  @effort
end

#positionObject

Returns the value of attribute position.



30
31
32
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 30

def position
  @position
end

#reached_goalObject

Returns the value of attribute reached_goal.



30
31
32
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 30

def reached_goal
  @reached_goal
end

#stalledObject

Returns the value of attribute stalled.



30
31
32
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 30

def stalled
  @stalled
end

Class Method Details

.md5sumObject



8
9
10
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 8

def self.md5sum
  "e4cbff56d3562bcf113da5a5adeef91f"
end

.typeObject



12
13
14
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 12

def self.type
  "pr2_controllers_msgs/Pr2GripperCommandFeedback"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



70
71
72
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 70

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


87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 87

def deserialize(str)

  begin
    end_point = 0
    start = end_point
    end_point += ROS::Struct::calc_size('d2C2')
    (@position, @effort, @stalled, @reached_goal,) = @@struct_d2C2.unpack(str[start..(end_point-1)])
    @stalled = bool(@stalled)
    @reached_goal = bool(@reached_goal)
    return self
  rescue => exception
    raise "message DeserializationError: #{exception}" #most likely buffer underfill
  end
end

#has_header?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 16

def has_header?
  false
end

#message_definitionObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 20

def message_definition
  "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
float64 position  # The current gripper gap size (in meters)
float64 effort    # The current effort exerted (in Newtons)
bool stalled      # True iff the gripper is exerting max effort and not moving
bool reached_goal # True iff the gripper position has reached the commanded setpoint


"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



76
77
78
79
80
81
82
83
# File 'lib/pr2_controllers_msgs/Pr2GripperCommandFeedback.rb', line 76

def serialize(buff)
  begin
    buff.write(@@struct_d2C2.pack(@position, @effort, @stalled, @reached_goal))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end