Class: Geometry_msgs::Wrench

Inherits:
ROS::Message
  • Object
show all
Defined in:
lib/geometry_msgs/Wrench.rb

Constant Summary collapse

@@struct_d6 =
::ROS::Struct.new("d6")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['geometry_msgs/Vector3','geometry_msgs/Vector3']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Wrench

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :force (geometry_msgs/Vector3)

    initialize value

  • :torque (geometry_msgs/Vector3)

    initialize value



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/geometry_msgs/Wrench.rb', line 48

def initialize(args={})
  # message fields cannot be None, assign default values for those that are
  if args[:force]
    @force = args[:force]
  else
    @force = Geometry_msgs::Vector3.new
  end
  if args[:torque]
    @torque = args[:torque]
  else
    @torque = Geometry_msgs::Vector3.new
  end
end

Instance Attribute Details

#forceObject

Returns the value of attribute force.



36
37
38
# File 'lib/geometry_msgs/Wrench.rb', line 36

def force
  @force
end

#torqueObject

Returns the value of attribute torque.



36
37
38
# File 'lib/geometry_msgs/Wrench.rb', line 36

def torque
  @torque
end

Class Method Details

.md5sumObject



9
10
11
# File 'lib/geometry_msgs/Wrench.rb', line 9

def self.md5sum
  "4f539cf138b23283b520fd271b567936"
end

.typeObject



13
14
15
# File 'lib/geometry_msgs/Wrench.rb', line 13

def self.type
  "geometry_msgs/Wrench"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



64
65
66
# File 'lib/geometry_msgs/Wrench.rb', line 64

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


81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/geometry_msgs/Wrench.rb', line 81

def deserialize(str)

  begin
    if @force == nil
      @force = Geometry_msgs::Vector3.new
    end
    if @torque == nil
      @torque = Geometry_msgs::Vector3.new
    end
    end_point = 0
    start = end_point
    end_point += ROS::Struct::calc_size('d6')
    (@force.x, @force.y, @force.z, @torque.x, @torque.y, @torque.z,) = @@struct_d6.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)


17
18
19
# File 'lib/geometry_msgs/Wrench.rb', line 17

def has_header?
  false
end

#message_definitionObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/geometry_msgs/Wrench.rb', line 21

def message_definition
  "# This represents force in free space, seperated into 
# it's linear and angular parts.  
Vector3  force
Vector3  torque

================================================================================
MSG: geometry_msgs/Vector3
# This represents a vector in free space. 

float64 x
float64 y
float64 z
"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



70
71
72
73
74
75
76
77
# File 'lib/geometry_msgs/Wrench.rb', line 70

def serialize(buff)
  begin
    buff.write(@@struct_d6.pack(@force.x, @force.y, @force.z, @torque.x, @torque.y, @torque.z))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end