sphere_mixed.h

00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000  Brian Gerkey et al.
00004  *
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 #include <stdint.h>
00023 
00024 #include <libplayercore/playercore.h>
00025 #include <libplayercore/error.h>
00026 
00027 #include "v4lcapture.h"
00028 
00029 #define PLAYER_CAMERA_FORMAT_RGB 6
00030 #define PLAYER_CAMERA_FORMAT_YUV420P 7
00031 
00032 // Time for timestamps
00033 extern PlayerTime *GlobalTime;
00034 
00036 // The class for the driver
00037 class SphereDriver : public Driver
00038 {
00039   public:
00040 
00041     // Constructor; need that
00042     SphereDriver(ConfigFile* cf, int section);
00043 
00044     // Must implement the following methods.
00045     int Setup();
00046     int Shutdown();
00047     // Main function for device thread.
00048     virtual void Main();
00049 
00050     // This method will be invoked on each incoming message
00051     virtual int ProcessMessage(QueuePointer & resp_queue,
00052                                player_msghdr * hdr,
00053                                void * data);
00054     //void ProcessConfig();
00055     void ProcessCommand(player_msghdr_t* hdr, player_ptz_cmd_t &data);
00056     void RefreshData();
00057 
00058  private:
00059 
00060     void YUV422toRGB(uint8_t* argInputData, uint8_t* argOutputData);
00061 
00062     inline double LimitPan(double argP)
00063     {return (argP < mPanMin) ? mPanMin : ((argP > mPanMax) ? mPanMax : argP);};
00064     inline double LimitTilt(double argT)
00065     {return (argT < mTiltMin) ? mTiltMin : ((argT > mTiltMax) ? mTiltMax : argT);};
00066 
00067     // Camera interface
00068     player_devaddr_t       mCameraAddr;
00069     player_camera_data_t   mCameraData;
00070     // PTZ interface
00071     player_devaddr_t    mPtzAddr;
00072     player_ptz_data_t   mPtzData;
00073     player_ptz_cmd_t    mPtzCmd;
00074 
00075     int32_t mSleep;
00076     int32_t mFrameRate;
00077     int32_t mShutterSpeed;
00078     int32_t mCompressionPreference;
00079     int32_t mAutomaticGain;
00080     int32_t mSharpness;
00081     int32_t mBacklight;
00082     int32_t mFlicker;
00083     int32_t mNoiseReduction;
00084     int32_t mDumpSettings;
00085     int32_t mDebug;
00086     const char *mAutomaticWb;
00087 
00088     double mPanMin;
00089     double mPanMax;
00090     double mTiltMin;
00091     double mTiltMax;
00092 
00093     // Video device
00094     const char *mDevice;
00095     // Input source
00096     int32_t mSource;
00097 
00098     // Camera palette
00099     const char *mPalette;
00100     // Frame grabber interface
00101     FRAMEGRABBER* mFg;
00102 
00103     // The current image (local copy)
00104     FRAME* mFrame;
00105     FRAME* mRGBFrame;
00106     int32_t mFrameNumber;
00107 
00108     // Image dimensions
00109     int32_t mWidth, mHeight;
00110     // Pixel depth
00111     int32_t mDepth;
00112 
00113     // Write frames to disk?
00114     int32_t mSave;
00115 
00116 };

Last updated 12 September 2005 21:38:45