YouBotGripperTest.cpp
Go to the documentation of this file.
2 
3 using namespace youbot;
4 
6 
7  EthercatMaster::getInstance("youbot-ethercat.cfg", CONFIG_FOLDER_PATH, true);
8 
9 }
10 
12 
13 }
14 
16  Logger::logginLevel = trace;
17  updateCycle = 2000;
18 
19 }
20 
22  // EthercatMaster::destroy();
23 }
24 
26 
27  LOG(info) << __func__ << "\n";
28  YouBotManipulator myArm("youbot-manipulator", CONFIG_FOLDER_PATH);
29 
30  GripperDataTrace myTrace(myArm.getArmGripper().getGripperBar2(), __func__, true);
31 
32  TargetPositionReached bar1TargetReched;
33  TargetPositionReached bar2TargetReched;
34  bool targetReachedBar1 = false;
35  bool targetReachedBar2 = false;
36 
37  myArm.calibrateGripper(true);
38  myTrace.startTrace("Load", "");
39 
40  //open gripper
41  myArm.getArmGripper().open();
42 
43  for (int i = 0; i < 40; i++) {
44  myArm.getArmGripper().getGripperBar1().getConfigurationParameter(bar1TargetReched);
45  bar1TargetReched.getParameter(targetReachedBar1);
46  myArm.getArmGripper().getGripperBar2().getConfigurationParameter(bar2TargetReched);
47  bar2TargetReched.getParameter(targetReachedBar2);
48  myTrace.updateTrace((double)targetReachedBar1);
49  if (targetReachedBar1 && targetReachedBar2) {
50  break;
51  }
52  }
53  targetReachedBar1 = false;
54  targetReachedBar2 = false;
55 
56  //close gripper
57  myArm.getArmGripper().close();
58 
59  for (int i = 0; i < 40; i++) {
60  myArm.getArmGripper().getGripperBar1().getConfigurationParameter(bar1TargetReched);
61  bar1TargetReched.getParameter(targetReachedBar1);
62  myArm.getArmGripper().getGripperBar2().getConfigurationParameter(bar2TargetReched);
63  bar2TargetReched.getParameter(targetReachedBar2);
64  myTrace.updateTrace((double)targetReachedBar2);
65  if (targetReachedBar1 && targetReachedBar2) {
66  break;
67  }
68  }
69 
70  myTrace.stopTrace();
71  myTrace.plotTrace();
72 
73 
74 }
Indicates that the actual position equals the target position.
It groups the manipulator joints and the gripper together.
unsigned int updateCycle
virtual void getConfigurationParameter(MaxEncoderValue &parameter) const
YouBotGripperBar & getGripperBar1()
#define LOG(level)
Definition: Logger.hpp:102
YouBotGripperBar & getGripperBar2()
void getParameter(bool &parameter) const
void calibrateGripper(const bool forceCalibration=false)
Creates a trace of one parameter of the gripper.


youbot_driver
Author(s): Jan Paulus
autogenerated on Mon Jun 10 2019 15:46:25