Class: Geometry_msgs::Transform

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

Constant Summary collapse

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Transform

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :translation (geometry_msgs/Vector3)

    initialize value

  • :rotation (geometry_msgs/Quaternion)

    initialize value



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/geometry_msgs/Transform.rb', line 58

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

Instance Attribute Details

#rotationObject

Returns the value of attribute rotation.



46
47
48
# File 'lib/geometry_msgs/Transform.rb', line 46

def rotation
  @rotation
end

#translationObject

Returns the value of attribute translation.



46
47
48
# File 'lib/geometry_msgs/Transform.rb', line 46

def translation
  @translation
end

Class Method Details

.md5sumObject



10
11
12
# File 'lib/geometry_msgs/Transform.rb', line 10

def self.md5sum
  "ac9eff44abf714214112b05d54a3cf9b"
end

.typeObject



14
15
16
# File 'lib/geometry_msgs/Transform.rb', line 14

def self.type
  "geometry_msgs/Transform"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



74
75
76
# File 'lib/geometry_msgs/Transform.rb', line 74

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


91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/geometry_msgs/Transform.rb', line 91

def deserialize(str)

  begin
    if @translation == nil
      @translation = Geometry_msgs::Vector3.new
    end
    if @rotation == nil
      @rotation = Geometry_msgs::Quaternion.new
    end
    end_point = 0
    start = end_point
    end_point += ROS::Struct::calc_size('d7')
    (@translation.x, @translation.y, @translation.z, @rotation.x, @rotation.y, @rotation.z, @rotation.w,) = @@struct_d7.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)


18
19
20
# File 'lib/geometry_msgs/Transform.rb', line 18

def has_header?
  false
end

#message_definitionObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/geometry_msgs/Transform.rb', line 22

def message_definition
  "# This represents the transform between two coordinate frames in free space.

Vector3 translation
Quaternion rotation

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

float64 x
float64 y
float64 z
================================================================================
MSG: geometry_msgs/Quaternion
# This represents an orientation in free space in quaternion form.

float64 x
float64 y
float64 z
float64 w

"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



80
81
82
83
84
85
86
87
# File 'lib/geometry_msgs/Transform.rb', line 80

def serialize(buff)
  begin
    buff.write(@@struct_d7.pack(@translation.x, @translation.y, @translation.z, @rotation.x, @rotation.y, @rotation.z, @rotation.w))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end