Class: Geometry_msgs::Pose
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Geometry_msgs::Pose
- Defined in:
- lib/geometry_msgs/Pose.rb
Constant Summary collapse
- @@struct_d7 =
::ROS::Struct.new("d7")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['geometry_msgs/Point','geometry_msgs/Quaternion']
Instance Attribute Summary collapse
-
#orientation ⇒ Object
Returns the value of attribute orientation.
-
#position ⇒ Object
Returns the value of attribute position.
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 = {}) ⇒ Pose
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ Pose
Constructor. You can set the default values using keyword operators.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/geometry_msgs/Pose.rb', line 57 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:position] @position = args[:position] else @position = Geometry_msgs::Point.new end if args[:orientation] @orientation = args[:orientation] else @orientation = Geometry_msgs::Quaternion.new end end |
Instance Attribute Details
#orientation ⇒ Object
Returns the value of attribute orientation.
45 46 47 |
# File 'lib/geometry_msgs/Pose.rb', line 45 def orientation @orientation end |
#position ⇒ Object
Returns the value of attribute position.
45 46 47 |
# File 'lib/geometry_msgs/Pose.rb', line 45 def position @position end |
Class Method Details
.md5sum ⇒ Object
10 11 12 |
# File 'lib/geometry_msgs/Pose.rb', line 10 def self.md5sum "e45d45a5a1ce597b249e23fb30fc871f" end |
.type ⇒ Object
14 15 16 |
# File 'lib/geometry_msgs/Pose.rb', line 14 def self.type "geometry_msgs/Pose" end |
Instance Method Details
#_get_types ⇒ String
internal API method
73 74 75 |
# File 'lib/geometry_msgs/Pose.rb', line 73 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
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/geometry_msgs/Pose.rb', line 90 def deserialize(str) begin if @position == nil @position = Geometry_msgs::Point.new end if @orientation == nil @orientation = Geometry_msgs::Quaternion.new end end_point = 0 start = end_point end_point += ROS::Struct::calc_size('d7') (@position.x, @position.y, @position.z, @orientation.x, @orientation.y, @orientation.z, @orientation.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/Pose.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 |
# File 'lib/geometry_msgs/Pose.rb', line 22 def "# 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
79 80 81 82 83 84 85 86 |
# File 'lib/geometry_msgs/Pose.rb', line 79 def serialize(buff) begin buff.write(@@struct_d7.pack(@position.x, @position.y, @position.z, @orientation.x, @orientation.y, @orientation.z, @orientation.w)) rescue => exception raise "some erro in serialize: #{exception}" end end |