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


C++ StatePtr类代码示例

本文整理汇总了C++中StatePtr的典型用法代码示例。如果您正苦于以下问题:C++ StatePtr类的具体用法?C++ StatePtr怎么用?C++ StatePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: print_trace_aux

void StateManager::print_trace_aux(StatePtr p)	// changes by Uli
{
  state original;
  char *s;

  if (p.isStart()) {
    // this is a startstate
    // expand it into global variable `theworld`
    // StateCopy(workingstate, s);   // Uli: workingstate is set in 
    //      StateName()

    // output startstate
    cout << "Startstate " << (s = StartState->StateName(p))
	<< " fired.\n";
    delete[]s;			// Uli: avoid memory leak
    theworld.print();
    cout << "----------\n\n";
  } else {
    // print the prefix
    print_trace_aux(p.previous());

    // print the next state, which should be equivalent to state s
    // and set theworld to that state.
    // FALSE: no need to print full state
    Rules->print_world_to_state(p, FALSE);
  }
}
开发者ID:bvuong,项目名称:CS259,代码行数:27,代码来源:mu_system.cpp

示例2: isGoal

  bool FootstepGraph::isGoal(StatePtr state)
  {
    FootstepState::Ptr goal = getGoal(state->getLeg());
    if (publish_progress_) {
      jsk_footstep_msgs::FootstepArray msg;
      msg.header.frame_id = "odom"; // TODO fixed frame_id
      msg.header.stamp = ros::Time::now();
      msg.footsteps.push_back(*state->toROSMsg());
      pub_progress_.publish(msg);
    }
    Eigen::Affine3f pose = state->getPose();
    Eigen::Affine3f goal_pose = goal->getPose();
    Eigen::Affine3f transformation = pose.inverse() * goal_pose;

    if ((parameters_.goal_pos_thr > transformation.translation().norm()) &&
        (parameters_.goal_rot_thr > std::abs(Eigen::AngleAxisf(transformation.rotation()).angle()))) {
      // check collision
      if (state->getLeg() == jsk_footstep_msgs::Footstep::LEFT) {
        if (right_goal_state_->crossCheck(state)) {
          return true;
        }
      } else if (state->getLeg() == jsk_footstep_msgs::Footstep::RIGHT) {
        if (left_goal_state_->crossCheck(state)) {
          return true;
        }
      }
    }
    return false;
  }
开发者ID:YoheiKakiuchi,项目名称:jsk_control,代码行数:29,代码来源:footstep_graph.cpp

示例3: finalizeSteps

  bool FootstepGraph::finalizeSteps(const StatePtr &last_1_Step, const StatePtr &lastStep,
                                    std::vector<StatePtr> &finalizeSteps) {
    // simple finalize (no check)
    if (lastStep->getLeg() == jsk_footstep_msgs::Footstep::LEFT) {
      finalizeSteps.push_back(right_goal_state_);
      finalizeSteps.push_back(left_goal_state_);
    } else if (lastStep->getLeg() == jsk_footstep_msgs::Footstep::RIGHT) {
      finalizeSteps.push_back(left_goal_state_);
      finalizeSteps.push_back(right_goal_state_);
    }

    return true;
  }
开发者ID:YoheiKakiuchi,项目名称:jsk_control,代码行数:13,代码来源:footstep_graph.cpp

示例4: print_trace

void StateManager::print_trace(StatePtr p)
{
  // print the prefix 
  if (p.isStart()) {
    print_trace_aux(p);
  } else {
    print_trace_aux(p.previous());

    // print the next state, which should be equivalent to state s
    // and set theworld to that state.
    // TRUE: print full state please;
    Rules->print_world_to_state(p, TRUE);
  }
}
开发者ID:bvuong,项目名称:CS259,代码行数:14,代码来源:mu_system.cpp

示例5: if

  bool FootstepGraph::successors_original(StatePtr target_state, std::vector<FootstepGraph::StatePtr> &ret)
  {
    std::vector<Eigen::Affine3f> transformations;
    int next_leg;
    if (target_state->getLeg() == jsk_footstep_msgs::Footstep::LEFT) {
      transformations = successors_from_left_to_right_;
      next_leg = jsk_footstep_msgs::Footstep::RIGHT;
    }
    else if (target_state->getLeg() == jsk_footstep_msgs::Footstep::RIGHT) {
      transformations = successors_from_right_to_left_;
      next_leg = jsk_footstep_msgs::Footstep::LEFT;
    }
    else {
      // TODO: error
    }

    //std::vector<FootstepGraph::StatePtr> ret;
    Eigen::Affine3f base_pose = target_state->getPose();
    for (size_t i = 0; i < transformations.size(); i++) {
      Eigen::Affine3f transform = transformations[i];
      FootstepGraph::StatePtr next(new FootstepState(next_leg,
                                                     base_pose * transform,
                                                     target_state->getDimensions(),
                                                     resolution_));
      if (use_pointcloud_model_ && !lazy_projection_) {
        // Update footstep position by projection
        unsigned int error_state;
        FootstepGraph::StatePtr tmpnext = projectFootstep(next, error_state);
        if (!tmpnext && localMovement() && error_state == projection_state::close_to_success) {
          std::vector<StatePtr> locally_moved_nodes = localMoveFootstepState(next);
          for (size_t j = 0; j < locally_moved_nodes.size(); j++) {
            if (isSuccessable(locally_moved_nodes[j], target_state)) {
              FootstepGraph::StatePtr tmp = projectFootstep(locally_moved_nodes[j], error_state);
              if(!!tmp) {
                ret.push_back(tmp);
              }
            }
          }
        }
        next = tmpnext;
      }
      if (!!next) {
        if (isSuccessable(next, target_state)) {
          ret.push_back(next);
        }
      }
    }
    return true;
  }
开发者ID:YoheiKakiuchi,项目名称:jsk_control,代码行数:49,代码来源:footstep_graph.cpp

示例6: push

void StateManager::push(StatePtr state)
{
    state->initialize();

    // NOTE: should this check for duplicate states?
    _stateStack.push(state);
}
开发者ID:treewojima,项目名称:tile,代码行数:7,代码来源:statemanager.cpp

示例7: isGoal

 bool FootstepGraph::isGoal(StatePtr state)
 {
   FootstepState::Ptr goal = getGoal(state->getLeg());
   if (publish_progress_) {
     jsk_footstep_msgs::FootstepArray msg;
     msg.header.frame_id = "odom";
     msg.header.stamp = ros::Time::now();
     msg.footsteps.push_back(*state->toROSMsg());
     pub_progress_.publish(msg);
   }
   Eigen::Affine3f pose = state->getPose();
   Eigen::Affine3f goal_pose = goal->getPose();
   Eigen::Affine3f transformation = pose.inverse() * goal_pose;
   return (pos_goal_thr_ > transformation.translation().norm()) &&
     (rot_goal_thr_ > std::abs(Eigen::AngleAxisf(transformation.rotation()).angle()));
 }
开发者ID:iory,项目名称:jsk_control,代码行数:16,代码来源:footstep_graph.cpp

示例8: PushState

void Mind::PushState( const StatePtr &state ) {
	assert( state != NULL );
	// Push the state to the front of the queue
	_stateQueue.push_front( state );
	state->SetOwner( _owner.GetEntity() );
	// Trigger a stateswitch next round
	_switchState = true;
	//PrintStateQueue("push");
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:9,代码来源:Mind.cpp

示例9: setState

 void GameController::setState(const StatePtr & statePtr) {
     if(statePtr) {
         state->onExit();
         HIKARI_LOG(debug) << "<GameController> exited \"" << state->getName() << "\" state.";
         prevState = state->getName();
         currState = statePtr->getName();
         state = statePtr;
         state->onEnter();
         HIKARI_LOG(debug) << "<GameController> entered \"" << state->getName() << "\" state.";
     }
 }
开发者ID:Faianca,项目名称:hikari,代码行数:11,代码来源:GameController.cpp

示例10: makeState

StatePtr SimpleTexturedMaterial::makeState(void)
{
    StatePtr state = Inherited::makeState();

    prepareLocalChunks();

    state->addChunk(_textureChunk);
    state->addChunk(_texGenChunk);

    if(getImage() != NullFC &&
       getImage()->hasAlphaChannel() && 
       getEnvMode() != GL_DECAL)
    {
        if(getImage()->isAlphaBinary())
        {
            if(_blendChunk->getSrcFactor() == GL_SRC_ALPHA)
            {
                beginEditCP(_blendChunk);
                _blendChunk->setSrcFactor(GL_ONE);
                _blendChunk->setDestFactor(GL_ZERO);
                _blendChunk->setAlphaFunc(GL_NOTEQUAL);
                _blendChunk->setAlphaValue(0);          
                endEditCP(_blendChunk);            
            }
        }
        else
        {
            if(_blendChunk->getSrcFactor() != GL_SRC_ALPHA)
            {
                beginEditCP(_blendChunk);
                _blendChunk->setSrcFactor(GL_SRC_ALPHA);
                _blendChunk->setDestFactor(GL_ONE_MINUS_SRC_ALPHA);
                _blendChunk->setAlphaFunc(GL_NONE);
                _blendChunk->setAlphaValue(0);          
                endEditCP(_blendChunk);                        
            }
        }
    }

    return state;
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:41,代码来源:OSGSimpleTexturedMaterial.cpp

示例11: DISPLAY

// Activate callback
void TestState::activate(cycle_t cyc)
{
	// Display callback text
	DISPLAY(cout << "TestState: In activate()" << endl);

	// Test trying to call callback-protected functions (this is a callback...)
	StatePtr snew = NewStateInstance<KickBallState>(sc, 0);
	EXPECT_EQ(SCR_BAD_CALLBACK, sc->init(snew));
	EXPECT_EQ(SCR_BAD_CALLBACK, sc->forceState(snew));
	EXPECT_EQ(SCR_BAD_CALLBACK, sc->step());
	EXPECT_EQ(SCR_BAD_CALLBACK, sc->loop());
	snew.reset();
	
	// Refuse to activate this state by calling terminate() (...at least the first time this function is called)
	if(!sc->g_tested_term)
	{
		DISPLAY(cout << "TestState: Calling terminate() from inside activate()" << endl);
		sc->g_tested_term = true;
		sc->terminate();
		return; // Just here for good coding standard after a terminate()
	}
}
开发者ID:AIS-Bonn,项目名称:state_controller_library,代码行数:23,代码来源:test_state_controller.cpp

示例12: Exception

IECore::RunTimeTypedPtr ToGLStateConverter::doConversion( IECore::ConstObjectPtr src, IECore::ConstCompoundObjectPtr operands ) const
{
	const CompoundObject *co = runTimeCast<const CompoundObject>( src.get() );
	if( !co )
	{
		throw Exception( "Expected a CompoundObject" );
	}

	const AttributeToStateMap &m = attributeToStateMap();

	const StatePtr result = new State( false );
	for( CompoundObject::ObjectMap::const_iterator it = co->members().begin(), eIt = co->members().end(); it != eIt; ++it )
	{
		AttributeToStateMap::const_iterator mIt = m.find( it->first );
		if( mIt != m.end() )
		{
			StateComponentPtr s = mIt->second( it->second.get() );
			result->add( s );
		}
	}
	return result;
}
开发者ID:AtomicFiction,项目名称:cortex,代码行数:22,代码来源:ToGLStateConverter.cpp

示例13: popBackState

StatePtr Game::popBackState() {
    StatePtr popped = mvStates.back();
    popped->dispose();
    mvStates.pop_back();
    return popped;
}
开发者ID:RolandMQuiros,项目名称:DelAbismo,代码行数:6,代码来源:Game.cpp

示例14: match

/********************
 Auxiliary function for error trace printing
 ********************/
bool match(state* ns, StatePtr p)
{
  int i;
  static PermSet Perm;
  static state temp;
  StateCopy(&temp, ns);
  if (args->symmetry_reduction.value)
    {
      if (  args->sym_alg.mode == argsym_alg::Exhaustive_Fast_Canonicalize) {
        Perm.ResetToExplicit();
        for (i=0; i<Perm.count; i++)
          if (Perm.In(i))
            {
              if (ns != workingstate)
                  StateCopy(workingstate, ns);
              
              mu_v.Permute(Perm,i);
              if (args->multiset_reduction.value)
                mu_v.MultisetSort();
            if (p.compare(workingstate)) {
              StateCopy(workingstate,&temp); return TRUE; }
          }
        StateCopy(workingstate,&temp);
        return FALSE;
      }
      else {
        Perm.ResetToSimple();
        Perm.SimpleToOne();
        if (ns != workingstate)
          StateCopy(workingstate, ns);

          mu_v.Permute(Perm,0);
          if (args->multiset_reduction.value)
            mu_v.MultisetSort();
        if (p.compare(workingstate)) {
          StateCopy(workingstate,&temp); return TRUE; }

        while (Perm.NextPermutation())
          {
            if (ns != workingstate)
              StateCopy(workingstate, ns);
              
              mu_v.Permute(Perm,0);
              if (args->multiset_reduction.value)
                mu_v.MultisetSort();
            if (p.compare(workingstate)) {
              StateCopy(workingstate,&temp); return TRUE; }
          }
        StateCopy(workingstate,&temp);
        return FALSE;
      }
    }
  if (!args->symmetry_reduction.value
      && args->multiset_reduction.value)
    {
      if (ns != workingstate)
          StateCopy(workingstate, ns);
      mu_v.MultisetSort();
      if (p.compare(workingstate)) {
        StateCopy(workingstate,&temp); return TRUE; }
      StateCopy(workingstate,&temp);
      return FALSE;
    }
  return (p.compare(ns));
}
开发者ID:patrickschultz,项目名称:Eddy_Murphi_Lazy_Comm,代码行数:68,代码来源:lin.C

示例15:

 Eigen::Affine3f FootstepGraph::getRobotCoords(StatePtr current_state, StatePtr previous_state) const
 {
   Eigen::Affine3f mid = current_state->midcoords(*previous_state);
   return mid * collision_bbox_offset_;
 }
开发者ID:YoheiKakiuchi,项目名称:jsk_control,代码行数:5,代码来源:footstep_graph.cpp


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