Class: Artoo::Drivers::OpencvCapture
- Inherits:
-
Driver
- Object
- Driver
- Artoo::Drivers::OpencvCapture
- Defined in:
- lib/artoo/drivers/opencv_capture.rb
Overview
The opencv driver behaviors
Constant Summary collapse
- COMMANDS =
[:opencv].freeze
Instance Attribute Summary collapse
-
#opencv ⇒ Object
Returns the value of attribute opencv.
Instance Method Summary collapse
- #handle_frame ⇒ Object
-
#start_driver ⇒ Object
Start driver and any required connections.
Instance Attribute Details
#opencv ⇒ Object
Returns the value of attribute opencv.
11 12 13 |
# File 'lib/artoo/drivers/opencv_capture.rb', line 11 def opencv @opencv end |
Instance Method Details
#handle_frame ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/artoo/drivers/opencv_capture.rb', line 26 def handle_frame if !connection.capture.nil? frame = connection.capture.query if !frame.nil? @opencv = Artoo::Drivers::Opencv.new(frame) publish(event_topic_name("frame"), @opencv) else connection.connect end else connection.connect end end |
#start_driver ⇒ Object
Start driver and any required connections
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/artoo/drivers/opencv_capture.rb', line 13 def start_driver begin every(interval) do handle_frame end super rescue Exception => e Logger.error "Error starting Opencv driver!" Logger.error e. Logger.error e.backtrace.inspect end end |