z1_controller/include/trajectory/Trajectory.h

47 lines
1.5 KiB
C
Raw Normal View History

2022-07-20 11:11:38 +08:00
#ifndef TRAJECTORY_H
#define TRAJECTORY_H
2022-11-11 19:49:41 +08:00
#include "common/math/mathTools.h"
2022-07-20 11:11:38 +08:00
#include "control/CtrlComponents.h"
2022-11-11 19:49:41 +08:00
#include "common/utilities/timer.h"
2022-07-20 11:11:38 +08:00
class Trajectory{
public:
2022-11-11 19:49:41 +08:00
Trajectory(CtrlComponents *ctrlComp);
2022-07-20 11:11:38 +08:00
virtual ~Trajectory(){}
2022-09-13 19:53:15 +08:00
virtual bool getJointCmd(Vec6 &q, Vec6 &qd){return false;};
virtual bool getJointCmd(Vec6 &q, Vec6 &qd, double &gripperQ, double &gripperQd){return false;};
virtual bool getCartesionCmd(Vec6 pastPosture, Vec6 &endPosture, Vec6 &endTwist){return false;};
2022-07-20 11:11:38 +08:00
2022-11-11 19:49:41 +08:00
void restart();
virtual void setGripper(double startQ, double endQ, double speed = M_PI);
2022-07-20 11:11:38 +08:00
bool correctYN(){return _settingCorrect;}
Vec6 getStartQ(){return _startQ;}
Vec6 getEndQ(){return _endQ;}
2022-11-11 19:49:41 +08:00
double getEndGripperQ(){return _endGripperQ;};
double getStartGripperQ(){return _startGripperQ;};
HomoMat getStartHomo(){return _startHomo;};
HomoMat getEndHomo(){return _endHomo;};
Vec6 getEndPosture(){return _endPosture;};
2022-07-20 11:11:38 +08:00
double getPathTime(){return _pathTime;}
protected:
2022-11-11 19:49:41 +08:00
void _runTime();
2022-07-20 11:11:38 +08:00
CtrlComponents *_ctrlComp;
2022-11-11 19:49:41 +08:00
ArmModel *_armModel;
2022-07-20 11:11:38 +08:00
CSVTool *_csvState;
bool _pathStarted = false;
bool _reached = false;
bool _settingCorrect = true;
2022-11-11 19:49:41 +08:00
double _startTime, _currentTime, _pathTime, _tCost;
2022-09-13 19:53:15 +08:00
Vec6 _qPast;
2022-11-11 19:49:41 +08:00
Vec6 _startQ, _endQ, _deltaQ;
2022-07-20 11:11:38 +08:00
HomoMat _startHomo, _endHomo;
2022-11-11 19:49:41 +08:00
Vec6 _startPosture, _endPosture, _deltaPosture;
double _startGripperQ, _endGripperQ;
2022-07-20 11:11:38 +08:00
};
#endif // TRAJECTORY_H