Class: Nav_msgs::Path
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Nav_msgs::Path
- Defined in:
- lib/nav_msgs/Path.rb
Constant Summary collapse
- @@struct_d4 =
::ROS::Struct.new("d4")
- @@struct_L3 =
::ROS::Struct.new("L3")
- @@struct_L2 =
::ROS::Struct.new("L2")
- @@struct_d3 =
::ROS::Struct.new("d3")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['Header','geometry_msgs/PoseStamped[]']
Instance Attribute Summary collapse
-
#header ⇒ Object
Returns the value of attribute header.
-
#poses ⇒ Object
Returns the value of attribute poses.
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 = {}) ⇒ Path
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ Path
Constructor. You can set the default values using keyword operators.
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/nav_msgs/Path.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[:poses] @poses = args[:poses] else @poses = [] end end |
Instance Attribute Details
#header ⇒ Object
Returns the value of attribute header.
78 79 80 |
# File 'lib/nav_msgs/Path.rb', line 78 def header @header end |
#poses ⇒ Object
Returns the value of attribute poses.
78 79 80 |
# File 'lib/nav_msgs/Path.rb', line 78 def poses @poses end |
Class Method Details
.md5sum ⇒ Object
13 14 15 |
# File 'lib/nav_msgs/Path.rb', line 13 def self.md5sum "6227e2b7e9cce15051f669a5e197bbf7" end |
.type ⇒ Object
17 18 19 |
# File 'lib/nav_msgs/Path.rb', line 17 def self.type "nav_msgs/Path" end |
Instance Method Details
#_get_types ⇒ String
internal API method
109 110 111 |
# File 'lib/nav_msgs/Path.rb', line 109 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
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/nav_msgs/Path.rb', line 148 def deserialize(str) begin if @header == nil @header = Std_msgs::Header.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)]) @poses = [] length.times do val1 = Geometry_msgs::PoseStamped.new _v12 = val1.header start = end_point end_point += ROS::Struct::calc_size('L') (_v12.seq,) = @@struct_L.unpack(str[start..(end_point-1)]) _v13 = _v12.stamp _x = _v13 start = end_point end_point += ROS::Struct::calc_size('L2') (_x.secs, _x.nsecs,) = @@struct_L2.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 _v12.frame_id = str[start..(end_point-1)] _v14 = val1.pose _v15 = _v14.position _x = _v15 start = end_point end_point += ROS::Struct::calc_size('d3') (_x.x, _x.y, _x.z,) = @@struct_d3.unpack(str[start..(end_point-1)]) _v16 = _v14.orientation _x = _v16 start = end_point end_point += ROS::Struct::calc_size('d4') (_x.x, _x.y, _x.z, _x.w,) = @@struct_d4.unpack(str[start..(end_point-1)]) @poses.push(val1) end return self rescue => exception raise "message DeserializationError: #{exception}" #most likely buffer underfill end end |
#has_header? ⇒ Boolean
21 22 23 |
# File 'lib/nav_msgs/Path.rb', line 21 def has_header? true end |
#message_definition ⇒ Object
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 |
# File 'lib/nav_msgs/Path.rb', line 25 def "#An array of poses that represents a Path for a robot to follow Header header geometry_msgs/PoseStamped[] poses ================================================================================ 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/PoseStamped # A Pose with reference coordinate frame and timestamp Header header Pose pose ================================================================================ MSG: geometry_msgs/Pose # 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
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/nav_msgs/Path.rb', line 115 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}")) length = @poses.length buff.write(@@struct_L.pack(length)) for val1 in @poses _v7 = val1.header buff.write(@@struct_L.pack(_v7.seq)) _v8 = _v7.stamp _x = _v8 buff.write(@@struct_L2.pack(_x.secs, _x.nsecs)) _x = _v7.frame_id length = _x.length buff.write([length, _x].pack("La#{length}")) _v9 = val1.pose _v10 = _v9.position _x = _v10 buff.write(@@struct_d3.pack(_x.x, _x.y, _x.z)) _v11 = _v9.orientation _x = _v11 buff.write(@@struct_d4.pack(_x.x, _x.y, _x.z, _x.w)) end rescue => exception raise "some erro in serialize: #{exception}" end end |