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


C++ Agent::getControlBounds方法代码示例

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


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

示例1: agent

	KPIECE(const Workspace &workspace, const Agent &agent, const InstanceFileMap &args) :
		workspace(workspace), agent(agent), goalEdge(NULL), samplesGenerated(0), edgesAdded(0), edgesRejected(0) {

		collisionCheckDT = args.doubleVal("Collision Check Delta t");
		dfpair(stdout, "collision check dt", "%g", collisionCheckDT);

		const typename Workspace::WorkspaceBounds &agentStateVarRanges = agent.getStateVarRanges(workspace.getBounds());
		stateSpaceDim = agentStateVarRanges.size();

		StateSpace *baseSpace = new StateSpace(stateSpaceDim);
		ompl::base::RealVectorBounds bounds(stateSpaceDim);
		for(unsigned int i = 0; i < stateSpaceDim; ++i) {
			bounds.setLow(i, agentStateVarRanges[i].first);
			bounds.setHigh(i, agentStateVarRanges[i].second);
		}
		baseSpace->setBounds(bounds);
		ompl::base::StateSpacePtr space = ompl::base::StateSpacePtr(baseSpace);

		const std::vector< std::pair<double, double> > &controlBounds = agent.getControlBounds();
		controlSpaceDim = controlBounds.size();

		ompl::control::RealVectorControlSpace *baseCSpace = new ompl::control::RealVectorControlSpace(space, controlSpaceDim);
		ompl::base::RealVectorBounds cbounds(controlSpaceDim);
		for(unsigned int i = 0; i < controlSpaceDim; ++i) {
			cbounds.setLow(i, controlBounds[i].first);
			cbounds.setHigh(i, controlBounds[i].second);
		}

		baseCSpace->setBounds(cbounds);
		ompl::control::ControlSpacePtr cspace(baseCSpace);

		// construct an instance of  space information from this control space
		spaceInfoPtr = ompl::control::SpaceInformationPtr(new ompl::control::SpaceInformation(space, cspace));

		// set state validity checking for this space
		spaceInfoPtr->setStateValidityChecker(boost::bind(&KPIECE::isStateValid, this, spaceInfoPtr.get(), _1));

		// set the state propagation routine
		spaceInfoPtr->setStatePropagator(boost::bind(&KPIECE::propagate, this, _1, _2, _3, _4));

		pdef = ompl::base::ProblemDefinitionPtr(new ompl::base::ProblemDefinition(spaceInfoPtr));

		spaceInfoPtr->setPropagationStepSize(args.doubleVal("Steering Delta t"));
		dfpair(stdout, "steering dt", "%g", args.doubleVal("Steering Delta t"));
		spaceInfoPtr->setMinMaxControlDuration(stol(args.value("KPIECE Min Control Steps")),stol(args.value("KPIECE Max Control Steps")));
		dfpair(stdout, "min control duration", "%u", stol(args.value("KPIECE Min Control Steps")));
		dfpair(stdout, "max control duration", "%u", stol(args.value("KPIECE Max Control Steps")));

		spaceInfoPtr->setup();

		kpiece = new ompl::control::KPIECE1(spaceInfoPtr);

		kpiece->setGoalBias(args.doubleVal("KPIECE Goal Bias"));
		dfpair(stdout, "goal bias", "%g", args.doubleVal("KPIECE Goal Bias"));

		kpiece->setBorderFraction(args.doubleVal("KPIECE Border Fraction"));
		dfpair(stdout, "border fraction", "%g", args.doubleVal("KPIECE Border Fraction"));

		kpiece->setCellScoreFactor(args.doubleVal("KPIECE Cell Score Good"), args.doubleVal("KPIECE Cell Score Bad"));
		dfpair(stdout, "cell score good", "%g", args.doubleVal("KPIECE Cell Score Good"));
		dfpair(stdout, "cell score bad", "%g", args.doubleVal("KPIECE Cell Score Bad"));

		kpiece->setMaxCloseSamplesCount(stol(args.value("KPIECE Max Close Samples")));
		dfpair(stdout, "max closed samples", "%u", stol(args.value("KPIECE Max Close Samples")));


		ompl::base::RealVectorRandomLinearProjectionEvaluator *projectionEvaluator = new ompl::base::RealVectorRandomLinearProjectionEvaluator(baseSpace, stateSpaceDim);

		ompl::base::ProjectionEvaluatorPtr projectionPtr = ompl::base::ProjectionEvaluatorPtr(projectionEvaluator);

		kpiece->setProjectionEvaluator(projectionPtr);
	}
开发者ID:skiesel,项目名称:motionplanningtoolkit,代码行数:72,代码来源:kpiece.hpp


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