Class: Geometry_msgs::TransformStamped
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Geometry_msgs::TransformStamped
- Defined in:
- lib/geometry_msgs/TransformStamped.rb
Constant Summary collapse
- @@struct_L3 =
::ROS::Struct.new("L3")
- @@struct_d7 =
::ROS::Struct.new("d7")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['Header','string','geometry_msgs/Transform']
Instance Attribute Summary collapse
-
#child_frame_id ⇒ Object
Returns the value of attribute child_frame_id.
-
#header ⇒ Object
Returns the value of attribute header.
-
#transform ⇒ Object
Returns the value of attribute transform.
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 = {}) ⇒ TransformStamped
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ TransformStamped
Constructor. You can set the default values using keyword operators.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 93 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:header] @header = args[:header] else @header = Std_msgs::Header.new end if args[:child_frame_id] @child_frame_id = args[:child_frame_id] else @child_frame_id = '' end if args[:transform] @transform = args[:transform] else @transform = Geometry_msgs::Transform.new end end |
Instance Attribute Details
#child_frame_id ⇒ Object
Returns the value of attribute child_frame_id.
79 80 81 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 79 def child_frame_id @child_frame_id end |
#header ⇒ Object
Returns the value of attribute header.
79 80 81 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 79 def header @header end |
#transform ⇒ Object
Returns the value of attribute transform.
79 80 81 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 79 def transform @transform end |
Class Method Details
.md5sum ⇒ Object
12 13 14 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 12 def self.md5sum "b5764a33bfeb3588febc2682852579b0" end |
.type ⇒ Object
16 17 18 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 16 def self.type "geometry_msgs/TransformStamped" end |
Instance Method Details
#_get_types ⇒ String
internal API method
114 115 116 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 114 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
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 138 def deserialize(str) begin if @header == nil @header = Std_msgs::Header.new end if @transform == nil @transform = Geometry_msgs::Transform.new end end_point = 0 start = end_point end_point += ROS::Struct::calc_size('L3') (@header.seq, @header.stamp.secs, @header.stamp.nsecs,) = @@struct_L3.unpack(str[start..(end_point-1)]) start = end_point end_point += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) start = end_point end_point += length @header.frame_id = str[start..(end_point-1)] start = end_point end_point += 4 (length,) = @@struct_L.unpack(str[start..(end_point-1)]) start = end_point end_point += length @child_frame_id = str[start..(end_point-1)] start = end_point end_point += ROS::Struct::calc_size('d7') (@transform.translation.x, @transform.translation.y, @transform.translation.z, @transform.rotation.x, @transform.rotation.y, @transform.rotation.z, @transform.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
20 21 22 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 20 def has_header? true end |
#message_definition ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 24 def "# This expresses a transform from coordinate frame header.frame_id # to the coordinate frame child_frame_id # # This message is mostly used by the # <a href=\"http://www.ros.org/wiki/tf\">tf</a> package. # See it's documentation for more information. Header header string child_frame_id # the frame id of the child frame Transform transform ================================================================================ MSG: std_msgs/Header # Standard metadata for higher-level stamped data types. # This is generally used to communicate timestamped data # in a particular coordinate frame. # # sequence ID: consecutively increasing ID uint32 seq #Two-integer timestamp that is expressed as: # * stamp.secs: seconds (stamp_secs) since epoch # * stamp.nsecs: nanoseconds since stamp_secs # time-handling sugar is provided by the client library time stamp #Frame this data is associated with # 0: no frame # 1: global frame string frame_id ================================================================================ MSG: geometry_msgs/Transform # 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
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/geometry_msgs/TransformStamped.rb', line 120 def serialize(buff) begin buff.write(@@struct_L3.pack(@header.seq, @header.stamp.secs, @header.stamp.nsecs)) _x = @header.frame_id length = _x.length buff.write([length, _x].pack("La#{length}")) _x = @child_frame_id length = _x.length buff.write([length, _x].pack("La#{length}")) buff.write(@@struct_d7.pack(@transform.translation.x, @transform.translation.y, @transform.translation.z, @transform.rotation.x, @transform.rotation.y, @transform.rotation.z, @transform.rotation.w)) rescue => exception raise "some erro in serialize: #{exception}" end end |