controller.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2004 Etienne Lachance
3 
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8 
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 Report problems and direct all questions to:
20 
21 email: etienne.lachance@polymtl.ca or richard.gourdeau@polymtl.ca
22 
23 -------------------------------------------------------------------------------
24 Revision_history:
25 
26 2004/07/13: Ethan Tira-Thompson
27  -Added support for newmat's use_namespace #define, using ROBOOP namespace
28 
29 2005/06/10: Etienne Lachance
30  -The desired joint acceleration was missing in the computed torque method.
31 
32 2005/11/06: Etienne Lachance
33  - No need to provide a copy constructor and the assignment operator
34  (operator=) for Impedance, Resolved_acc, Computed_torque_method and
35  Proportional_Derivative classes. Instead we use the one provide by the
36  compiler.
37 -------------------------------------------------------------------------------
38 */
39 
40 #ifndef CONTROLLER_H
41 #define CONTROLLER_H
42 
48 static const char header_controller_rcsid[] = "$Id: controller.h,v 1.5 2006/05/16 16:11:15 gourdeau Exp $";
50 
51 
52 #include "robot.h"
53 #include "quaternion.h"
54 
55 #ifdef use_namespace
56 namespace ROBOOP {
57  using namespace NEWMAT;
58 #endif
59 
61 #define WRONG_SIZE -1
62 
91 class Impedance{
92 public:
93  Impedance();
94  Impedance(const Robot_basic & robot, const DiagonalMatrix & Mp_,
95  const DiagonalMatrix & Dp_, const DiagonalMatrix & Kp_,
96  const DiagonalMatrix & Mo_, const DiagonalMatrix & Do_,
97  const DiagonalMatrix & Ko_);
98  short set_Mp(const DiagonalMatrix & Mp_);
99  short set_Mp(const Real MP_i, const short i);
100  short set_Dp(const DiagonalMatrix & Dp_);
101  short set_Dp(const Real Dp_i, const short i);
102  short set_Kp(const DiagonalMatrix & Kp_);
103  short set_Kp(const Real Kp_i, const short i);
104  short set_Mo(const DiagonalMatrix & Mo_);
105  short set_Mo(const Real Mo_i, const short i);
106  short set_Do(const DiagonalMatrix & Do_);
107  short set_Do(const Real Do_i, const short i);
108  short set_Ko(const DiagonalMatrix & Ko_);
109  short set_Ko(const Real Ko_i, const short i);
110  short control(const ColumnVector & pdpp, const ColumnVector & pdp,
111  const ColumnVector & pd, const ColumnVector & wdp,
112  const ColumnVector & wd, const Quaternion & qd,
113  const ColumnVector & f, const ColumnVector & n,
114  const Real dt);
115 
117  qcp,
118  qcp_prev,
119  qcd,
120  quat;
122  pcp,
123  pcpp,
124  pcp_prev,
125  pcpp_prev,
126  pcd,
127  pcdp,
128  wc,
129  wcp,
130  wcp_prev,
131  wcd;
132 private:
134  Dp,
135  Kp,
136  Mo,
137  Do,
138  Ko;
140 };
141 
172 public:
173  Resolved_acc(const short dof = 1);
175  const Real Kvp, const Real Kpp,
176  const Real Kvo, const Real Kpo);
177  void set_Kvp(const Real Kvp);
178  void set_Kpp(const Real Kpp);
179  void set_Kvo(const Real Kvo);
180  void set_Kpo(const Real Kpo);
181 
182  ReturnMatrix torque_cmd(Robot_basic & robot, const ColumnVector & pdpp,
183  const ColumnVector & pdp, const ColumnVector & pd,
184  const ColumnVector & wdp, const ColumnVector & wd,
185  const Quaternion & qd, const short link_pc,
186  const Real dt);
187 private:
188  double Kvp,
189  Kpp,
190  Kvo,
191  Kpo;
194  qp,
195  qpp,
196  a,
197  p,
198  pp,
199  quat_v_error;
201 };
202 
203 
221 public:
222  Computed_torque_method(const short dof = 1);
224  const DiagonalMatrix & Kp, const DiagonalMatrix & Kd);
225  ReturnMatrix torque_cmd(Robot_basic & robot, const ColumnVector & qd,
226  const ColumnVector & qpd,
227  const ColumnVector & qppd);
228  short set_Kd(const DiagonalMatrix & Kd);
229  short set_Kp(const DiagonalMatrix & Kp);
230 
231 private:
232  int dof;
234  qp,
235  qpp,
236  zero3;
238  Kd;
239 };
240 
241 
253 public:
254  Proportional_Derivative(const short dof = 1);
256  const DiagonalMatrix & Kd);
257  ReturnMatrix torque_cmd(Robot_basic & robot, const ColumnVector & qd,
258  const ColumnVector & qpd);
259  short set_Kd(const DiagonalMatrix & Kd);
260  short set_Kp(const DiagonalMatrix & Kp);
261 
262 private:
263  int dof;
265  qp,
266  qpp,
267  tau,
268  zero3;
270  Kd;
271 };
272 
273 #ifdef use_namespace
274 }
275 #endif
276 
277 #endif
278 
Quaternion class definition.
Definition: quaternion.h:92
DiagonalMatrix Mp
Translational impedance inertia matrix.
Definition: controller.h:133
Computer torque method controller class.
Definition: controller.h:220
ColumnVector zero3
zero vector.
Definition: controller.h:193
ColumnVector wcp_prev
Previous value of wcp.
Definition: controller.h:121
double Kvp
Controller gains.
Definition: controller.h:188
Resolved rate acceleration controller class.
Definition: controller.h:171
Robots class definitions.
double Real
Definition: include.h:307
Impedance controller class.
Definition: controller.h:91
Matrix Ko_prime
Modified rotational impedance stifness matrix.
Definition: controller.h:139
Matrix Rot
Temporay rotation matrix.
Definition: controller.h:192
Quaternion quat
Temporary quaternion.
Definition: controller.h:116
Virtual base robot class.
Definition: robot.h:216
Quaternion quat
Temporary quaternion.
Definition: controller.h:200
static const char header_controller_rcsid[]
RCS/CVS version.
Definition: controller.h:49
The usual rectangular matrix.
Definition: newmat.h:625
int dof
Degree of freedom.
Definition: controller.h:232
FloatVector FloatVector * a
DiagonalMatrix Kp
Position error gain.
Definition: controller.h:237
Quaternion class.
ColumnVector zero3
zero vector.
Definition: controller.h:233
Diagonal matrix.
Definition: newmat.h:896
ColumnVector zero3
zero vector.
Definition: controller.h:264
int dof
Degree of freedom.
Definition: controller.h:263
Column vector.
Definition: newmat.h:1008
Proportional derivative controller class.
Definition: controller.h:252
DiagonalMatrix Kp
Position error gain.
Definition: controller.h:269
Robot robot
Definition: demo.cpp:227


kni
Author(s): Martin Günther
autogenerated on Fri Jun 7 2019 22:06:44