-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHumanoidControl.h
More file actions
executable file
·93 lines (77 loc) · 2.66 KB
/
HumanoidControl.h
File metadata and controls
executable file
·93 lines (77 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef __HUMANOIDCONTROL_H__
#define __HUMANOIDCONTROL_H__
#include <vector>
#include "Matrix.h"
#include "JointControl.h"
#include "Logger.h"
#define LeftStep true
#define RightStep false
class Humanoid
{
public:
Humanoid();
~Humanoid();
private:
Matrix Rot2Omega( Matrix R );
Matrix Rpy2Rot( AngRad a, AngRad b, AngRad c);
Matrix CalcVWerr( Matrix pTar, Matrix pNow, Matrix RTar, Matrix RNow );
Matrix Rodrigues( Matrix ang, float theta );
Matrix CrossMulti( Matrix w, Matrix p );
Matrix CalcLegJacobian( bool isLeftLeg, const Matrix &pTar );
private:
struct JointPara
{
Matrix a;
Matrix b;
AngRad q;
Matrix p;
Matrix R;
};
vector<JointPara> mLeftLeg;
vector<JointPara> mRightLeg;
vector<JointPara> mUpperJoints;
void InitUpperJoitnAngle();
void InitLegPara( bool isLeftLeg );
void InitLegAngle( bool isLeftLeg, int iPlan );
void UpdateLegPosAndR( bool isLeftLeg );
void UpdateLegAngle( AngRad &initQ, AngRad deltaQ );
bool InverseKinmatics( bool isLeftLeg, const Matrix &pTar, const Matrix &RTar );
bool IfLegJointLegal( bool isLeftLeg );
void IllegalJointLog( float forLength, float transLengh, float turnAng );
bool SetTarFoot( bool isLeftLeg, float posX, float posY, float posZ, Angle yawAng, Angle bodyAng, unsigned int frameNum );
bool GetTarFoot( bool isLeftLeg, float posX, float posY, float posZ, Angle angX, Angle angY, Angle angZ );
Angle GetUpperJoint( unsigned int legJointNum );
Angle GetLegJoint( bool isLeftLeg, unsigned int legJointNum );
public:
bool mFootStep;
void GetJoints( Joint &joints );
bool Walk( float forLength, float transLengh, float turnAng, vector<Joint> &tempjointsV );
bool TurnAndTrans( float forLength, float transLengh, float turnAng, vector<Joint> &tempjointsV );
bool QuickTurn( float turnAng, vector<Joint> &tempjointsV );
bool SteadyAdjust( float forLength, float transLengh, float turnAng, vector<Joint> &tempjointsV );
bool CheckWalkPara( float &forLength, float &transLengh, float &turnAng );
bool BufferAction( vector<Joint> &tempjointsV );
private:
const float cInitLeftTransLen;
const float cInitRightTransLen;
const float cInitForLen;
const float cInitHeight;
const Angle cBodyAngle;
float mUltiLeftForLen;
float mUltiLeftTransLen;
float mUltiLeftHeight;
float mUltiLeftTurn;
float mUltiRightForLen;
float mUltiRightTransLen;
float mUltiRightHeight;
float mUltiRightTurn;
float mWalkFrameNum;
float mTurnAndTransFrameNum;
float mQuickTurnFrameNum;
float mSteadyAdjustFrameNum;
public:
void ResetFrameNum();
void ResetFrameNum( float forLen );
void SetFootStep();
};
#endif //__HUMANOIDCONTROL_H__