Class: Geometry_msgs::Transform
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Geometry_msgs::Transform
- 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
-
#rotation ⇒ Object
Returns the value of attribute rotation.
-
#translation ⇒ Object
Returns the value of attribute translation.
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 = {}) ⇒ Transform
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ Transform
Constructor. You can set the default values using keyword operators.
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
#rotation ⇒ Object
Returns the value of attribute rotation.
46 47 48 |
# File 'lib/geometry_msgs/Transform.rb', line 46 def rotation @rotation end |
#translation ⇒ Object
Returns the value of attribute translation.
46 47 48 |
# File 'lib/geometry_msgs/Transform.rb', line 46 def translation @translation end |
Class Method Details
.md5sum ⇒ Object
10 11 12 |
# File 'lib/geometry_msgs/Transform.rb', line 10 def self.md5sum "ac9eff44abf714214112b05d54a3cf9b" end |
.type ⇒ Object
14 15 16 |
# File 'lib/geometry_msgs/Transform.rb', line 14 def self.type "geometry_msgs/Transform" end |
Instance Method Details
#_get_types ⇒ String
internal API method
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
18 19 20 |
# File 'lib/geometry_msgs/Transform.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 |
# File 'lib/geometry_msgs/Transform.rb', line 22 def "# 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
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 |