-
Notifications
You must be signed in to change notification settings - Fork 6
/
robot_model.h
123 lines (103 loc) · 2.46 KB
/
robot_model.h
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#ifndef __ROBOT_MODEL__
#define __ROBOT_MODEL__
#include <rbdl/rbdl.h>
#include "motion.h"
#include "fwd.h"
using namespace RigidBodyDynamics;
using namespace Eigen;
namespace HQP {
namespace robot {
enum Type {
Manipulator = 0,
MobileManipulator = 1,
Humanoid = 2
};
class RobotModel
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
RobotModel(Type robottype);
~RobotModel();
void getUpdateKinematics(const VectorXd & q, const VectorXd & qdot);
const MatrixXd & getJacobian(const int & frame_id) {
Jacobian(frame_id);
return m_J_;
}
const VectorXd & getPosition(const int & frame_id) {
Position(frame_id);
return m_pos_;
}
const MatrixXd & getOrientation(const int & frame_id) {
Orientation(frame_id);
return m_Ori_;
}
const Transform3d & getTransformation(const int & frame_id) {
Transformation(frame_id);
return m_Trans_;
}
const VectorXd & getNLEtorque() {
NLEtorque();
return m_NLE_;
}
const MatrixXd & getMassMatrix() {
MassMatrix();
return m_Mass_mat_;
}
const unsigned int & na() {
return m_na_;
}
const unsigned int & nv() {
return m_nv_;
}
const unsigned int & nq() {
return m_nq_;
}
const Type & type() {
return m_robot_type_;
}
const MotionVector<double> & getPointVeloecity(const int & frame_id) {
PointVelocity(frame_id);
return m_p_dot_;
}
private:
void Jacobian(const int & frame_id);
void Position(const int & frame_id);
void Orientation(const int & frame_id);
void Transformation(const int & frame_id);
void NLEtorque();
void MassMatrix();
void PointVelocity(const int & frame_id);
void setRobot();
Model* model_;
Body body_[dof];
Joint joint_[dof];
VectorXd q_;
VectorXd qdot_;
double mass_[dof];
Math::Vector3d axis_[dof];
Math::Vector3d inertia_[dof];
Math::Vector3d joint_position_global_[dof];
Math::Vector3d joint_position_local_[dof];
Math::Vector3d com_position_[dof];
Math::SpatialVector p_dot_;
Math::VectorNd q_rbdl_;
Math::VectorNd qdot_rbdl_;
Math::VectorNd qddot_rbdl_;
Math::VectorNd tau_;
unsigned int body_id_[dof];
MatrixXd m_Mass_mat_;
VectorXd m_NLE_;
Vector3d m_pos_;
Matrix3d m_Ori_;
MatrixXd m_J_;
MotionVector<double> m_p_dot_;
Transform3d m_Trans_;
Type m_robot_type_;
protected:
unsigned int m_nv_;
unsigned int m_na_;
unsigned int m_nq_;
};
}
}
#endif