00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #ifndef _SNCRZ30_H_
00019 #define _SNCRZ30_H_
00020 
00021 #include <string>
00022 #include "SocketStream.h"
00023 #include "Image.h"
00024 #include "BufferedNode.h"
00025 
00026 
00027 
00028 
00029 namespace RobotFlow {
00030 
00031 class SNCRZ30 : public FD::BufferedNode{
00032 
00033  public:
00034 
00035   SNCRZ30(std::string nodeName, FD::ParameterSet params);
00036 
00037   ~SNCRZ30();
00038   
00039   SNCRZ30(const std::string &host, int port = 80);
00040 
00041   virtual void calculate(int output_id, int count, FD::Buffer &out);
00042 
00043   int connect(const std::string &host);
00044 
00045   void send_pan_tilt_absolute_position(unsigned int pan_speed, int pan_position, unsigned int tilt_speed, int tilt_position);
00046 
00047   void send_pan_tilt_relative_position(unsigned int pan_speed, int pan_position, unsigned int tilt_speed, int tilt_position);
00048 
00049   void send_zoom_position(unsigned int zoom_position);
00050 
00051   void send_focus_position(unsigned int focus_position);
00052 
00053   void send_auto_pan_tilt_speed_off();
00054 
00055   void reset();
00056 
00057   void home();
00058 
00059   virtual void initialize();
00060 
00061   void inquiry_pan_tilt(int &pan_position, int &tilt_position);
00062 
00063   void inquiry_zoom(int &zoom_position);
00064 
00065  private:
00066 
00067   int process_image_data(char* data, int data_size);
00068 
00069   int single_grab();
00070 
00071   int update_data();
00072 
00073 
00074   FD::network_socket m_imageSocket;
00075   FD::network_socket m_dataSocket;
00076 
00077 
00078   
00079   int m_panAbsInID;
00080   int m_tiltAbsInID;
00081   int m_panRelInID;
00082   int m_tiltRelInID;
00083   int m_zoomAbsInID;
00084   int m_zoomRelInID;
00085 
00086   
00087   int m_panAbsOutID;
00088   int m_tiltAbsOutID;
00089   int m_zoomOutID;
00090   int m_imageOutID;
00091 
00092   
00093   std::string m_host;
00094   int m_port;
00095   int m_panSpeed;
00096   int m_tiltSpeed;
00097   int m_transmitSpeed;
00098   bool m_continuous;
00099   bool m_wait_reply;
00100 
00101   
00102   Image m_image;
00103   int m_currentPan;
00104   int m_currentTilt;
00105   int m_currentZoom;
00106   bool m_inquiryPosition;
00107 
00108 };
00109 
00110 }
00111 
00112 #endif