示例#1
0
void Memory::createLocks(bool clean_locks) {
    if (clean_locks) {
        cleanLock(LOCK_MOTION_NAME);
        cleanLock(LOCK_VISION_NAME);
        cleanLock(LOCK_VISION_MOTION_NAME);
    }
    assert(motion_lock_ == NULL);
    motion_lock_ = new Lock(LOCK_MOTION_NAME);
    assert(vision_lock_ == NULL);
    vision_lock_ = new Lock(LOCK_VISION_NAME);
    assert(vision_motion_lock_ == NULL);
    vision_motion_lock_ = new Lock(LOCK_VISION_MOTION_NAME);
}
示例#2
0
void ImageCapture::initVision() {
  std::cout << "ImageCapture: Initializing Vision Interface" << std::endl << std::flush;

  cleanLock(Lock::getLockName(memory_,LOCK_VISION));
  vision_lock_ = new Lock(Lock::getLockName(memory_,LOCK_VISION));

  std::cout << "ImageCapture: Creating Top V4L2 camera" << std::endl << std::flush;

  std::cout << "ImageCapture: Creating Bottom V4L2 camera" << std::endl << std::flush;
#ifdef COMPILE_FOR_GEODE
  top_camera_ = new DummyCamera(topImageParams_, camera_info_->params_top_camera_,camera_info_->read_params_top_camera_);
  bottom_camera_ = new DummyCamera(bottomImageParams_, camera_info_->params_bottom_camera_,camera_info_->read_params_bottom_camera_);
#else
  top_camera_ = new TopCamera(topImageParams_, camera_info_->params_top_camera_,camera_info_->read_params_top_camera_);
  bottom_camera_ = new BottomCamera(bottomImageParams_, camera_info_->params_bottom_camera_,camera_info_->read_params_bottom_camera_);
#endif

  // std::cout << "ImageCapture(INFO):Sleeping for 5 seconds to allow for camera initialization" << std::endl;
  // sleep(5);

  std::cout << "ImageCapture: Done creating V4L2 cameras" << std::endl << std::flush;

  std::cout << "ImageCapture: Creating thread to take images" << std::endl << std::flush;
  pthread_create(&image_thread_, NULL, (threadedTakeImage), this );
  std::cout << "ImageCapture: Done creating thread to take images" << std::endl << std::flush;

  std::cout << "ImageCapture: Done initializing Vision Interface" << std::endl << std::flush;
}
示例#3
0
Lock::Lock(const std::string &name, bool clean_first):
  name_(name)
{
  if (clean_first)
    cleanLock(name);
  createLock();
}
示例#4
0
void Lock::recreate(){
  deleteLock();
  cleanLock(name_.c_str());
  createLock();
}