Home
FAQ
Player
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

camera.h

Go to the documentation of this file.
00001 #ifndef CAMERA_H_
00002 #define CAMERA_H_
00003 
00004 #ifdef __cplusplus
00005 extern "C"
00006 {
00007 #endif
00008 
00009 #include <fcntl.h>
00010 #include <termios.h>
00011 #include <stdio.h>
00012 #include <time.h>
00013 #include <string.h>
00014 #include <stdlib.h>
00015 #include <unistd.h>
00016 
00017 /* These should NOT be redefined. */
00018 //typedef unsigned int     uint32_t;
00019 //typedef unsigned short   uint16_t;
00020 //typedef unsigned char    uint8_t;
00021 
00022 /* Instead #include playerconfig.h, which gets them in a portable way */
00023 #include "playerconfig.h"
00024 
00025 
00026 /**************************************************************************
00027                             *** CONSTANST ***
00028 **************************************************************************/
00029 #define IMAGE_WIDTH      174            // the width of the frame camera sends
00030 #define IMAGE_HEIGHT     143            // the height of the frame camera sends
00031 #define CONTRAST         5              // camera's contrast register #
00032 #define BRIGHTNESS       6              // camera's brightness register #
00033 #define COLORMODE        18             // camera's colormode register #
00034 #define RGB_AWT_ON       44             // camera's RGB auto white balance on
00035 #define RGB_AWT_OFF      40             // camera'sRGB auto white balance off
00036 #define YCRCB_AWT_ON     36             // camera'sYCrCb auto white balance on
00037 #define YCRCB_AWT_OFF    32             // camera'sYCrCb auto white balance off
00038 #define AUTOGAIN         19             // camera's autogain register #
00039 #define AUTOGAIN_ON      33             // camera's autogain on
00040 #define AUTOGAIN_OFF     32             // camera's autogain off                
00041 #define ZERO_POSITION    128            // servos' middle position as defiend by camera
00042 #define MIN_RGB          16             // camera's min rgb value
00043 #define MAX_RGB          240            // camera's max rgb value
00044 #define T_PACKET_LENGTH  50             // max length of T packet that camera returns
00045 
00046 
00047 /**************************************************************************
00048                                               *** T PACKET ***
00049 **************************************************************************/
00050 typedef struct                          // camera's output packet for tracking blobs
00051 {
00052    int middle_x, middle_y;                        // the blob entroid (image coords)
00053    int left_x;                                            // the left most corner's x value
00054    int left_y;                                            // the left msot corner's y value
00055    int right_x;                                           // the right most corner's x vlaue
00056    int right_y;                                           // the right most corner's y value
00057    int blob_area;                                   // number of pixles int he tracked regtion,
00058                                                                       // scaled and capped at 255:(pixles+4)/8
00059    int confidence;                                      // the (# of pixles/area)*256 of the bounded
00060                                                                       // rectangle and capped at 255
00061 }packet_t; 
00062 
00063 /**************************************************************************
00064                                             *** IMAGER CONFIG ***
00065 **************************************************************************/
00066 typedef struct                           // camera's internal register controlling image quality
00067 { 
00068    uint8_t subtype;                      // must be PLAYER_BLOBFINDER_SET_IMAGER_PARAMS_REQ.
00069    int16_t brightness;                   // contrast:      -1 = no change.  (0-255)
00070    int16_t contrast;                     // brightness:    -1 = no change.  (0-255)
00071    int8_t  colormode;                    // color mode:    -1 = no change.
00072                                          //                0  = RGB/auto white balance Off,
00073                                          //                1  = RGB/AutoWhiteBalance On,
00074                                          //                2  = YCrCB/AutoWhiteBalance Off, 
00075                                          //                3  = YCrCb/AWB On)  
00076   int8_t  autogain;                      // auto gain:     -1 = no change.
00077                                          //                0  = off, o
00078                                          //                1  = on.         
00079 } imager_config;
00080 
00081 /**************************************************************************
00082                                             *** CONFIG CONFIG ***
00083 **************************************************************************/
00084 typedef struct
00085 { 
00086   uint8_t subtype;                      // must be PLAYER_BLOBFINDER_SET_COLOR_REQ.
00087   int16_t rmin, rmax;                   // RGB minimum and max values (0-255)
00088   int16_t gmin, gmax;
00089   int16_t bmin, bmax;
00090 } color_config;
00091 
00092 /**************************************************************************
00093                                                 *** RGB ***
00094 **************************************************************************/
00095 typedef struct                          // RGB values
00096 {
00097         int red;
00098         int green;
00099         int blue;
00100 } rgb;
00101 
00102 /**************************************************************************
00103                                             *** CONFIG CONFIG ***
00104 **************************************************************************/
00105 typedef struct                          // camera's image
00106 {
00107   int width;
00108   int height;
00109   rgb **pixel;
00110 } image;
00111 
00112 color_config range;
00113 
00114 /**************************************************************************
00115                                               *** FUNCTION PROTOTYPES ***
00116 **************************************************************************/
00117 int  get_t_packet(int fd, packet_t *tpacket);
00118 int  set_imager_config(int fd, imager_config ic);
00119 int  get_bytes(int fd, char *buf, size_t len);
00120 int  open_port(char *devicepath);
00121 void close_port(int fd);
00122 void read_t_packet(int fd, char *tpackChars);
00123 int  set_t_packet( packet_t *tpacket, char tpack_chars[] );
00124 int  set_servo_position(int fd, int servo_num, int angle);
00125 int  get_servo_position(int fd, int servo_num);
00126 void stop_tracking(int fd);
00127 int  write_check(int fd, char *msg, int  respond_size);
00128 int  poll_mode(int fd, int on);
00129 void make_command(char *cmd, int *n, size_t size, char *fullCommand);
00130 int  auto_servoing(int fd, int on);
00131 void track_blob(int fd, color_config cc);
00132 
00133 #ifdef __cplusplus
00134 }
00135 #endif
00136 
00137 #endif

Generated on Tue May 3 14:15:33 2005 for Player by doxygen 1.3.6