本文整理汇总了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;
}