本文整理汇总了C++中Arm::startMotion方法的典型用法代码示例。如果您正苦于以下问题:C++ Arm::startMotion方法的具体用法?C++ Arm::startMotion怎么用?C++ Arm::startMotion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arm
的用法示例。
在下文中一共展示了Arm::startMotion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateArm
void ArmMotionEngine::updateArm(Arm& arm, ArmMotionEngineOutputBH& armMotionEngineOutput)
{
// assume arm should not be moved.
armMotionEngineOutput.arms[arm.id].move = false;
// make sure to not interfere with other motion engines
if(theFallDownStateBH.state == FallDownStateBH::onGround ||
theMotionInfoBH.motion == MotionInfoBH::getUp)
{
arm.isMotionActive = false;
return;
}
if(newMotionPossible(arm))
{
// no motion is active, so decide what to do.
// behavior overrides contact triggered motions
if(theArmMotionRequestBH.motion[arm.id] != ArmMotionRequestBH::useDefault)
{
ArmMotion nextMotion = allMotions[theArmMotionRequestBH.motion[arm.id]];
arm.contactTriggered = false;
arm.startMotion(nextMotion,
theArmMotionRequestBH.fast[arm.id],
theArmMotionRequestBH.autoReverse[arm.id],
theArmMotionRequestBH.autoReverseTime[arm.id],
theFilteredJointDataBH);
} else if(theFrameInfoBH.getTimeSince(arm.lastContactAction) > actionDelay &&
(arm.id == ArmMotionRequestBH::left ? theArmContactModelBH.contactLeft : theArmContactModelBH.contactRight))
{
#ifdef TARGET_ROBOT
// check for armcontact
ArmContactModelBH::PushDirection dir = (arm.id == ArmMotionRequestBH::left)
? theArmContactModelBH.pushDirectionLeft
: theArmContactModelBH.pushDirectionRight;
switch(dir)
{
case ArmContactModelBH::S:
case ArmContactModelBH::SW:
case ArmContactModelBH::SE:
arm.lastContactAction = theFrameInfoBH.time;
arm.contactTriggered = true;
arm.startMotion(allMotions[ArmMotionRequestBH::back], false, true, targetTime, theFilteredJointDataBH);
break;
default:
break;
}
#endif
}
}
// when falling, try to set emergency mode fast
if(theFallDownStateBH.state == FallDownStateBH::falling && arm.isMotionActive && arm.currentMotion.id != ArmMotionRequestBH::falling)
{
arm.startMotion(allMotions[ArmMotionRequestBH::falling], true, false, 0, theFilteredJointDataBH);
}
else if((theFallDownStateBH.state == FallDownStateBH::falling || theFallDownStateBH.state == FallDownStateBH::onGround || !theGroundContactStateBH.contact) &&
!arm.isMotionActive)
{
// fallen
return;
}
else if(theMotionInfoBH.motion == MotionInfoBH::bike && arm.isMotionActive && arm.currentMotion.id != ArmMotionRequestBH::useDefault)
{
arm.startMotion(allMotions[ArmMotionRequestBH::useDefault], true, false, 0, theFilteredJointDataBH);
}
// test whether a motion is active now
if(arm.isMotionActive)
{
// a motion is active, so decide what to do
if(arm.stateIndex == arm.currentMotion.states.size())
{
// arm reached its motion target
++arm.targetTime;
if(arm.currentMotion.id == ArmMotionRequestBH::useDefault)
{
// arm is in default position, so ARME won't output any angles
armMotionEngineOutput.arms[arm.id].move = false;
arm.isMotionActive = false;
}
else if((arm.autoReverse && arm.targetTime == arm.autoReverseTime) || // target time ran out
(!theGroundContactStateBH.contact) || // ground contact lost
(theArmMotionRequestBH.motion[arm.id] != arm.currentMotion.id && !arm.contactTriggered)) // different motion requested
{
// start a reversed motion to reach the default position
arm.startMotion(arm.currentMotion.reverse(defaultPos),
theArmMotionRequestBH.fast[arm.id], false, 0, theFilteredJointDataBH);
}
else
{
// stay in target position
updateOutput(arm, armMotionEngineOutput, arm.currentMotion.getTargetState());
}
}
else
{
//.........这里部分代码省略.........