ROBOOP, A Robotics Object Oriented Package in C++
sensitiv.cpp
Go to the documentation of this file.
1 /*
2 ROBOOP -- A robotics object oriented package in C++
3 Copyright (C) 1996-2004 Richard Gourdeau
4 
5 This library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9 
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14 
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 
19 
20 Report problems and direct all questions to:
21 
22 Richard Gourdeau, Professeur
23 Departement de genie electrique
24 Ecole Polytechnique de Montreal
25 C.P. 6079, Succ. Centre-Ville
26 Montreal, Quebec, H3C 3A7
27 
28 email: richard.gourdeau@polymtl.ca
29 
30 -------------------------------------------------------------------------------
31 Revision_history:
32 
33 2004/07/01: Ethan Tira-Thompson
34  -Added support for newmat's use_namespace #define, using ROBOOP namespace
35 
36 2004/07/02: Etienne Lachance
37  -Added Doxygen comments.
38 -------------------------------------------------------------------------------
39 */
40 
46 #include "robot.h"
47 
48 #ifdef use_namespace
49 namespace ROBOOP {
50  using namespace NEWMAT;
51 #endif
52 
53 
54 ReturnMatrix Robot_basic::dtau_dq(const ColumnVector & q,
55  const ColumnVector & qp,
56  const ColumnVector & qpp)
62 {
63  int i, j;
64  Matrix ldtau_dq(dof,dof);
65  ColumnVector ltorque(dof);
66  ColumnVector dtorque(dof);
67  ColumnVector dq(dof);
68  for(i = 1; i <= dof; i++) {
69  for(j = 1; j <= dof; j++) {
70  dq(j) = (i == j ? 1.0 : 0.0);
71  }
72  dq_torque(q,qp,qpp,dq,ltorque,dtorque);
73  for(j = 1; j <= dof; j++) {
74  ldtau_dq(j,i) = dtorque(j);
75  }
76  }
77  ldtau_dq.Release(); return ldtau_dq;
78 }
79 
80 ReturnMatrix Robot_basic::dtau_dqp(const ColumnVector & q,
81  const ColumnVector & qp)
87 {
88  int i, j;
89  Matrix ldtau_dqp(dof,dof);
90  ColumnVector ltorque(dof);
91  ColumnVector dtorque(dof);
92  ColumnVector dqp(dof);
93  for(i = 1; i <= dof; i++) {
94  for(j = 1; j <= dof; j++) {
95  dqp(j) = (i == j ? 1.0 : 0.0);
96  }
97  dqp_torque(q,qp,dqp,ltorque,dtorque);
98  for(j = 1; j <= dof; j++) {
99  ldtau_dqp(j,i) = dtorque(j);
100  }
101  }
102  ldtau_dqp.Release(); return ldtau_dqp;
103 }
104 
105 #ifdef use_namespace
106 }
107 #endif
108 
109 
110