Class: Sensor_msgs::RegionOfInterest
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Sensor_msgs::RegionOfInterest
- Defined in:
- lib/sensor_msgs/RegionOfInterest.rb
Constant Summary collapse
- @@struct_L4C =
::ROS::Struct.new("L4C")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['uint32','uint32','uint32','uint32','bool']
Instance Attribute Summary collapse
-
#do_rectify ⇒ Object
Returns the value of attribute do_rectify.
-
#height ⇒ Object
Returns the value of attribute height.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x_offset ⇒ Object
Returns the value of attribute x_offset.
-
#y_offset ⇒ Object
Returns the value of attribute y_offset.
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 = {}) ⇒ RegionOfInterest
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ RegionOfInterest
Constructor. You can set the default values using keyword operators.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 58 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:x_offset] @x_offset = args[:x_offset] else @x_offset = 0 end if args[:y_offset] @y_offset = args[:y_offset] else @y_offset = 0 end if args[:height] @height = args[:height] else @height = 0 end if args[:width] @width = args[:width] else @width = 0 end if args[:do_rectify] @do_rectify = args[:do_rectify] else @do_rectify = false end end |
Instance Attribute Details
#do_rectify ⇒ Object
Returns the value of attribute do_rectify.
43 44 45 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 43 def do_rectify @do_rectify end |
#height ⇒ Object
Returns the value of attribute height.
43 44 45 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 43 def height @height end |
#width ⇒ Object
Returns the value of attribute width.
43 44 45 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 43 def width @width end |
#x_offset ⇒ Object
Returns the value of attribute x_offset.
43 44 45 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 43 def x_offset @x_offset end |
#y_offset ⇒ Object
Returns the value of attribute y_offset.
43 44 45 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 43 def y_offset @y_offset end |
Class Method Details
.md5sum ⇒ Object
8 9 10 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 8 def self.md5sum "bdb633039d588fcccb441a4d43ccfe09" end |
.type ⇒ Object
12 13 14 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 12 def self.type "sensor_msgs/RegionOfInterest" end |
Instance Method Details
#_get_types ⇒ String
internal API method
89 90 91 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 89 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
106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 106 def deserialize(str) begin end_point = 0 start = end_point end_point += ROS::Struct::calc_size('L4C') (@x_offset, @y_offset, @height, @width, @do_rectify,) = @@struct_L4C.unpack(str[start..(end_point-1)]) @do_rectify = bool(@do_rectify) return self rescue => exception raise "message DeserializationError: #{exception}" #most likely buffer underfill end end |
#has_header? ⇒ Boolean
16 17 18 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 16 def has_header? false end |
#message_definition ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 20 def "# This message is used to specify a region of interest within an image. # # When used to specify the ROI setting of the camera when the image was # taken, the height and width fields should either match the height and # width fields for the associated image; or height = width = 0 # indicates that the full resolution image was captured. uint32 x_offset # Leftmost pixel of the ROI # (0 if the ROI includes the left edge of the image) uint32 y_offset # Topmost pixel of the ROI # (0 if the ROI includes the top edge of the image) uint32 height # Height of ROI uint32 width # Width of ROI # True if a distinct rectified ROI should be calculated from the \"raw\" # ROI in this message. Typically this should be False if the full image # is captured (ROI not used), and True if a subwindow is captured (ROI # used). bool do_rectify " end |
#serialize(buff) ⇒ Object
serialize message into buffer
95 96 97 98 99 100 101 102 |
# File 'lib/sensor_msgs/RegionOfInterest.rb', line 95 def serialize(buff) begin buff.write(@@struct_L4C.pack(@x_offset, @y_offset, @height, @width, @do_rectify)) rescue => exception raise "some erro in serialize: #{exception}" end end |