本文整理汇总了C++中ArGripper::gripClose方法的典型用法代码示例。如果您正苦于以下问题:C++ ArGripper::gripClose方法的具体用法?C++ ArGripper::gripClose怎么用?C++ ArGripper::gripClose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArGripper
的用法示例。
在下文中一共展示了ArGripper::gripClose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
ArActionDesired *Acquire::fire(ArActionDesired currentDesired)
{
myDesired.reset();
myDesired.setVel(0);
switch (myState) {
case STATE_START_LOOKING:
myFirstTurn.clear();
mySecondTurn.clear();
myState = STATE_LOOKING;
myGripper->liftUp();
myGripper->gripClose();
printf("Acquire: Raising lift\n");
myStartUp.setToNow();
myTryingGripper = true;
case STATE_LOOKING:
if (myTryingGripper && (myStartUp.mSecSince() < 600 ||
((!myGripper->isLiftMaxed() ||
myGripper->getGripState() != 2) &&
myStartUp.mSecSince() < 5000)))
{
myGripper->liftUp();
myGripper->gripClose();
myDesired.setVel(0);
myDesired.setDeltaHeading(0);
return &myDesired;
}
else if (myTryingGripper)
{
printf("Acquire: Done raising lift %ld after started.\n",
myStartUp.mSecSince());
myTryingGripper = false;
}
if (myActs->getNumBlobs(myChannel) > 0)
{
myDesired.setDeltaHeading(0);
myState = STATE_SUCCEEDED;
printf("Acquire: Succeeded!\n");
}
else if (myFirstTurn.didAll() && mySecondTurn.didAll())
{
myDesired.setDeltaHeading(0);
myState = STATE_FAILED;
printf("Acquire: Did two revolutions, didn't see the blob, Failed!\n");
}
else
{
myFirstTurn.update(myRobot->getTh());
if (myFirstTurn.didAll())
mySecondTurn.update(myRobot->getTh());
myDesired.setDeltaHeading(8);
}
return &myDesired;
default:
myDesired.setVel(0);
myDesired.setDeltaHeading(0);
return &myDesired;
}
}
示例2: if
//.........这里部分代码省略.........
myLastPose = myRobot->getPose();
}
if (myWaitingOnRaised)
{
if (myStartRaised)
{
printf("PickUp: Raising gripper a little bit\n");
myGripper->liftCarry(15);
mySentGripper.setToNow();
myStartRaised = false;
}
if (mySentGripper.mSecSince() > 1000)
{
printf("PickUp: Raised the gripper a little bit\n");
myWaitingOnRaised = false;
myLowered = true;
}
myDesired.setVel(0);
myDesired.setDeltaHeading(0);
myLastMoved.setToNow();
myLastPose = myRobot->getPose();
return &myDesired;
}
if (myLowered && myGripper->getBreakBeamState() != 0)
{
if (!myTried)
{
printf("PickUp: Trying to pick up.\n");
myTriedStart.setToNow();
}
myTried = true;
myGripper->gripClose();
if (myGripper->getGripState() == 2 || myTriedStart.mSecSince() > 5000)
{
printf("PickUp: Succeeded, have block.\n");
myGripper->liftUp();
myState = STATE_SUCCEEDED;
}
myDesired.setVel(0);
myDesired.setDeltaHeading(0);
return &myDesired;
}
// this means that the grippers are closed, but we don't have anything in
// them, ie that we failed to get the block
else if (myTried && (myGripper->getGripState() == 2 ||
myTriedStart.mSecSince() > 5000))
{
myState = STATE_FAILED;
myGripper->gripOpen();
ArUtil::sleep(3);
myGripper->liftUp();
printf("PickUp: Grippers closed, didn't get a block, failed.\n");
myDesired.setVel(0);
myDesired.setDeltaHeading(0);
return &myDesired;
}
pose = myRobot->getPose();
dist = myLastPose.findDistanceTo(pose);
if (dist < 5 && myLastMoved.mSecSince() > 2500)
{
printf("PickUp: Failed, no movement in the last 2500 msec.\n");
myState = STATE_FAILED;
示例3: printf
ArActionDesired *DriveTo::fire(ArActionDesired currentDesired)
{
ArACTSBlob blob;
double xRel, yRel;
if (myState == STATE_START_LOOKING)
{
myGripper->gripClose();
myGripper->liftUp();
mySony->panTilt(0, -5);
myState = STATE_LOOKING;
myLastSeen.setToNow();
}
if (myActs->getNumBlobs(myChannel) == 0 ||
!myActs->getBlob(myChannel, 1, &blob))
{
if (myLastSeen.mSecSince() > 1000)
{
printf("DriveTo: Lost the blob, failed.\n");
myState = STATE_FAILED;
return NULL;
}
}
else
{
myLastSeen.setToNow();
}
if (myState == STATE_SUCCEEDED || myState == STATE_FAILED)
{
return NULL;
}
xRel = (double)(blob.getXCG() - WIDTH/2.0) / (double)WIDTH;
yRel = (double)(blob.getYCG() - HEIGHT/2.0) / (double)HEIGHT;
//printf("xRel %.3f yRel %.3f\n", xRel, yRel);
myDesired.reset();
// this if the stuff we want to do if we're not going to just drive forward
// and home in on the color, ie the pickup-specific stuff
if (currentDesired.getMaxVelStrength() > 0 &&
currentDesired.getMaxVel() < 50)
{
printf("DriveTo: Close to a wall of some sort, succeeded.\n");
myState = STATE_SUCCEEDED;
myDesired.setVel(0);
myDesired.setDeltaHeading(0);
return &myDesired;
}
if (ArMath::fabs(xRel) < .10)
{
//printf("Going straight ahead\n");
myDesired.setDeltaHeading(0);
}
else
{
//printf("Turning %.2f\n", -xRel * 10);
myDesired.setDeltaHeading(-xRel * 10);
}
myDesired.setVel(300);
return &myDesired;
}
示例4: close
void close()
{
ArLog::log(ArLog::Normal, "Closing gripper...");
myGripper->gripClose();
}
开发者ID:eilo,项目名称:Evolucion-Artificial-y-Robotica-Autonoma-en-Robots-Pioneer-P3-DX,代码行数:5,代码来源:gripper.cpp