ROS環境下Pointgrey相機的配置方法

1.根據相機型號在官方網站下載驅動,而後根據驅動包裏的 README 按順序安裝驅動:html

https://www.ptgrey.com/support/downloads

2.安裝pointgrey的ROS驅動(建議從源碼安裝):git

http://wiki.ros.org/pointgrey_camera_driver
https://github.com/ros-drivers/pointgrey_camera_driver

安裝過程當中可能會出現libusb的庫衝突,查找衝忽然後刪掉本身安裝的庫文件就行了,參考->http://www.cnblogs.com/zhchp-blog/p/7240278.html。github

3.相機參數的設置:ide

   1)修改cfg文件夾下的「PointGrey.cfg」文件中的相關參數,修改後從新編譯便可(推薦這種方法)函數

   2)在../pointgrey_camera_driver/src/PointGreyCamera.cpp源碼中的測試

bool PointGreyCamera::setNewConfiguration(pointgrey_camera_driver::PointGreyConfig &config, const uint32_t &level)

函數中設置。個人設置方式以下,還未真正測試效果:網站

 bool PointGreyCamera::setNewConfiguration(pointgrey_camera_driver::PointGreyConfig &config, const uint32_t &level)
  {
      .........
      // Check video mode
      VideoMode vMode; // video mode desired
      Mode fmt7Mode; // fmt7Mode to set
      //retVal &= PointGreyCamera::getVideoModeFromString(config.video_mode, vMode, fmt7Mode);
      std::string testMode="640x480_mono8";
      retVal &= PointGreyCamera::getVideoModeFromString(testMode, vMode, fmt7Mode);
     ////////////////////////////
     .........  
     // Set frame rate
     //retVal &= PointGreyCamera::setProperty(FRAME_RATE, false, config.frame_rate);
     ////****************fix the value of frame rate******************************
     double testFrameRate=60.0;
     retVal &= PointGreyCamera::setProperty(FRAME_RATE, false, testFrameRate);
     ////*************************************************************************
 
     // Set exposure
     //retVal &= PointGreyCamera::setProperty(AUTO_EXPOSURE, config.auto_exposure, config.exposure);
     ////****************fix the value of auto exposure***************************
     double testAutoExposure=40.0;
     retVal &= PointGreyCamera::setProperty(AUTO_EXPOSURE, false, testAutoExposure);
     ////*************************************************************************
 
     // Set sharpness
     //retVal &= PointGreyCamera::setProperty(SHARPNESS, config.auto_sharpness, config.sharpness);
     retVal &= PointGreyCamera::setProperty(SHARPNESS, true, config.sharpness);
     /////////////////
 
     // Set saturation
     //retVal &= PointGreyCamera::setProperty(SATURATION, config.auto_saturation, config.saturation);
     retVal &= PointGreyCamera::setProperty(SATURATION, true, config.saturation);
     /////////////////
 
     // Set shutter time
     double shutter = 1000.0 * config.shutter_speed; // Needs to be in milliseconds
     //retVal &= PointGreyCamera::setProperty(SHUTTER, config.auto_shutter, shutter);
     shutter=16.0;
     retVal &= PointGreyCamera::setProperty(SHUTTER, false, shutter);
     /////////////////
     config.shutter_speed = shutter / 1000.0; // Needs to be in seconds
 
     // Set gain
     //retVal &= PointGreyCamera::setProperty(GAIN, config.auto_gain, config.gain);
     retVal &= PointGreyCamera::setProperty(GAIN, true, config.gain);
     /////////////////
 
     // Set pan
     unsigned int pan = config.pan;
     unsigned int not_used = 0;
     retVal &= PointGreyCamera::setProperty(PAN, false, pan, not_used);
     config.pan = pan;
 
     // Set tilt
     unsigned int tilt = config.tilt;
     retVal &= PointGreyCamera::setProperty(TILT, false, tilt, not_used);
     config.tilt = tilt;
 
     // Set brightness
     //retVal &= PointGreyCamera::setProperty(BRIGHTNESS, false, config.brightness);
     ////****************fix the value of frame rate******************************
     double testBrightness=160.0;
     retVal &= PointGreyCamera::setProperty(BRIGHTNESS, false, testBrightness);
     /////////////////
     ////*************************************************************************
 
     // Set gamma
     //retVal &= PointGreyCamera::setProperty(GAMMA, false, config.gamma);
     retVal &= PointGreyCamera::setProperty(GAMMA, true, config.gamma);
     /////////////////
     ...........
 }
View Code

 

ps.有時候發現即便在PointGrey.cfg中把framerate設置到100hz,實際的圖像幀率也只有40hz左右,這種狀況下:pointgrey相機鏈接到USB,打開FlyCap2,若是提示「could not find glade file 'FlyCapture2GUI_GTK.glade'」,就搜索這個文件的位置,而後$cd到該位置,再$FlyCap2,而後把framerate那個滑動條拉到最大而後退出便可。再次啓動ROS的驅動,既能夠看到圖像幀率達到60hzui

相關文章
相關標籤/搜索