本文整理汇总了C++中Arm::sync方法的典型用法代码示例。如果您正苦于以下问题:C++ Arm::sync方法的具体用法?C++ Arm::sync怎么用?C++ Arm::sync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arm
的用法示例。
在下文中一共展示了Arm::sync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
desiredVels.resize(5);
puts("Connecting... press ctrl-c to cancel");
if(!arm.open())
{
puts("Error opening arm");
return 1;
}
puts("\nConnected to arm.\nPress spacebar or exit program (ESC) to stop arm.\n");
puts(" b/1/2 Select base joints (joint 1 rotation, joint 2 pivot)");
puts(" e/2/3 Select elbow joints (joint 3 pivot, joint 4 rotation)");
puts(" w/4/5 Select wrist joints (joint 5 pivot, joint 6 rotation)");
puts(" UP/DOWN Change pivot speed");
puts(" LEFT/RIGHT Change rotate speed");
puts(" SPACE Stop");
puts(" g/G Gripper");
puts("\npress ESC or q to exit program\n");
ArKeyHandler keys;
keys.addKeyHandler(ArKeyHandler::SPACE, new ArFunctorC<Arm>(&arm, &Arm::haltAll));
keys.addKeyHandler(ArKeyHandler::UP, new ArGlobalFunctor(&increasePivot));
keys.addKeyHandler(ArKeyHandler::DOWN, new ArGlobalFunctor(&decreasePivot));
keys.addKeyHandler(ArKeyHandler::LEFT, new ArGlobalFunctor(&decreaseRotate));
keys.addKeyHandler(ArKeyHandler::RIGHT, new ArGlobalFunctor(&increaseRotate));
keys.addKeyHandler('G', new ArGlobalFunctor(&increaseGrip));
keys.addKeyHandler('g', new ArGlobalFunctor(&decreaseGrip));
keys.addKeyHandler('b', new ArGlobalFunctor(&selectBase));
keys.addKeyHandler('e', new ArGlobalFunctor(&selectElbow));
keys.addKeyHandler('w', new ArGlobalFunctor(&selectWrist));
keys.addKeyHandler('1', new ArGlobalFunctor(&selectBase));
keys.addKeyHandler('2', new ArGlobalFunctor(&selectBase));
keys.addKeyHandler('3', new ArGlobalFunctor(&selectElbow));
keys.addKeyHandler('4', new ArGlobalFunctor(&selectElbow));
keys.addKeyHandler('5', new ArGlobalFunctor(&selectWrist));
keys.addKeyHandler('6', new ArGlobalFunctor(&selectWrist));
keys.addKeyHandler(ArKeyHandler::ESCAPE, new ArGlobalFunctor1<int>(&Aria::exit, 0));
keys.addKeyHandler('q', new ArGlobalFunctor1<int>(&Aria::exit, 0));
std::vector<float> pos;
int ctr = 0;
while(true)
{
ArUtil::sleep(20);
keys.checkKeys();
arm.sync();
if(DISPLAY_POSITIONS && ++ctr > 500)
{
pos = arm.getJointPositions();
for(std::vector<float>::const_iterator i = pos.begin(); i != pos.end(); ++i)
{
int n = (i - pos.begin());
if(n == selectedPivotJoint || n == selectedRotateJoint)
printf("[% 3.1f]", *i);
else
printf(" % 3.1f ", *i);
}
printf(" press ESC to exit, SPACE to halt arm\r");
ctr = 0;
}
}
return 0;
}