当前位置: 首页>>代码示例>>C++>>正文


C++ Timer::setPeriod方法代码示例

本文整理汇总了C++中ros::Timer::setPeriod方法的典型用法代码示例。如果您正苦于以下问题:C++ Timer::setPeriod方法的具体用法?C++ Timer::setPeriod怎么用?C++ Timer::setPeriod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ros::Timer的用法示例。


在下文中一共展示了Timer::setPeriod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dynConfigCallback

  void dynConfigCallback(Config &cfg, uint32_t level) {
    boost::mutex::scoped_lock lock(cfg_mutex_);
    x_acc_lim_ = cfg.x_acc_lim;
    y_acc_lim_ = cfg.y_acc_lim;
    yaw_acc_lim_ = cfg.yaw_acc_lim;
    interpolate_max_frame_ = cfg.interpolate_max_frame;

    if(desired_rate_ != cfg.desired_rate) {
      desired_rate_ = cfg.desired_rate;
      if (timer_.isValid()) {
        ros::Duration d = timerDuration();
        timer_.setPeriod(d);
        ROS_INFO_STREAM("timer loop rate is changed to " << 1.0 / d.toSec() << "[Hz]");
      }
    }
  }
开发者ID:furushchev,项目名称:cmd_vel_smoother,代码行数:16,代码来源:cmd_vel_smoother.cpp

示例2: callback

void callback(octoflex::OctoFlexConfig &config, uint32_t level)
{
  checkFullVolume_ = config.checkFullVolume;
  simTime_ = config.forwardTime;
  numSteps_ = config.numberOfSteps;
  length_ = config.length;
  width_ = config.width;
  height_ = config.height;
  originOffsetX_ = config.originOffsetX;
  originOffsetY_ = config.originOffsetY;
  originOffsetZ_ = config.originOffsetZ;
  resolution_ = config.resolution;
  rate_ = config.rate;
  visPause_ = config.visualizationPause;
  loopTimer_.setPeriod(ros::Duration(1.0/rate_));
}
开发者ID:ablasdel,项目名称:smart_wheelchair,代码行数:16,代码来源:octoflex.cpp

示例3: CurrentActionListCallback

 void CurrentActionListCallback(const supervisor_msgs::ActionsList::ConstPtr& msg)
 {
   try
   {
       if(!msg->actions.empty())
       {
           for(int i = 0 ; i < msg->actions.size() ; ++i)
           {
               for(int j = 0 ; j < msg->actions[i].actors.size() ; ++j)
               {
                   if(msg->actions[i].actors[j] == "HERAKLES_HUMAN1")
                   {
                       ROS_INFO("[robot_observer] Action detected");
                       if(msg->actions[i].focusTarget=="RED_CUBE"){
                           task_started_=true;
                           current_action_position_=red_cube_position_;
                           current_action_=msg->actions[i];
                           previous_action_=msg->actions[i];
                           object_position_=current_action_position_;
                           enable_event_=false;
                           waiting_timer_.setPeriod(ros::Duration(1.0));
                           waiting_timer_.start();
                           task_started_=true;
                           state_machine_->process_event(humanActing());
                       }
                       if(msg->actions[i].focusTarget=="BLACK_CUBE"){
                           task_started_=true;
                           current_action_position_=black_cube_position_;
                           current_action_=msg->actions[i];
                           previous_action_=msg->actions[i];
                           object_position_=current_action_position_;
                           enable_event_=false;
                           waiting_timer_.setPeriod(ros::Duration(1.0));
                           waiting_timer_.start();
                           task_started_=true;
                           state_machine_->process_event(humanActing());
                       }
                       if(msg->actions[i].focusTarget=="BLUE_CUBE"){
                           task_started_=true;
                           current_action_position_=blue_cube_position_;
                           current_action_=msg->actions[i];
                           previous_action_=msg->actions[i];
                           enable_event_=false;
                           waiting_timer_.setPeriod(ros::Duration(1.0));
                           waiting_timer_.start();
                           task_started_=true;
                           state_machine_->process_event(humanActing());
                       }
                       if(msg->actions[i].focusTarget=="GREEN_CUBE2"){
                           task_started_=true;
                           current_action_position_=green_cube_position_;
                           current_action_=msg->actions[i];
                           previous_action_=msg->actions[i];
                           enable_event_=false;
                           waiting_timer_.setPeriod(ros::Duration(1.0));
                           waiting_timer_.start();
                           task_started_=true;
                           state_machine_->process_event(humanActing());
                       }
                       if(msg->actions[i].focusTarget=="PLACEMAT_RED"){
                           task_started_=true;
                           current_action_position_=placemat_position_;
                           current_action_ =msg->actions[i];
                           previous_action_=msg->actions[i];
                           object_position_=current_action_position_;
                           enable_event_=false;
                           waiting_timer_.setPeriod(ros::Duration(1.0));
                           waiting_timer_.start();
                           task_started_=true;
                           state_machine_->process_event(humanActing());
                       }
                   }
               } 
           }    
       }
   }
   catch (HeadManagerException& e )
   {
     ROS_ERROR("[robot_observer] Exception was caught : %s",e.description().c_str());
   }
 }
开发者ID:YoanSallami,项目名称:head_manager,代码行数:81,代码来源:robot_observer_3.5.cpp


注:本文中的ros::Timer::setPeriod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。