YouBotArmTest.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 }
11 
13 
14 }
15 
17  Logger::logginLevel = trace;
18  updateCycle = 2000;
19 
20 }
21 
23  // EthercatMaster::destroy();
24 }
25 
27 
28  LOG(info) << __func__ << "\n";
29  YouBotManipulator myArm("youbot-manipulator", CONFIG_FOLDER_PATH);
30  myArm.doJointCommutation();
31  myArm.calibrateManipulator();
32 
33  std::stringstream jointNameStream;
34  boost::ptr_vector<DataTrace> myTrace;
35  std::vector<JointAngleSetpoint> upstretchedpose;
36  std::vector<JointAngleSetpoint> foldedpose;
37  JointAngleSetpoint desiredJointAngle;
38 
39  desiredJointAngle.angle = 2.56244 * radian;
40  upstretchedpose.push_back(desiredJointAngle);
41  desiredJointAngle.angle = 1.04883 * radian;
42  upstretchedpose.push_back(desiredJointAngle);
43  desiredJointAngle.angle = -2.43523 * radian;
44  upstretchedpose.push_back(desiredJointAngle);
45  desiredJointAngle.angle = 1.73184 * radian;
46  upstretchedpose.push_back(desiredJointAngle);
47  desiredJointAngle.angle = 1.5 * radian;
48  upstretchedpose.push_back(desiredJointAngle);
49 
50  desiredJointAngle.angle = 0.11 * radian;
51  foldedpose.push_back(desiredJointAngle);
52  desiredJointAngle.angle = 0.11 * radian;
53  foldedpose.push_back(desiredJointAngle);
54  desiredJointAngle.angle = -0.11 * radian;
55  foldedpose.push_back(desiredJointAngle);
56  desiredJointAngle.angle = 0.11 * radian;
57  foldedpose.push_back(desiredJointAngle);
58  desiredJointAngle.angle = 0.2 * radian;
59  foldedpose.push_back(desiredJointAngle);
60 
61 
62  for (int i = 1; i <= dof; i++) {
63  jointNameStream << "Joint_" << i << "_" << __func__;
64  myTrace.push_back(new DataTrace(myArm.getArmJoint(i), jointNameStream.str(), true));
65  jointNameStream.str("");
66  }
67 
68 
69  for (int i = 0; i < dof; i++) {
70  myTrace[i].startTrace();
71  }
72 
73  // 1 sec no movement
74  startTime = myTrace[0].getTimeDurationMilliSec();
75  overallTime = startTime + 1000;
76  while (myTrace[0].getTimeDurationMilliSec() < overallTime) {
77  for (int i = 0; i < dof; i++) {
78  myTrace[i].updateTrace();
79  }
81  }
82 
83  // move to upstretched position
84  startTime = myTrace[0].getTimeDurationMilliSec();
85  overallTime = startTime + 5000;
86  myArm.setJointData(upstretchedpose);
87  while (myTrace[0].getTimeDurationMilliSec() < overallTime) {
88  for (int i = 0; i < dof; i++) {
89  myTrace[i].updateTrace();
90  }
92  }
93 
94  // move to folded position
95  startTime = myTrace[0].getTimeDurationMilliSec();
96  overallTime = startTime + 5000;
97  myArm.setJointData(foldedpose);
98  while (myTrace[0].getTimeDurationMilliSec() < overallTime) {
99  for (int i = 0; i < dof; i++) {
100  myTrace[i].updateTrace();
101  }
103  }
104 
105  // 1 sec no movement
106  startTime = myTrace[0].getTimeDurationMilliSec();
107  overallTime = startTime + 1000;
108  while (myTrace[0].getTimeDurationMilliSec() < overallTime) {
109  for (int i = 0; i < dof; i++) {
110  myTrace[i].updateTrace();
111  }
113  }
114 
115  for (int i = 0; i < dof; i++) {
116  myTrace[i].stopTrace();
117  myTrace[i].plotTrace();
118  }
119 
120 }
void doJointCommutation()
does the sine commutation of the arm joints
It groups the manipulator joints and the gripper together.
unsigned int updateCycle
void calibrateManipulator(const bool forceCalibration=false)
calibrate the reference position of the arm joints
#define SLEEP_MICROSEC(microsec)
Definition: Time.hpp:61
#define LOG(level)
Definition: Logger.hpp:102
unsigned int startTime
unsigned int overallTime
Creates a trace of all process data and reads all configuration parameter from one joint...
Definition: DataTrace.hpp:82
virtual void setJointData(const std::vector< JointAngleSetpoint > &JointData)
YouBotJoint & getArmJoint(const unsigned int armJointNumber)
virtual ~YouBotArmTest()
void youBotArmTest()
quantity< plane_angle > angle
Definition: JointData.hpp:172
Set-point angle / position of the joint.
Definition: JointData.hpp:170


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