void FrameCornerSynchronizer::addFrame(ViFrame::Ptr frame) {
  boost::mutex::scoped_lock lock(mutex_);
  while (corner_queue_.empty())
    cond_.wait(lock);

  if (frame->timestamp < corner_queue_.front()->timestamp) {
    VISENSOR_DEBUG(
        "no matching corners found, publishing image without corners!!!\n");
    frame->useCorners = false;
    return;
  }

  while (frame->timestamp > corner_queue_.front()->timestamp) {
    corner_queue_.pop();
    if (corner_queue_.empty())
      cond_.wait(lock);
  }

  if (frame->timestamp != corner_queue_.front()->timestamp) {
    VISENSOR_DEBUG("pair NOT found: this should not happen!!!\n");
    return;
  }
  ViCorner::Ptr corner = corner_queue_.front();
  corner_queue_.pop();

  if (user_callback_)
    user_callback_(frame, corner);
}
void RobotMonitor::jointStateCallback(const sensor_msgs::JointState::ConstPtr& msg)
{
  if (!paused_ && (++downsample_counter_ >= downsample_factor_))
  {
    downsample_counter_ = 0;
    joint_state_mutex_.lock();
    joint_state_ = *msg;
    joint_state_received_ = true;
    joint_state_parsed_ = false;
    joint_state_mutex_.unlock();
    if (user_callback_enabled_)
    {
      user_callback_(msg);
    }
  }
}
Exemplo n.º 3
0
//-------------------------------------------------------------------
//
  void saliency_server_t::update_saliency_data_(client_connection_ptr_t
                                              , net_packet_ptr_t packet)
  {
    saliency_data.import(packet);
    user_callback_();
  }