24 framegrabber47::framegrabber47(
int argc,
char **argv)
throw (AOException) : framegrabber<short>(argc, argv)
26 init_framegrabber47();
29 framegrabber47::framegrabber47(std::string name,
const std::string &conffile)
throw (AOException) : framegrabber<short>(name, conffile)
31 init_framegrabber47();
34 void framegrabber47::init_framegrabber47()
36 edt_devname[128] =
'\0';
44 recovering_timeout = FALSE;
51 num_bufs = (
int)(ConfigDictionary())[
"num_bufs"];
53 catch(Config_File_Exception)
57 _logger->log(Logger::LOG_LEV_INFO,
"Set number of DMA buffers used by EDT driver (num_bufs): %i", num_bufs);
66 _logger->log(Logger::LOG_LEV_ERROR,
"Could not create status board.");
71 strncpy(bsb->appname, MyFullName().c_str(), 25);
92 unit = edt_parse_unit_channel(edt_devname, edt_devname, EDT_INTERFACE, &channel);
96 strcpy(edt_devname, EDT_INTERFACE);
100 if ((pdv_p = pdv_open_channel(edt_devname, unit, channel)) == NULL)
103 logss <<
"pdv_open_channel(" << edt_devname << unit << channel <<
") failed.";
105 std::cerr <<
logss.str() <<
" (logged) \n";
112 width = pdv_get_width(pdv_p);
116 height = pdv_get_height(pdv_p);
120 depth = pdv_get_depth(pdv_p);
121 cameratype = pdv_get_cameratype(pdv_p);
123 u_int edt_timestamp[2];
128 pdv_multibuf(pdv_p, num_bufs);
131 logss <<
"reading images from '" << cameratype <<
"' width " <<
width <<
" height " <<
height <<
" depth " <<
depth <<
".";
133 std::cerr <<
logss.str() <<
" (logged) \n";
149 pdv_start_images(pdv_p, 0);
155 logss <<
"framegrabber running.";
157 std::cerr <<
logss.str() <<
" (logged) \n";
159 u_char **image_buff = pdv_buffer_addresses(pdv_p);
174 image_p = pdv_wait_image_timed(pdv_p, edt_timestamp);
176 gettimeofday(&
tv, 0);
177 tv_dma.tv_sec = edt_timestamp[0];
178 tv_dma.tv_usec = edt_timestamp[1];
190 if ((overrun = (edt_reg_read(pdv_p, PDV_STAT) & PDV_OVERRUN))) ++overruns;
196 timeouts = pdv_timeouts(pdv_p);
205 if (timeouts > last_timeouts)
211 pdv_timeout_restart(pdv_p, TRUE);
212 last_timeouts = timeouts;
213 recovering_timeout = TRUE;
217 std::cerr <<
logss.str() <<
" (logged) \n";
219 else if (recovering_timeout)
221 pdv_timeout_restart(pdv_p, TRUE);
222 recovering_timeout = FALSE;
224 logss <<
"....restarted....";
226 std::cerr <<
logss.str() <<
" (logged) \n";
240 logss <<
frameNo <<
" images " << last_timeouts <<
" timeouts " << overruns <<
" overruns.";
242 std::cerr <<
logss.str() <<
" (logged) \n";
249 if(pdv_p) pdv_close(pdv_p);
252 edt_devname[128] =
'\0';
260 recovering_timeout = FALSE;
265 logss <<
"framegrabber stopped.";
267 std::cerr <<
logss.str() <<
" (logged) \n";
#define STATUS_framegrabber47
Shared memory key for the ccd47 framegrabber status board.
int depth
Image bit depth.
void log_msg(int LogLevel, std::string lmsg)
Report an error. Also calls log_msg. Overloaded from VisAOApp_base.
int copyto_sharedim_short_deintlv_rotated(unsigned char *im)
Copies the image to data to shared memory, as shorts, rotated by 90 degrees, with DALSA 2 channel de-...
virtual int stop_framegrabber()
Override this: framegrabber clean up.
int postGetImage()
Call this immediately after getting each frame. updates frameNo and saves the init file...
timeval tv_dma
Convenience variable for filling in the dma timestamp.
int frameNo
For use as a running tally of images captured.
std::ostringstream logss
Conveninence string stream for building log messages.
void * statusboard_shmemptr
The pointer to the shared memory block for the statusboard.
int bias_height
Height of bias stripe (if any)
Declarations for a class to manage the EDT PCI framegrabber for the CCD47.
key_t statusboard_shmemkey
The key used to lookup the shared memory.
int TimeToDie
Global set by SIGTERM.
double pause_time
Time to pause during application main loop.
int STOP_FRAMEGRABBER
If true, framegrabber stops at top of next loop.
int create_statusboard(size_t sz)
Creates and attaches to the statusboard shared memory.
int send_ping()
Sends a ping to the waiting process (usuallly a framewriter).
u_char * image_p
Pointer to the current image data.
The namespace of VisAO software.
int bias_width
Width of bias stripe (if any)
timeval tv
Convenience variable for filling in the frame time in the image header.
virtual int start_framegrabber()
Override this: it is where your framegrabber should do all its work. Check for !STOP_FRAMEGRABBER and...
int RUNNING
Status of framegrabber.