49 static const char rcsid[] =
"$Id: rtest.cpp,v 1.15 2005/07/01 17:44:53 gourdeau Exp $";
58 using namespace ROBOOP;
62 {0, 0, 0, 0,
M_PI/2.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.35, 0, 0, 0,
63 0, 0, 0, 0.4318, 0, 0, 0, 0, 17.4, -0.3638, 0.006, 0.2275, 0.13, 0, 0, 0.524, 0, 0.539, 0,
64 0, 0, 0.15005, 0.0203, -
M_PI/2.0, 0, 0, 0, 4.8, -0.0203, -0.0141, 0.07, 0.066, 0, 0, 0.086, 0, 0.0125, 0,
65 0, 0, 0.4318, 0.0,
M_PI/2.0, 0, 0, 0, 0.82, 0, 0.019, 0, 0.0018, 0, 0, 0.0013, 0, 0.0018, 0,
66 0, 0, 0, 0.0, -
M_PI/2.0, 0, 0, 0, 0.34, 0.0, 0.0, 0.0, 0.0003, 0.0, 0.0, 0.0004, 0.0, 0.0003, 0,
67 0, 0, 0, 0, 0, 0, 0, 0, 0.09, 0.0, 0.0, 0.032, 0.00015, 0.0, 0.0, 0.00015, 0.0, 0.00004, 0};
70 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.35, 0,
71 0, 0, 0, 0.0, -
M_PI/2, 0, 0, 0, 17.4, 0.068, 0.006, -0.016, 0.13, 0, 0, 0.524, 0, 0.539, 0,
72 0, 0, -0.15005, 0.4318, 0, 0, 0, 0, 4.8, 0, -0.070, 0.014, 0.066, 0, 0, 0.0125, 0, 0.066, 0,
73 0, 0, -0.4318, 0.0203, -
M_PI/2.0, 0, 0, 0, 0.82, 0.0, 0.0, -0.019, 0.0018, 0, 0, 0.0018, 0, 0.0013, 0,
74 0, 0, 0, 0,
M_PI/2.0, 0, 0, 0, 0.34, 0, 0, 0.0, 0.0003, 0, 0, 0.0003, 0, 0.0004, 0,
75 0, 0, 0, 0, -
M_PI/2, 0, 0, 0, 0.09, 0, 0, 0.032, 0.00015, 0, 0, 0.00015, 0, 0.00004, 0};
77 {200e-6, -62.6111, 1.48e-3, 0,
78 200e-6, 107.815, .817e-3, 0,
79 200e-6, -53.7063, 1.38e-3, 0,
80 33e-6, 76.0364, 71.2e-6, 0,
81 33e-6, 71.923, 82.6e-6, 0,
82 33e-6, 76.686, 36.7e-6, 0};
85 {0.0, 0.0, 0.4120, 0.0, -
M_PI/2, 0,0,0,9.29, 0.0, 0.0175, -0.1105, 0.276, 0.0, 0, 0.255, 0.0, 0.071,0,0,0,0,0,
86 0.0, 0.0, 0.1540, 0.0,
M_PI/2.0, 0,0,0,5.01, 0.0, -1.054, 0.0, 0.108, 0.0, 0.0, 0.018, 0.0, 0.1,0,0,0,0,0,
87 1.0, -
M_PI/2.0, 0.0, 0.0, 0.0, 0,0,0,4.25, 0.0, 0.0, -6.447, 2.51, 0.0, 0.0, 2.51, 0.0, 0.006,0,0,0,0,0,
88 0.0, 0.0, 0.0, 0.0, -
M_PI/2.0, 0,0,0,1.08, 0.0, 0.092, -0.054, 0.002, 0.0, 0.0, 0.001, 0.0, 0.001,0,0,0,0,0,
89 0.0, 0.0, 0.0, 0.0,
M_PI/2.0, 0,0,0,0.63, 0.0, 0.0, 0.566, 0.003, 0.0, 0.0, 0.003, 0.0, 0.0004,0,0,0,0,0,
90 0.0, 0.0, 0.2630, 0.0, 0.0, 0,0,0,0.51, 0.0, 0.0, 1.5540, 0.013, 0.0, 0.0, 0.013, 0.0, 0.0003,0,0,0,0,0};
96 infile.open(
"source/test.txt");
98 cerr <<
"Cannot open file:";
99 cerr <<
"source/test.txt\n";
102 Matrix Test(4,4), p1(3,1);
105 cout <<
"=====================================================\n";
106 cout <<
" ROBOOP -- A robotics object oriented package in C++ \n";;
107 cout <<
" TEST program \n";
108 cout <<
"=====================================================\n";
110 cout <<
"Machine epsilon = " << eps << endl;
113 cout <<
"Testing translation : ";
114 Real ott[] = {1.0,2.0,3.0};
116 for(i = 1; i <= 4; i++) {
117 for(
int j = 1; j <= 4; j++) {
123 cout <<
"Erreur = " << a << endl;
125 cout <<
"Ok" << endl;
128 cout <<
"Testing rotx : ";
129 for(i = 1; i <= 4; i++) {
130 for(
int j = 1; j <= 4; j++) {
136 cout <<
"Erreur = " << a << endl;
138 cout <<
"Ok" << endl;
141 cout <<
"Testing roty : ";
142 for(i = 1; i <= 4; i++) {
143 for(
int j = 1; j <= 4; j++) {
149 cout <<
"Erreur = " << a << endl;
151 cout <<
"Ok" << endl;
154 cout <<
"Testing rotz : ";
155 for(i = 1; i <= 4; i++) {
156 for(
int j = 1; j <= 4; j++) {
162 cout <<
"Erreur = " << a << endl;
164 cout <<
"Ok" << endl;
167 cout <<
"Testing roll-pitch-yaw : ";
168 for(i = 1; i <= 4; i++) {
169 for(
int j = 1; j <= 4; j++) {
175 cout <<
"Erreur = " << a << endl;
177 cout <<
"Ok" << endl;
180 cout <<
"Testing rotation around vector : ";
181 for(i = 1; i <= 4; i++) {
182 for(
int j = 1; j <= 4; j++) {
188 cout <<
"Erreur = " << a << endl;
190 cout <<
"Ok" << endl;
194 cout <<
"Testing quaternion to rotation matrix : ";
195 for(i = 1; i <= 3; i++) {
196 for(
int j = 1; j <= 3; j++) {
206 cout <<
"Erreur = " << a << endl;
208 cout <<
"Ok" << endl;
212 cout <<
"Testing quaternion to rotation matrix : ";
213 for(i = 1; i <= 3; i++) {
214 for(
int j = 1; j <= 3; j++) {
225 cout <<
"Erreur = " << a << endl;
227 cout <<
"Ok" << endl;
230 cout <<
"Testing quaternion to transformation matrix : ";
231 for(i = 1; i <= 4; i++) {
232 for(
int j = 1; j <= 4; j++) {
238 cout <<
"Erreur = " << a << endl;
240 cout <<
"Ok" << endl;
243 cout <<
"Testing rotation matrix to quaternion : ";
247 for(i = 1; i <= 4; i++) {
254 cout <<
"Erreur = " << a << endl;
256 cout <<
"Ok" << endl;
259 cout <<
"Testing transformation matrix to quaternion : ";
262 for(i = 1; i <= 4; i++) {
269 cout <<
"Erreur = " << a << endl;
271 cout <<
"Ok" << endl;
287 cout <<
"Testing Puma 560 (DH) forward kinematic : ";
289 for(i = 1; i <= 4; i++) {
290 for(
int j = 1; j <= 4; j++) {
298 robot_DH =
Robot(initrob, initrobm);
305 cout <<
"Erreur = " << a << endl;
307 cout <<
"Ok" << endl;
310 cout <<
"Testing Puma 560 (DH) jacobian in base frame : ";
312 for(i = 1; i <= 6; i++) {
313 for(
int j = 1; j <= 6; j++) {
319 cout <<
"Erreur = " << a << endl;
321 cout <<
"Ok" << endl;
324 cout <<
"Testing Puma 560 (DH) jacobian in tool frame : ";
325 for(i = 1; i <= 6; i++) {
326 for(
int j = 1; j <= 6; j++) {
332 cout <<
"Erreur = " << a << endl;
334 cout <<
"Ok" << endl;
339 robot_DH =
Robot(initrob,initrobm);
340 Test =
Matrix(dof,1); Test = 0;
341 cout <<
"Testing Puma 560 (DH) torque : ";
342 for(i = 1; i <= dof; i++) {
350 cout <<
"Erreur = " << a << endl;
352 cout <<
"Ok" << endl;
355 cout <<
"Testing Puma 560 (DH) inertia : ";
357 for(i = 1; i <= 6; i++) {
358 for(
int j = 1; j <= 6; j++){
364 cout <<
"Erreur = " << a << endl;
366 cout <<
"Ok" << endl;
371 robot_DH =
Robot(initrob,initrobm);
374 cout <<
"Testing Puma 560 (DH) motor, torque : ";
376 for(i = 1; i <= dof; i++) {
381 cout <<
"Erreur = " << a << endl;
383 cout <<
"Ok" << endl;
387 cout <<
"Testing Stanford (DH) forward kinematic : ";
389 for(i = 1; i <= 4; i++) {
390 for(
int j = 1; j <= 4; j++) {
396 robot_DH =
Robot(initrob);
403 cout <<
"Erreur = " << a << endl;
405 cout <<
"Ok" << endl;
408 cout <<
"Testing Stanford (DH) jacobian in base frame : ";
410 for(i = 1; i <= 6; i++) {
411 for(
int j = 1; j <= 6; j++) {
417 cout <<
"Erreur = " << a << endl;
419 cout <<
"Ok" << endl;
422 cout <<
"Testing Stanford (DH) jacobian in tool frame : ";
423 for(i = 1; i <= 6; i++) {
424 for(
int j = 1; j <= 6; j++) {
430 cout <<
"Erreur = " << a << endl;
432 cout <<
"Ok" << endl;
435 Test =
Matrix(dof,1); Test = 0;
436 cout <<
"Testing Stanford (DH) torque : ";
437 for(i = 1; i <= dof; i++) {
442 cout <<
"Erreur = " << a << endl;
444 cout <<
"Ok" << endl;
447 cout <<
"Testing Stanford (DH) torque with load on link n: ";
448 Fext(1)=10; Fext(2)=5; Fext(3)=7;
449 Next(1)=11; Next(2)=22; Next(3)=33;
450 for(i = 1; i <= dof; i++) {
455 cout <<
"Erreur = " << a << endl;
457 cout <<
"Ok" << endl;
460 cout <<
"Testing Stanford (DH) inertia : ";
461 Test =
Matrix(6,6); Test = 0;
462 for(i = 1; i <= 6; i++) {
463 for(
int j = 1; j <= 6; j++){
469 cout <<
"Erreur = " << a << endl;
471 cout <<
"Ok" << endl;
478 cout <<
"Testing Puma 560 (mDH) forward kinematic : ";
479 for(i = 1; i <= 4; i++) {
480 for(
int j = 1; j <= 4; j++) {
488 robot_mDH =
mRobot(initrob, initrobm);
495 cout <<
"Erreur = " << a << endl;
497 cout <<
"Ok" << endl;
501 cout <<
"Testing Puma 560 (mDH) jacobian in base frame : ";
503 for(i = 1; i <= 6; i++) {
504 for(
int j = 1; j <= 6; j++) {
510 cout <<
"Erreur = " << a << endl;
512 cout <<
"Ok" << endl;
515 cout <<
"Testing Puma 560 (mDH) jacobian in tool frame : ";
516 for(i = 1; i <= 6; i++) {
517 for(
int j = 1; j <= 6; j++) {
523 cout <<
"Erreur = " << a << endl;
525 cout <<
"Ok" << endl;
530 robot_mDH =
mRobot(initrob,initrobm);
532 cout <<
"Testing Puma 560 (mDH) torque : ";
534 for(i = 1; i <= dof; i++) {
539 cout <<
"Erreur = " << a << endl;
541 cout <<
"Ok" << endl;
544 cout <<
"Testing Puma 560 (mDH) inertia : ";
545 Test =
Matrix(6,6); Test = 0;
546 for(i = 1; i <= 6; i++) {
547 for(
int j = 1; j <= 6; j++){
553 cout <<
"Erreur = " << a << endl;
555 cout <<
"Ok" << endl;
558 cout <<
"Testing Puma 560 (mDH) motor, torque : ";
561 robot_mDH =
mRobot(initrob,initrobm);
563 for(i = 1; i <= dof; i++) {
568 cout <<
"Erreur = " << a << endl;
570 cout <<
"Ok" << endl;
573 cout <<
"Testing Puma 560 (mDH) motor, torque with load on link n: ";
574 Fext(1)=10; Fext(2)=5; Fext(3)=7;
575 Next(1)=11; Next(2)=22; Next(3)=33;
576 for(i = 1; i <= dof; i++) {
581 cout <<
"Erreur = " << a << endl;
583 cout <<
"Ok" << endl;
Quaternion class definition.
ReturnMatrix R() const
Rotation matrix from a unit quaternion.
int get_dof() const
Return dof.
virtual ReturnMatrix torque(const ColumnVector &q, const ColumnVector &qp, const ColumnVector &qpp)
Joint torque, without contact force, based on Recursive Newton-Euler formulation. ...
static const char rcsid[]
RCS/CVS version.
ReturnMatrix trans(const ColumnVector &a)
Translation.
Robots class definitions.
ReturnMatrix rpy(const ColumnVector &a)
Roll Pitch Yaw rotation.
ReturnMatrix inertia(const ColumnVector &q)
Inertia of the manipulator.
ReturnMatrix rotx(const Real alpha)
Rotation around x axis.
virtual ReturnMatrix torque(const ColumnVector &q, const ColumnVector &qp, const ColumnVector &qpp)
Joint torque, without contact force, based on Recursive Newton-Euler formulation. ...
Quaternion & unit()
Normalize a quaternion.
void set_q(const ColumnVector &q)
Set the joint position vector.
Modified DH notation robot class.
Real MaximumAbsoluteValue(const BaseMatrix &B)
const Real STANFORD_data_DH[]
ReturnMatrix rotz(const Real gamma)
Rotation around z axis.
const Real PUMA560_motor[]
The usual rectangular matrix.
FloatVector FloatVector * a
virtual ReturnMatrix jacobian(const int ref=0) const
Jacobian of mobile links expressed at frame ref.
ReturnMatrix roty(const Real beta)
Rotation around x axis.
void kine(Matrix &Rot, ColumnVector &pos) const
Direct kinematics at end effector.
GetSubMatrix SubMatrix(int fr, int lr, int fc, int lc) const
virtual ReturnMatrix jacobian(const int ref=0) const
Jacobian of mobile links expressed at frame ref.
const Real PUMA560_data_DH[]
ReturnMatrix T() const
Transformation matrix from a quaternion.
ReturnMatrix rotk(const Real theta, const ColumnVector &k)
Rotation around arbitrary axis.