本文整理汇总了C++中Trajectory::setSamplingFrequency方法的典型用法代码示例。如果您正苦于以下问题:C++ Trajectory::setSamplingFrequency方法的具体用法?C++ Trajectory::setSamplingFrequency怎么用?C++ Trajectory::setSamplingFrequency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trajectory
的用法示例。
在下文中一共展示了Trajectory::setSamplingFrequency方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: propagateFull
bool DynamicMovementPrimitive::propagateFull(Trajectory& trajectory, const double samplingDuration, const int numSamples)
{
if ((!params_.isLearned_) || (!params_.isSetup_) || (!params_.isStartSet_))
{
if(!params_.isLearned_) printf("ERROR: DMP is not learned from demonstration.\n");
if(!params_.isSetup_) printf("ERROR: DMP with is not setup. Need to set start, goal, and duration first.\n");
return false;
}
if(trajectory.getMaxDimension() < params_.numTransformationSystems_ * POS_VEL_ACC) return false;
if(trajectory.getMaxLength() <= numSamples) return false;
double specialSamplingFrequency = static_cast<double> (numSamples) / (samplingDuration);
if (!trajectory.setSamplingFrequency(specialSamplingFrequency))
{
printf("ERROR: Could not set sampling frequency.\n");
return false;
}
VectorXd desiredCoordinates = VectorXd::Zero(params_.numTransformationSystems_ * POS_VEL_ACC);
bool movementFinished = false;
while (!movementFinished)
{
if (!propagateStep(desiredCoordinates, movementFinished, samplingDuration, numSamples))
{
printf("ERROR: Could not propagate dmp.\n");
return false;
}
if (!trajectory.add(desiredCoordinates))
{
printf("ERROR: Could not add point to trajectory.\n");
return false;
}
}
return true;
}