cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
robManipulator.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ex: set filetype=cpp softtabstop=2 shiftwidth=2 tabstop=2 cindent expandtab: */
3 
4 /*
5  Author(s): Simon Leonard
6  Created on: Nov 11 2009
7 
8  (C) Copyright 2008-2015 Johns Hopkins University (JHU), All Rights Reserved.
9 
10 --- begin cisst license - do not edit ---
11 
12 This software is provided "as is" under an open source license, with
13 no warranty. The complete license can be found in license.txt and
14 http://www.cisst.org/cisst/license.txt.
15 
16 --- end cisst license ---
17 */
18 
19 #ifndef _robManipulator_h
20 #define _robManipulator_h
21 
22 #include <string>
23 #include <vector>
24 
26 #include <cisstRobot/robLink.h>
27 
28 #if CISST_HAS_JSON
29 #include <json/json.h>
30 #endif
31 
32 #include <cisstRobot/robExport.h>
33 
35 
36  protected:
37 
39  std::vector<robManipulator*> tools;
40 
41  public:
42 
43  enum Errno{ ESUCCESS, EFAILURE };
44 
46 
51 
53 
56  double** Jn;
57 
59 
62  double** Js;
63 
65  std::vector<robLink> links;
66 
67 
69  robManipulator::Errno LoadRobot( const std::string& linkfile );
70 
71 #if CISST_HAS_JSON
72  robManipulator::Errno LoadRobot(const Json::Value & config);
74 #endif
75 
76  robManipulator::Errno LoadRobot(std::vector<robKinematics *> KinParms);
77 
79 
83  void JacobianBody( const vctDynamicVector<double>& q ) const;
84 
86  // Returns true if successful; false otherwise (e.g., J is wrong size)
87  bool JacobianBody(const vctDynamicVector<double>& q,
88  vctDynamicMatrix<double>& J) const;
89 
90 
92 
97  void JacobianSpatial( const vctDynamicVector<double>& q ) const;
98 
100  // Returns true if successful; false otherwise (e.g., J is wrong size)
101  bool JacobianSpatial(const vctDynamicVector<double>& q,
102  vctDynamicMatrix<double>& J) const;
103 
105 
116  RNE( const vctDynamicVector<double>& q,
117  const vctDynamicVector<double>& qd,
118  const vctDynamicVector<double>& qdd,
119  const vctFixedSizeVector<double,6>& f,//=vctFixedSizeVector<double,6>(0.0),
120  double g = 9.81 ) const;
121 
123 
131  CCG( const vctDynamicVector<double>& q,
132  const vctDynamicVector<double>& qd ) const;
133 
135 
139  /*
140  vctFixedSizeVector<double,6>
141  Acceleration( const vctDynamicVector<double>& q,
142  const vctDynamicVector<double>& qd,
143  const vctDynamicVector<double>& qdd ) const;
144  */
146 
152  BiasAcceleration( const vctDynamicVector<double>& q,
153  const vctDynamicVector<double>& qd ) const;
154 
155 
157 
161  void JSinertia(double** A, const vctDynamicVector<double>& q ) const;
162 
163  vctDynamicMatrix<double> JSinertia( const vctDynamicVector<double>& q ) const;
164 
165 
167 
171  void OSinertia(double Ac[6][6], const vctDynamicVector<double>& q) const;
172 
174  SE3Difference( const vctFrame4x4<double>& Rt1,
175  const vctFrame4x4<double>& Rt2 ) const;
176 
177  void
178  AddIdentificationColumn( vctDynamicMatrix<double>& J,
179  vctFixedSizeMatrix<double,4,4>& delRt ) const;
180 
181 public:
182 
183  enum LinkID{ L0, L1, L2, L3, L4, L5, L6, L7, L8, L9, LN };
184 
186 
188 
194  robManipulator( const std::string& robotfilename,
195  const vctFrame4x4<double>& Rtw0 = vctFrame4x4<double>() );
196 
197  robManipulator( const std::vector<robKinematics *> linkParms,
198  const vctFrame4x4<double>& Rtw0 = vctFrame4x4<double>() );
199 
201  virtual ~robManipulator();
202 
204 
210  virtual
212  ForwardKinematics( const vctDynamicVector<double>& q, int N = -1 ) const;
213 
215 
226  virtual
228  InverseKinematics( vctDynamicVector<double>& q,
229  const vctFrame4x4<double>& Rts,
230  double tolerance=1e-12,
231  size_t Niteration=1000,
232  double LAMBDA=0.001 );
233 
234 
235  virtual
237  InverseKinematics( vctDynamicVector<double>& q,
238  const vctFrm3& Rts,
239  double tolerance=1e-12,
240  size_t Niteration=1000 );
241 
243  virtual void NormalizeAngles( vctDynamicVector<double>& q );
244 
246 
255  virtual
257  InverseDynamics( const vctDynamicVector<double>& q,
258  const vctDynamicVector<double>& qd,
259  const vctDynamicVector<double>& qdd ) const;
260 
262 
275  virtual
277  InverseDynamics( const vctDynamicVector<double>& q,
278  const vctDynamicVector<double>& qd,
279  const vctFixedSizeVector<double,6>& vdwd ) const;
280 
281 
283 
290  virtual
292  JacobianKinematicsIdentification( const vctDynamicVector<double>& q,
293  double epsilon = 1e-6 ) const;
294 
296  void PrintKinematics( std::ostream& os ) const;
297 
299  virtual void Attach( robManipulator* tool );
300 
301 };
302 
303 #endif
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
Definition: robManipulator.h:34
double ** Jn
Body Jacobian.
Definition: robManipulator.h:56
std::vector< robManipulator * > tools
A vector of tools.
Definition: robManipulator.h:39
Errno
Definition: robManipulator.h:43
Typedef for different transformations.
std::vector< robLink > links
A vector of links.
Definition: robManipulator.h:65
LinkID
Definition: robManipulator.h:183
vctFrame4x4< double > Rtw0
Position and orientation of the first link.
Definition: robManipulator.h:50
Definition: robManipulator.h:43
double ** Js
Spatial Jacobian.
Definition: robManipulator.h:62