Now you can download a copy of these docs so you can use them offline! Download now
009/AxisCamera.h
1 /********************************************************************************
2 * Project : FIRST Motor Controller
3 * File Name : AxisCamera.h
4 * Contributors : ELF
5 * Creation Date : August 12, 2008
6 * Revision History : Source code & revision history maintained at sourceforge.WPI.edu
7 * File Description : Globally defined values for the FRC Camera API
8 *
9 * API: Because nivision.h uses C++ style comments, any file including this
10 * must be a .cpp instead of .c.
11 *
12 */
13 /*----------------------------------------------------------------------------*/
14 /* Copyright (c) FIRST 2008. All Rights Reserved. */
15 /* Open Source Software - may be modified and shared by FRC teams. The code */
16 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
17 /*----------------------------------------------------------------------------*/
18 
19 #ifndef __AXISCAMERA_H__
20 #define __AXISCAMERA_H__
21 
22 #include "nivision.h"
23 
25 #define CAMERA_PORT 80
26 
27 #define CAMERA_IMAGE_STALE_TIME_SEC 2.0
28 
29 #define MAX_BLOCKING_TIME_SEC 0.5
30 
31 /* Enumerated Types */
33 enum FrcvCameraMetric {CAM_STARTS, CAM_STOPS,
34  CAM_NUM_IMAGE, CAM_BUFFERS_WRITTEN, CAM_BLOCKING_COUNT,
35 
36  CAM_SOCKET_OPEN, CAM_SOCKET_INIT_ATTEMPTS, CAM_BLOCKING_TIMEOUT,
37  CAM_GETIMAGE_SUCCESS, CAM_GETIMAGE_FAILURE,
38 
39  CAM_STALE_IMAGE, CAM_GETIMAGE_BEFORE_INIT, CAM_GETIMAGE_BEFORE_AVAILABLE,
40  CAM_READ_JPEG_FAILURE, CAM_PID_SIGNAL_ERR,
41 
42  CAM_BAD_IMAGE_SIZE, CAM_HEADER_ERROR};
43 
44 #define CAM_NUM_METRICS 17
45 
47 IMAQ_FUNC int Priv_SetWriteFileAllowed(uint32_t enable);
48 
52 enum ImageResolution { k640x480, k320x240, k160x120 };
53 
57 enum ImageRotation { ROT_0 = 0, ROT_180 = 180 };
58 
59 
60 
61 int StartCameraTask();
62 
63 extern "C" {
64 /* Image Acquisition functions */
65 /* obtains an image from the camera server */
66 int GetImage(Image* cameraImage, double *timestamp);
67 int GetImageBlocking(Image* cameraImage, double *timestamp, double lastImageTimestamp);
68 /* obtains raw image string to send to PC */
69 int GetImageData(char** imageData, int* numBytes, double* currentImageTimestamp);
70 int GetImageDataBlocking(char** imageData, int* numBytes, double* timestamp, double lastImageTimestamp);
71 
72 /* start the camera server */
73 void StartImageAcquisition();
74 void StopImageAcquisition();
75 void StartImageSignal(int taskId);
76 
77 /* status & metrics */
78 int frcCameraInitialized();
79 int GetCameraMetric(FrcvCameraMetric metric);
80 
81 /* camera configuration */
82 int ConfigureCamera(char *configString);
83 int GetCameraSetting(char *configString, char *cameraResponse);
84 int GetImageSetting(char *configString, char *cameraResponse);
85 
86 /* camera task control */
87 
88 int StartCameraTask(int frames, int compression, ImageResolution resolution, ImageRotation rotation);
89 int StopCameraTask();
90 }
91 #endif
92 

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6