iCub-main
Loading...
Searching...
No Matches
DragonflyDeviceDriver2.h
Go to the documentation of this file.
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3/*
4 * Copyright (C) 2007 RobotCub Consortium
5 * Author: Alessandro Scalzo alessandro.scalzo@iit.it
6 * CopyPolicy: Released under the terms of the GNU GPL v2.0.
7 *
8 */
9
10#ifndef __DragonflyDeviceDriver2h__
11#define __DragonflyDeviceDriver2h__
12
13//=============================================================================
14// YARP Includes
15//=============================================================================
16
17// May 06, readapted for YARP2 by nat
18
19#include <yarp/os/Bottle.h>
20#include <yarp/os/Stamp.h>
21#include <yarp/dev/DeviceDriver.h>
22#include <yarp/dev/IPreciselyTimed.h>
23#include <yarp/dev/IFrameGrabberControls.h>
24#include <yarp/dev/IFrameGrabberControlsDC1394.h>
25#include <yarp/dev/IFrameGrabberImage.h>
26#include <yarp/dev/IRgbVisualParams.h>
27
28namespace yarp {
29 namespace dev {
30// class Dragonfly2OpenParameters;
34 }
35}
36
41
283
288 public DeviceDriver,
289 public IPreciselyTimed,
290 public IFrameGrabberControls,
291 public IFrameGrabberControlsDC1394,
292 public IRgbVisualParams
293{
294private:
295 DragonflyDeviceDriver2(const DragonflyDeviceDriver2&);
296 void operator=(const DragonflyDeviceDriver2&);
297
298public:
302 DragonflyDeviceDriver2(bool raw = false);
303
307 virtual ~DragonflyDeviceDriver2();
308
314 virtual bool open(yarp::os::Searchable& config);
315
320 virtual bool close(void);
321
326 virtual yarp::os::Stamp getLastInputStamp();
327
333 virtual bool setBrightness(double v);
339 virtual bool setExposure(double v);
345 virtual bool setSharpness(double v);
352 virtual bool setWhiteBalance(double blue, double red);
358 virtual bool setHue(double v);
364 virtual bool setSaturation(double v);
370 virtual bool setGamma(double v);
376 virtual bool setShutter(double v);
382 virtual bool setGain(double v);
388 virtual bool setIris(double v);
389 //virtual bool setTemperature(double v);
390 //virtual bool setWhiteShading(double r,double g,double b);
391 //virtual bool setOpticalFilter(double v);
392 //virtual bool setCaptureQuality(double v);
393
398 virtual double getBrightness();
403 virtual double getExposure();
408 virtual double getSharpness();
415 virtual bool getWhiteBalance(double &blue, double &red);
420 virtual double getHue();
425 virtual double getSaturation();
430 virtual double getGamma();
435 virtual double getShutter();
440 virtual double getGain();
445 virtual double getIris();
446
447
448 //virtual double getTemperature() const;
449 //virtual double getWhiteShading() const;
450 //virtual double getOpticalFilter() const;
451 //virtual double getCaptureQuality() const;
452
453 //virtual bool setAutoBrightness(bool bAuto=true);
454
455 //virtual bool setAutoGain(bool bAuto=true);
456
457 //virtual bool setAutoShutter(bool bAuto=true);
458
459 //virtual bool setAutoWhiteBalance(bool bAuto=true);
460
461 //virtual bool setAuto(bool bAuto=true);
462
463 //virtual void PrintSettings();
464
466 // DC1394
468
474 virtual bool hasFeatureDC1394(int feature);
481 virtual bool setFeatureDC1394(int feature, double value);
487 virtual double getFeatureDC1394(int feature);
488
494 virtual bool hasOnOffDC1394(int feature);
501 virtual bool setActiveDC1394(int feature, bool onoff);
507 virtual bool getActiveDC1394(int feature);
508
514 virtual bool hasAutoDC1394(int feature);
520 virtual bool hasManualDC1394(int feature);
526 virtual bool hasOnePushDC1394(int feature);
533 virtual bool setModeDC1394(int feature, bool auto_onoff);
539 virtual bool getModeDC1394(int feature);
545 virtual bool setOnePushDC1394(int feature);
546
564 virtual yarp::dev::ReturnValue getVideoModeMaskDC1394(unsigned int& val);
573 virtual yarp::dev::ReturnValue getVideoModeDC1394(unsigned int& val);
583 virtual yarp::dev::ReturnValue setVideoModeDC1394(int video_mode);
584
598 virtual yarp::dev::ReturnValue getFPSMaskDC1394(unsigned int& val);
599
604 virtual yarp::dev::ReturnValue getFPSDC1394(unsigned int& val);
610 virtual yarp::dev::ReturnValue setFPSDC1394(int fps);
611
616 virtual yarp::dev::ReturnValue getISOSpeedDC1394(unsigned int& val);
622 virtual yarp::dev::ReturnValue setISOSpeedDC1394(int speed);
623
637 virtual yarp::dev::ReturnValue getColorCodingMaskDC1394(unsigned int video_mode,unsigned int& val);
642 virtual yarp::dev::ReturnValue getColorCodingDC1394(unsigned int& val);
648 virtual yarp::dev::ReturnValue setColorCodingDC1394(int coding);
649
656 virtual bool setWhiteBalanceDC1394(double b, double r);
663 virtual bool getWhiteBalanceDC1394(double &b, double &r);
664
675 virtual yarp::dev::ReturnValue getFormat7MaxWindowDC1394(unsigned int &xdim,unsigned int &ydim,unsigned int &xstep,unsigned int &ystep,unsigned int &xoffstep,unsigned int &yoffstep);
676
685 virtual yarp::dev::ReturnValue getFormat7WindowDC1394(unsigned int &xdim,unsigned int &ydim,int &x0,int &y0);
694 virtual yarp::dev::ReturnValue setFormat7WindowDC1394(unsigned int xdim,unsigned int ydim,int x0,int y0);
695
701 virtual yarp::dev::ReturnValue setOperationModeDC1394(bool b1394b);
706 virtual yarp::dev::ReturnValue getOperationModeDC1394(bool& b1394);
707
713 virtual yarp::dev::ReturnValue setTransmissionDC1394(bool bTxON);
718 virtual yarp::dev::ReturnValue getTransmissionDC1394(bool& bTxON);
719 //virtual bool setBayerDC1394(bool bON);
720 //virtual bool getBayerDC1394();
721
728 virtual yarp::dev::ReturnValue setBroadcastDC1394(bool onoff);
733 virtual yarp::dev::ReturnValue setDefaultsDC1394();
734 /*
735 * Reset camera.
736 * @return true/false upon success/failure
737 */
738 virtual yarp::dev::ReturnValue setResetDC1394();
744 virtual yarp::dev::ReturnValue setPowerDC1394(bool onoff);
750 virtual yarp::dev::ReturnValue setCaptureDC1394(bool bON);
751
757 virtual yarp::dev::ReturnValue getBytesPerPacketDC1394(unsigned int& bpp);
764 virtual yarp::dev::ReturnValue setBytesPerPacketDC1394(unsigned int bpp);
765
766 //IVisualParams
767
772 virtual int getRgbHeight();
773
778 virtual int getRgbWidth();
784
785 virtual yarp::dev::ReturnValue getRgbSupportedConfigurations(std::vector<yarp::dev::CameraConfig>& configurations);
792
793 virtual yarp::dev::ReturnValue getRgbResolution(int& width, int& height);
800
801 virtual yarp::dev::ReturnValue setRgbResolution(int width, int height);
802
810 virtual yarp::dev::ReturnValue getRgbFOV(double& horizontalFov, double& verticalFov);
811
819 virtual yarp::dev::ReturnValue setRgbFOV(double horizontalFov, double verticalFov);
820
829 virtual yarp::dev::ReturnValue getRgbIntrinsicParam(yarp::os::Property& intrinsic);
830
837 virtual yarp::dev::ReturnValue getRgbMirroring(bool& mirror);
838
845 virtual yarp::dev::ReturnValue setRgbMirroring(bool mirror);
846
847 // Control2
848
849 /* Implementation of IFrameGrabberControls2 interface */
850 virtual yarp::dev::ReturnValue getCameraDescription(CameraDescriptor& camera);
851 virtual yarp::dev::ReturnValue getActive(yarp::dev::cameraFeature_id_t feature, bool& isActive);
852 virtual yarp::dev::ReturnValue getFeature(yarp::dev::cameraFeature_id_t feature, double& value);
853 virtual yarp::dev::ReturnValue getMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode& mode);
854 virtual yarp::dev::ReturnValue hasAuto(yarp::dev::cameraFeature_id_t feature, bool& hasAuto);
855 virtual yarp::dev::ReturnValue hasFeature(yarp::dev::cameraFeature_id_t, bool& hasFeature);
856 virtual yarp::dev::ReturnValue hasManual(yarp::dev::cameraFeature_id_t, bool& hasManual);
857 virtual yarp::dev::ReturnValue hasOnePush(yarp::dev::cameraFeature_id_t feature, bool& hasOnePush);
858 virtual yarp::dev::ReturnValue hasOnOff(yarp::dev::cameraFeature_id_t feature, bool& HasOnOff);
859 virtual yarp::dev::ReturnValue setActive(cameraFeature_id_t feature, bool onoff);
860 virtual yarp::dev::ReturnValue getFeature(yarp::dev::cameraFeature_id_t feature, double& value1, double& value2);
861 virtual yarp::dev::ReturnValue setFeature(cameraFeature_id_t feature, double value);
862 virtual yarp::dev::ReturnValue setFeature(yarp::dev::cameraFeature_id_t feature, double value1, double value2);
863 virtual yarp::dev::ReturnValue setMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode mode);
864 virtual yarp::dev::ReturnValue setOnePush(yarp::dev::cameraFeature_id_t feature);
865
866protected:
868 bool raw;
869 FeatureMode TRANSL_MODE(bool mode) { return (mode ? FeatureMode::MODE_AUTO : FeatureMode::MODE_MANUAL); }
870 bool TRANSL_MODE(FeatureMode mode) { return (mode == FeatureMode::MODE_AUTO? 1 : 0); }
871};
872
885 public IFrameGrabberImage,
886 public IFrameGrabberImageRaw
887{
888private:
889 DragonflyDeviceDriver2Rgb(const DragonflyDeviceDriver2Rgb&);
890 void operator=(const DragonflyDeviceDriver2Rgb&);
891
892public:
896 DragonflyDeviceDriver2Rgb() : DragonflyDeviceDriver2(false){}
897
902
910 yarp::dev::ReturnValue getImage(yarp::sig::ImageOf<yarp::sig::PixelRgb>& image);
911
918 yarp::dev::ReturnValue getImage(yarp::sig::ImageOf<yarp::sig::PixelMono>& image);
919
924 virtual int height() const;
925
930 virtual int width() const;
931};
932
945 public IFrameGrabberImageRaw
946{
947private:
948 DragonflyDeviceDriver2Raw(const DragonflyDeviceDriver2Raw&);
949 void operator=(const DragonflyDeviceDriver2Raw&);
950
951public:
955 DragonflyDeviceDriver2Raw() : DragonflyDeviceDriver2(true){}
956
961
969 yarp::dev::ReturnValue getImage(yarp::sig::ImageOf<yarp::sig::PixelMono>& image);
970
975 virtual int height() const;
976
981 virtual int width() const;
982};
983#endif
dragonfly2raw : framegrabber device driver that can acquire raw format images in 640x480 resolution.
yarp::dev::ReturnValue getImage(yarp::sig::ImageOf< yarp::sig::PixelMono > &image)
FrameGrabber image interface, returns the last acquired frame as an rgb image.
virtual int width() const
Return the width of each frame.
virtual int height() const
Return the height of each frame.
dragonfly2 : framegrabber device driver that can acquire RGB color images in 320x240 or 640x480 resol...
yarp::dev::ReturnValue getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image)
FrameGrabber image interface, returns the last acquired frame as an rgb image.
virtual int height() const
Return the height of each frame.
virtual int width() const
Return the width of each frame.
dragonfly2 and dragonfly2raw device driver implementation.
virtual yarp::dev::ReturnValue setCaptureDC1394(bool bON)
Switch image capture ON/OFF.
virtual bool setActiveDC1394(int feature, bool onoff)
Switch feature on/off.
virtual bool getActiveDC1394(int feature)
Is feature ON or OFF?
virtual yarp::dev::ReturnValue setFeature(cameraFeature_id_t feature, double value)
virtual bool setWhiteBalance(double blue, double red)
Set White Balance.
virtual yarp::dev::ReturnValue hasOnOff(yarp::dev::cameraFeature_id_t feature, bool &HasOnOff)
virtual yarp::dev::ReturnValue setFeature(yarp::dev::cameraFeature_id_t feature, double value1, double value2)
virtual yarp::dev::ReturnValue setVideoModeDC1394(int video_mode)
Set camera acquisition mode.
virtual bool close(void)
Closes the device driver.
virtual yarp::dev::ReturnValue getVideoModeDC1394(unsigned int &val)
Get camera acquisition mode.
virtual yarp::dev::ReturnValue getFormat7MaxWindowDC1394(unsigned int &xdim, unsigned int &ydim, unsigned int &xstep, unsigned int &ystep, unsigned int &xoffstep, unsigned int &yoffstep)
Get maximum image dimensions in Format 7 mode.
virtual bool hasManualDC1394(int feature)
Has feature Manual mode?
virtual yarp::dev::ReturnValue setBytesPerPacketDC1394(unsigned int bpp)
Set Firewire communication packet size.
virtual yarp::dev::ReturnValue getBytesPerPacketDC1394(unsigned int &bpp)
Get Firewire communication packet size.
virtual double getBrightness()
Get Brightness.
virtual double getExposure()
Get Exposure.
virtual double getSharpness()
Get Sharpness.
virtual yarp::dev::ReturnValue setDefaultsDC1394()
Set camera features to default.
virtual yarp::dev::ReturnValue setTransmissionDC1394(bool bTxON)
Set image transmission ON/OFF.
virtual double getFeatureDC1394(int feature)
Get feature value.
virtual bool setOnePushDC1394(int feature)
Trigger feature One Push adjust.
virtual bool getModeDC1394(int feature)
Is feature mode Auto or Manual?
virtual bool hasAutoDC1394(int feature)
Has feature Auto mode?
virtual bool setIris(double v)
Set Iris.
virtual bool hasFeatureDC1394(int feature)
Is feature present?
virtual yarp::dev::ReturnValue getRgbFOV(double &horizontalFov, double &verticalFov)
Get the field of view (FOV) of the rgb camera.
virtual yarp::dev::ReturnValue setFPSDC1394(int fps)
Set camera framerate.
virtual yarp::dev::ReturnValue setBroadcastDC1394(bool onoff)
Set feature commands propagation ON/OFF.
virtual bool setModeDC1394(int feature, bool auto_onoff)
Switch feature Auto/Manual.
virtual int getRgbWidth()
Return the width of each frame.
virtual yarp::dev::ReturnValue getMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode &mode)
virtual yarp::dev::ReturnValue getOperationModeDC1394(bool &b1394)
Get Operation Mode.
virtual yarp::dev::ReturnValue setRgbFOV(double horizontalFov, double verticalFov)
Set the field of view (FOV) of the rgb camera.
virtual double getSaturation()
Get Saturation.
virtual bool setWhiteBalanceDC1394(double b, double r)
Set White Balance.
virtual yarp::dev::ReturnValue setRgbMirroring(bool mirror)
Set the mirroring setting of the sensor.
virtual yarp::os::Stamp getLastInputStamp()
Implements the IPreciselyTimed interface.
virtual yarp::dev::ReturnValue getRgbIntrinsicParam(yarp::os::Property &intrinsic)
Get the intrinsic parameters of the rgb camera.
virtual yarp::dev::ReturnValue getColorCodingDC1394(unsigned int &val)
Get image color coding.
virtual bool getWhiteBalanceDC1394(double &b, double &r)
Get White Balance.
virtual yarp::dev::ReturnValue getCameraDescription(CameraDescriptor &camera)
virtual yarp::dev::ReturnValue setRgbResolution(int width, int height)
Set the resolution of the rgb image from the camera.
virtual bool setGain(double v)
Set Gain.
virtual yarp::dev::ReturnValue getColorCodingMaskDC1394(unsigned int video_mode, unsigned int &val)
Get supported color coding mask.
virtual yarp::dev::ReturnValue setFormat7WindowDC1394(unsigned int xdim, unsigned int ydim, int x0, int y0)
Set image dimensions in Format 7 mode.
virtual yarp::dev::ReturnValue hasManual(yarp::dev::cameraFeature_id_t, bool &hasManual)
virtual bool hasOnOffDC1394(int feature)
Can be feature turned on/off?
virtual bool setGamma(double v)
Set Gamma.
virtual yarp::dev::ReturnValue hasOnePush(yarp::dev::cameraFeature_id_t feature, bool &hasOnePush)
virtual yarp::dev::ReturnValue getRgbSupportedConfigurations(std::vector< yarp::dev::CameraConfig > &configurations)
Get the possible configurations of the camera.
virtual bool setShutter(double v)
Set Shutter.
virtual yarp::dev::ReturnValue getFeature(yarp::dev::cameraFeature_id_t feature, double &value)
virtual yarp::dev::ReturnValue setColorCodingDC1394(int coding)
Set image color coding.
virtual yarp::dev::ReturnValue hasAuto(yarp::dev::cameraFeature_id_t feature, bool &hasAuto)
virtual yarp::dev::ReturnValue setPowerDC1394(bool onoff)
Switch camera power ON/OFF.
virtual bool hasOnePushDC1394(int feature)
Has feature Manual mode?
virtual bool setHue(double v)
Set Hue.
virtual yarp::dev::ReturnValue setMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode mode)
virtual yarp::dev::ReturnValue getISOSpeedDC1394(unsigned int &val)
Get camera Firewire ISO speed.
virtual bool setExposure(double v)
Set Exposure.
virtual yarp::dev::ReturnValue getFormat7WindowDC1394(unsigned int &xdim, unsigned int &ydim, int &x0, int &y0)
Get image dimensions in Format 7 mode.
virtual bool setSharpness(double v)
Set Sharpness.
virtual bool setSaturation(double v)
Set Saturation.
virtual int getRgbHeight()
Return the height of each frame.
virtual yarp::dev::ReturnValue getFeature(yarp::dev::cameraFeature_id_t feature, double &value1, double &value2)
virtual yarp::dev::ReturnValue setActive(cameraFeature_id_t feature, bool onoff)
virtual yarp::dev::ReturnValue getRgbResolution(int &width, int &height)
Get the resolution of the rgb image from the camera.
virtual bool getWhiteBalance(double &blue, double &red)
Get White Balance.
virtual bool open(yarp::os::Searchable &config)
Open the device driver.
virtual yarp::dev::ReturnValue getFPSMaskDC1394(unsigned int &val)
Get supported framerates mask.
virtual yarp::dev::ReturnValue getFPSDC1394(unsigned int &val)
Get camera framerate.
virtual yarp::dev::ReturnValue setOnePush(yarp::dev::cameraFeature_id_t feature)
virtual yarp::dev::ReturnValue setISOSpeedDC1394(int speed)
Set camera Firewire ISO speed.
virtual yarp::dev::ReturnValue getVideoModeMaskDC1394(unsigned int &val)
Get supported video mode mask.
virtual double getShutter()
Get Shutter.
virtual bool setBrightness(double v)
Set Brightness.
virtual bool setFeatureDC1394(int feature, double value)
Set feature value.
virtual yarp::dev::ReturnValue setResetDC1394()
virtual yarp::dev::ReturnValue getRgbMirroring(bool &mirror)
Get the mirroring setting of the sensor.
virtual yarp::dev::ReturnValue hasFeature(yarp::dev::cameraFeature_id_t, bool &hasFeature)
virtual yarp::dev::ReturnValue setOperationModeDC1394(bool b1394b)
Set Operation Mode.
virtual yarp::dev::ReturnValue getTransmissionDC1394(bool &bTxON)
Is image transmission ON or OFF?
virtual yarp::dev::ReturnValue getActive(yarp::dev::cameraFeature_id_t feature, bool &isActive)
Copyright (C) 2008 RobotCub Consortium.