00001 #ifndef _VISION_MODULE_FUNCTIONS_H 00002 #define _VISION_MODULE_FUNCTIONS_H 00003 #include <WURDECam.H> 00004 #include <WURDE1394Camera.H> 00005 #include <PlaybackCamera.H> 00006 #include <visionModule.H> 00007 #include <vector> 00008 #include <Logger.H> 00009 00010 using namespace WURDE; 00011 using namespace std; 00012 00013 namespace WURDEVision{ 00014 00015 void loadCameras(VisionModuleConfig &theConfig, std::vector<WURDECamera *> &cameras){ 00016 std::vector<CameraConfig>::iterator iter; 00017 WURDECamera *curr; 00018 00019 for(iter=theConfig.cameras.begin();iter!=theConfig.cameras.end();iter++){ 00020 00021 g_debug("Loading a camera"); 00022 if(iter->options.find("type")!=iter->options.end()){ 00023 if(iter->options["type"]=="firewire"){ 00024 curr=new WURDE1394Camera(iter->name,iter->options); 00025 }else if(iter->options["type"]=="playback"){ 00026 curr=new WURDEPlaybackCamera(iter->name,iter->options); 00027 }else{ 00028 g_logfatal << "Unknown camera type " << iter->options["type"] << ". Exiting." <<endl; 00029 exit(-1); 00030 } 00031 }else{ 00032 g_logfatal << "Camera " << iter->name << " doesn't have a type value! Exiting. " << endl; 00033 exit(-1); 00034 } 00035 00036 if(curr){ 00037 00038 if(!curr->startCapture()){ 00039 g_fatal("Couldn't start capture on one of the cameras.(check channels)"); 00040 exit(-1); 00041 } 00042 cameras.push_back(curr); 00043 } 00044 00045 } 00046 } 00047 00048 } 00049 #endif