Class: Geometry_msgs::TwistWithCovariance
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Geometry_msgs::TwistWithCovariance
- 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
-
#covariance ⇒ Object
Returns the value of attribute covariance.
-
#twist ⇒ Object
Returns the value of attribute twist.
Class Method Summary collapse
Instance Method Summary collapse
-
#_get_types ⇒ String
internal API method.
-
#deserialize(str) ⇒ Object
unpack serialized message in str into this message instance @param [String] str: byte array of serialized message.
- #has_header? ⇒ Boolean
-
#initialize(args = {}) ⇒ TwistWithCovariance
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ TwistWithCovariance
Constructor. You can set the default values using keyword operators.
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
#covariance ⇒ Object
Returns the value of attribute covariance.
48 49 50 |
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 48 def covariance @covariance end |
#twist ⇒ Object
Returns the value of attribute twist.
48 49 50 |
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 48 def twist @twist end |
Class Method Details
.md5sum ⇒ Object
10 11 12 |
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 10 def self.md5sum "1fe8a28e6890a4cc3ae4c3ca5c7d82e6" end |
.type ⇒ Object
14 15 16 |
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 14 def self.type "geometry_msgs/TwistWithCovariance" end |
Instance Method Details
#_get_types ⇒ String
internal API method
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
18 19 20 |
# File 'lib/geometry_msgs/TwistWithCovariance.rb', line 18 def has_header? false end |
#message_definition ⇒ Object
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 "# 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
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 |