Alex exoskeleton
ALEX SoftwareDocumentation
DummyTrajectoryGenerator.cpp
Go to the documentation of this file.
1 
13 
14 double sitting[6] = {90, 90, 90, 90, 0, 0};
15 double standing[6] = {180, 180, 0, 0, 0, 0};
16 
18  numJoints = NumOfJoints;
19 }
20 
22  currTraj = SIT;
23  trajTime = 2;
24  return true;
25 }
26 
32  currTraj = traj;
33  trajTime = time;
34  return true;
35 }
36 
43 std::vector<double> DummyTrajectoryGenerator::getSetPoint(double time) {
44  double progress = time / trajTime;
45  std::vector<double> angles;
46 
47  if (currTraj == SIT) {
48  for (int i = 0; i < numJoints; i++) {
49  if (progress > 1) {
50  angles.push_back(sitting[i]);
51  } else {
52  angles.push_back(standing[i] + progress * (sitting[i] - standing[i]));
53  }
54  }
55  } else {
56  for (int i = 0; i < numJoints; i++) {
57  if (progress > 1) {
58  angles.push_back(standing[i]);
59  } else {
60  angles.push_back(sitting[i] + progress * (standing[i] - sitting[i]));
61  }
62  }
63  }
64  lastProgress = progress;
65  return angles;
66 }
67 
69  if (lastProgress > 1.0) {
70  return true;
71  } else {
72  return false;
73  }
74 }
A trajectory generator to be used for testing purposes.
bool initialiseTrajectory()
Implementation of the initialiseTrajectory method in TrajectoryGenerator.
bool isTrajectoryFinished()
Check if the trajectory has been completed based on last elapsed time.
double sitting[6]
std::vector< double > getSetPoint(double time)
Implementation of the getSetPoint method in TrajectoryGenerator.
Trajectory
Enum containing possible trajectory types for DummyTrajectoryGenerator.
double standing[6]