本文整理汇总了C++中Skill::getTaskTable方法的典型用法代码示例。如果您正苦于以下问题:C++ Skill::getTaskTable方法的具体用法?C++ Skill::getTaskTable怎么用?C++ Skill::getTaskTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skill
的用法示例。
在下文中一共展示了Skill::getTaskTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: st
Status ClassicTaskPostureController::
computeCommand(Model const & model,
Skill & skill,
Vector & gamma)
{
Status st(skill.update(model));
if ( ! st) {
return st;
}
Skill::task_table_t const * tasks(skill.getTaskTable());
if ( ! tasks) {
st.ok = false;
st.errstr = "null task table";
return st;
}
if (2 != tasks->size()) {
st.ok = false;
st.errstr = "task table must have exactly 2 entries";
return st;
}
Task const * task((*tasks)[0]);
Task const * posture((*tasks)[1]);
Matrix ainv;
if ( ! model.getInverseMassInertia(ainv)) {
st.ok = false;
st.errstr = "failed to retrieve inverse mass inertia";
return st;
}
Vector grav;
if ( ! model.getGravity(grav)) {
st.ok = false;
st.errstr = "failed to retrieve gravity torques";
return st;
}
size_t const ndof(model.getNDOF());
Matrix const & jac(task->getJacobian());
jspace::pseudoInverse(jac * ainv * jac.transpose(),
task->getSigmaThreshold(),
lambda_,
0);
fstar_ = lambda_ * task->getCommand();
jbar_ = ainv * jac.transpose() * lambda_;
nullspace_ = Matrix::Identity(ndof, ndof) - jac.transpose() * jbar_.transpose();
gamma_ = jac.transpose() * fstar_ + nullspace_ * posture->getCommand() + grav;
gamma = gamma_;
jpos_ = model.getState().position_;
jvel_ = model.getState().velocity_;
return st;
}