Class: Geometry_msgs::Wrench
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Geometry_msgs::Wrench
- 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
-
#force ⇒ Object
Returns the value of attribute force.
-
#torque ⇒ Object
Returns the value of attribute torque.
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 = {}) ⇒ Wrench
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ Wrench
Constructor. You can set the default values using keyword operators.
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
#force ⇒ Object
Returns the value of attribute force.
36 37 38 |
# File 'lib/geometry_msgs/Wrench.rb', line 36 def force @force end |
#torque ⇒ Object
Returns the value of attribute torque.
36 37 38 |
# File 'lib/geometry_msgs/Wrench.rb', line 36 def torque @torque end |
Class Method Details
.md5sum ⇒ Object
9 10 11 |
# File 'lib/geometry_msgs/Wrench.rb', line 9 def self.md5sum "4f539cf138b23283b520fd271b567936" end |
.type ⇒ Object
13 14 15 |
# File 'lib/geometry_msgs/Wrench.rb', line 13 def self.type "geometry_msgs/Wrench" end |
Instance Method Details
#_get_types ⇒ String
internal API method
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
17 18 19 |
# File 'lib/geometry_msgs/Wrench.rb', line 17 def has_header? false end |
#message_definition ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/geometry_msgs/Wrench.rb', line 21 def "# 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
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 |