Class: Geometry_msgs::PoseWithCovariance

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

Constant Summary collapse

@@struct_d36 =
::ROS::Struct.new("d36")
@@struct_d7 =
::ROS::Struct.new("d7")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['geometry_msgs/Pose','float64[36]']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ PoseWithCovariance

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :pose (geometry_msgs/Pose)

    initialize value

  • :covariance (float64[36])

    initialize value



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/geometry_msgs/PoseWithCovariance.rb', line 71

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

Instance Attribute Details

#covarianceObject

Returns the value of attribute covariance.



58
59
60
# File 'lib/geometry_msgs/PoseWithCovariance.rb', line 58

def covariance
  @covariance
end

#poseObject

Returns the value of attribute pose.



58
59
60
# File 'lib/geometry_msgs/PoseWithCovariance.rb', line 58

def pose
  @pose
end

Class Method Details

.md5sumObject



11
12
13
# File 'lib/geometry_msgs/PoseWithCovariance.rb', line 11

def self.md5sum
  "c23e848cf1b7533a8d7c259073a97e6f"
end

.typeObject



15
16
17
# File 'lib/geometry_msgs/PoseWithCovariance.rb', line 15

def self.type
  "geometry_msgs/PoseWithCovariance"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



87
88
89
# File 'lib/geometry_msgs/PoseWithCovariance.rb', line 87

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


105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/geometry_msgs/PoseWithCovariance.rb', line 105

def deserialize(str)

  begin
    if @pose == nil
      @pose = Geometry_msgs::Pose.new
    end
    end_point = 0
    start = end_point
    end_point += ROS::Struct::calc_size('d7')
    (@pose.position.x, @pose.position.y, @pose.position.z, @pose.orientation.x, @pose.orientation.y, @pose.orientation.z, @pose.orientation.w,) = @@struct_d7.unpack(str[start..(end_point-1)])
    start = end_point
    end_point += 8
    @covariance = @@struct_d36.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)


19
20
21
# File 'lib/geometry_msgs/PoseWithCovariance.rb', line 19

def has_header?
  false
end

#message_definitionObject



23
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
# File 'lib/geometry_msgs/PoseWithCovariance.rb', line 23

def message_definition
  "# This represents a pose in free space with uncertainty.

Pose pose

# Row-major representation of the 6x6 covariance matrix
# The orientation parameters use a fixed-axis representation.
# In order, the parameters are:
# (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)
float64[36] covariance

================================================================================
MSG: geometry_msgs/Pose
# A representation of pose in free space, composed of postion and orientation. 
Point position
Quaternion orientation

================================================================================
MSG: geometry_msgs/Point
# This contains the position of a point 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



93
94
95
96
97
98
99
100
101
# File 'lib/geometry_msgs/PoseWithCovariance.rb', line 93

def serialize(buff)
  begin
    buff.write(@@struct_d7.pack(@pose.position.x, @pose.position.y, @pose.position.z, @pose.orientation.x, @pose.orientation.y, @pose.orientation.z, @pose.orientation.w))
    buff.write(@@struct_d36.pack(*@covariance))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end