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


C++ Generator::getPosition方法代码示例

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


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

示例1: cartesian

/*
 *  converts cartesian via points to joint space via points
 */
vector<ColumnVector> TrajectoryController::getJSPoints(
		vector<ColumnVector>& cartesianList) {

	vector<ColumnVector> jsPoints;
	ColumnVector cartesian(6), currentQ(6), previousQ(6), joint(6);
	Generator* gen = getGenerator(cartesianList);
	if (gen != NULL) {
		currentQ = 0;
		joint = 0;

		// - convert ith cartesian to thetas
		// - if conditions satisfied, add point in path.
		for (int i = 0; i <= PNT_SAMPLES; i++) {
			double k = ((i * 1.0) / PNT_SAMPLES);

			//			cout << k << endl;
			//get xyz and orientation from generator for time k.
			cartesian = gen->getPosition(k);
			//			cout << "cart c " << cartesian.as_row();
			Quaternion quat = gen->getOrientation(k);
			cartesian.resize_keep(6);
			Matrix R = quat.R();
			cartesian.Rows(4, 6) = irpy(R);

			//			cout << cartesian.AsRow() << endl;
			//			cout << quat << endl;

			//add the joint solution if it exists
			if (kineSolver->getBestSolution(cartesian, currentQ, joint)) {
				//				cout << "cartesian " << cartesian.AsRow() << endl;
				//				cout << "joint " << joint.AsRow() << endl;
				jsPoints.push_back(joint);
				currentQ = joint;
			} else {
				//path has to be rejected
				cout << cartesian.AsRow()
						<< " : Via point out of workspace. Path rejected."
						<< endl;
				jsPoints.clear();
				break;
			}
		}
	}
	return jsPoints;
}
开发者ID:harshmdeshpande,项目名称:LWIM_Control_System,代码行数:48,代码来源:TrajectoryController.cpp


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