Class: Geometry_msgs::TwistWithCovariance

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

Constant Summary collapse

@@struct_d36 =
::ROS::Struct.new("d36")
@@struct_d6 =
::ROS::Struct.new("d6")
@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['geometry_msgs/Twist','float64[36]']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ TwistWithCovariance

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

Parameters:

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

    keyword for initializing values

Options Hash (args):

  • :twist (geometry_msgs/Twist)

    initialize value

  • :covariance (float64[36])

    initialize value



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 61

def initialize(args={})
  # message fields cannot be None, assign default values for those that are
  if args[:twist]
    @twist = args[:twist]
  else
    @twist = Geometry_msgs::Twist.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.



48
49
50
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 48

def covariance
  @covariance
end

#twistObject

Returns the value of attribute twist.



48
49
50
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 48

def twist
  @twist
end

Class Method Details

.md5sumObject



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

def self.md5sum
  "1fe8a28e6890a4cc3ae4c3ca5c7d82e6"
end

.typeObject



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

def self.type
  "geometry_msgs/TwistWithCovariance"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



77
78
79
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 77

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


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 95

def deserialize(str)

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


18
19
20
# File 'lib/geometry_msgs/TwistWithCovariance.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
46
47
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 22

def message_definition
  "# This expresses velocity in free space with uncertianty.

Twist twist

# 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/Twist
# This expresses velocity in free space broken into it's linear and angular parts. 
Vector3  linear
Vector3  angular

================================================================================
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



83
84
85
86
87
88
89
90
91
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 83

def serialize(buff)
  begin
    buff.write(@@struct_d6.pack(@twist.linear.x, @twist.linear.y, @twist.linear.z, @twist.angular.x, @twist.angular.y, @twist.angular.z))
    buff.write(@@struct_d36.pack(*@covariance))
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end