Alex exoskeleton
ALEX SoftwareDocumentation
ExoRobot.h
Go to the documentation of this file.
1 
9 #ifndef EXOROBOT_H_INCLUDED
10 #define EXOROBOT_H_INCLUDED
11 
12 #include <time.h>
13 
14 #include <map>
15 
16 #include "CopleyDrive.h"
17 #include "DummyActJoint.h"
19 #include "Keyboard.h"
20 #include "Robot.h"
21 #include "RobotParams.h"
22 
27 class ExoRobot : public Robot {
28  private:
29  // \todo Load in paramaters and dictionary entries from JSON file.
30 
32  double currTrajProgress = 0;
33  timespec prevTime;
38  motorProfile posControlMotorProfile{4000000, 240000, 240000};
39 
40  public:
47  ~ExoRobot();
49  vector<CopleyDrive *> copleyDrives;
50 
51  // /**
52  // * @brief Timer Variables for moving through trajectories
53  // *
54  // */
55  struct timeval tv, tv_diff, moving_tv, tv_changed, stationary_tv, start_traj, last_tv;
56 
63  bool initPositionControl();
64 
70  bool moveThroughTraj();
71 
79  void startNewTraj();
80 
85  bool isTrajFinished();
86 
92  bool initialiseJoints();
93 
99  bool initialiseNetwork();
105  bool initialiseInputs();
109  void freeMemory();
115  void updateRobot();
121  //TODO CHANGE FROM MOTOR COMMANDS TO DEGREES
122  std::map<int, double>
124  {RIGHT_HIP, 0.0},
125  {LEFT_KNEE, 0.0},
126  {RIGHT_KNEE, 0.0},
127  {LEFT_ANKLE, -800000},
128  {RIGHT_ANKLE, -800000}};
134  std::map<int, double> jointMaxMap = {{LEFT_HIP, (HIP_MOTOR_POS1 * 1.5)},
135  {RIGHT_HIP, (HIP_MOTOR_POS1 * 1.5)},
136  {LEFT_KNEE, (KNEE_MOTOR_POS1 * 1.5)},
137  {RIGHT_KNEE, (KNEE_MOTOR_POS1 * 1.5)},
138  {LEFT_ANKLE, -800000},
139  {RIGHT_ANKLE, -800000}};
140 };
141 #endif /*EXOROBOT_H*/
void freeMemory()
Free robot objects vector pointer memory.
Definition: ExoRobot.cpp:104
bool initPositionControl()
Initialises all joints to position control mode.
Definition: ExoRobot.cpp:16
Example implementation of the Robot class, representing an X2 Exoskeleton, using DummyActuatedJoint a...
Definition: ExoRobot.h:27
vector< CopleyDrive * > copleyDrives
Definition: ExoRobot.h:49
A trajectory generator to be used for testing purposes.
Abstract Class representing a robot. Includes vectors of Joint and InputDevice.
Definition: Robot.h:28
#define HIP_MOTOR_POS1
Definition: RobotParams.h:58
bool initialiseNetwork()
Implementation of Pure Virtual function from Robot Base class. Initialize each Drive Objects underlyi...
Definition: ExoRobot.cpp:88
timespec prevTime
Definition: ExoRobot.h:33
#define KNEE_MOTOR_POS1
Definition: RobotParams.h:53
double currTrajProgress
Definition: ExoRobot.h:32
Example InputDevice which takes input in from a keyboard. Useful for testing without any other input ...
Definition: Keyboard.h:36
A dummy class to test whether the actuated joint inheritence stuff works.
bool initialiseJoints()
Implementation of Pure Virtual function from Robot Base class. Create designed Joint and Driver objec...
Definition: ExoRobot.cpp:80
bool moveThroughTraj()
For each joint, move through(send appropriate commands to joints) the Currently generated trajectory ...
Definition: ExoRobot.cpp:45
motorProfile posControlMotorProfile
motor drive position control profile paramaters
Definition: ExoRobot.h:38
~ExoRobot()
Definition: ExoRobot.cpp:8
ExoRobot(TrajectoryGenerator *tj)
Default ExoRobot constructor. Initialize memory for the Exoskelton Joint + sensors. Load in exoskeleton paramaters to TrajectoryGenerator..
Definition: ExoRobot.cpp:5
struct to hold desired velocity, acceleration and deceleration values for a drives motor controller p...
Definition: Drive.h:83
Abstract class which is used to generate trajectorys for a Robot to follow.
bool isTrajFinished()
void startNewTraj()
Begin a new trajectory with the currently loaded trajectory paramaters. Using the ExoRobot current co...
Definition: ExoRobot.cpp:37
std::map< int, double > jointMaxMap
Joint Limit Map between Joint value and max Degrees possible.
Definition: ExoRobot.h:134
Keyboard keyboard
Definition: ExoRobot.h:48
struct timeval tv tv_diff moving_tv tv_changed stationary_tv start_traj last_tv
Timer Variables for moving through trajectories.
Definition: ExoRobot.h:55
void updateRobot()
update current state of the robot, including input and output devices. Overloaded Method from the Rob...
Definition: ExoRobot.cpp:115
bool initialiseInputs()
Implementation of Pure Virtual function from Robot Base class. Initialize each Input Object...
Definition: ExoRobot.cpp:100
std::map< int, double > jointMinMap
Joint Limit Map between Joint value and min Degrees possible.
Definition: ExoRobot.h:123