Contacts.h
Go to the documentation of this file.
1 /*
2  * Original Copyright (c) 2011-2016 Martin Felis <martin.felis@iwr.uni-heidelberg.de>
3  *
4  *
5  * RDL - Robot Dynamics Library
6  * Modifications Copyright (c) 2017 Jordan Lack <jlack1987@gmail.com>
7  *
8  * Licensed under the zlib license. See LICENSE for more details.
9  */
10 
11 #ifndef RDL_CONTACTS_H
12 #define RDL_CONTACTS_H
13 
21 
22 namespace RobotDynamics
23 {
157 struct Model;
158 
169 {
171  {
172  }
173 
185  unsigned int addConstraint(unsigned int body_id, const Math::Vector3d& body_point, const Math::Vector3d& world_normal, const char* constraint_name = NULL,
186  double normal_acceleration = 0.);
187 
192  {
193  ConstraintSet result(*this);
194 
195  result.bound = false;
196 
197  return result;
198  }
199 
203  {
204  linear_solver = solver;
205  }
206 
218  bool bind(const Model& model);
219 
221  size_t size() const
222  {
223  return acceleration.size();
224  }
225 
227  void clear();
228 
231 
233  bool bound;
234 
235  std::vector<std::string> name;
236  std::vector<unsigned int> body;
237  std::vector<Math::Vector3d> point;
238  std::vector<Math::Vector3d> normal;
239 
243 
246 
249 
253 
254  // Variables used by the Lagrangian methods
255 
258 
261 
265 
268 
271 
274 
276  Eigen::HouseholderQR<Math::MatrixNd> GT_qr;
277 
283 
284  // Variables used by the IABI methods
285 
288 
291 
294 
297 
300 
303 
305  std::vector<Math::Vector3d> point_accel_0;
306 
309 
311  std::vector<Math::SpatialVector> d_a;
313 
315  std::vector<Math::SpatialMatrix> d_IA;
316 
318  std::vector<Math::SpatialVector> d_U;
319 
322 
323  std::vector<Math::Vector3d> d_multdof3_u;
324 };
325 
334 void calcContactJacobian(Model& model, const Math::VectorNd& Q, const ConstraintSet& CS, Math::MatrixNd& G, bool update_kinematics = true);
335 
337 
390 
393 
396 
461 
508 void computeContactImpulsesDirect(Model& model, const Math::VectorNd& Q, const Math::VectorNd& QDotMinus, ConstraintSet& CS, Math::VectorNd& QDotPlus);
509 
512 void computeContactImpulsesRangeSpaceSparse(Model& model, const Math::VectorNd& Q, const Math::VectorNd& QDotMinus, ConstraintSet& CS, Math::VectorNd& QDotPlus);
513 
516 void computeContactImpulsesNullSpace(Model& model, const Math::VectorNd& Q, const Math::VectorNd& QDotMinus, ConstraintSet& CS, Math::VectorNd& QDotPlus);
517 
536 
556 
579 
581 } /* namespace RobotDynamics */
582 
583 /* RDL_CONTACTS_H */
584 #endif // ifndef RDL_CONTACTS_H
Math::VectorNd C
Workspace for the coriolis forces.
Definition: Contacts.h:260
Math::SpatialForceV f_t
Workspace for the test forces.
Definition: Contacts.h:299
Math::SpatialForceV f_ext_constraints
Workspace for the actual spatial forces.
Definition: Contacts.h:302
void computeContactImpulsesDirect(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDotMinus, ConstraintSet &CS, Math::VectorNd &QDotPlus)
Computes contact gain by constructing and solving the full lagrangian equation.
Definition: Contacts.cc:383
std::vector< SpatialForce, Eigen::aligned_allocator< SpatialForce > > SpatialForceV
Math::VectorNd b
Workspace for the Lagrangian right-hand-side.
Definition: Contacts.h:270
Math::VectorNd impulse
Definition: Contacts.h:248
VectorNd Tau
void calcContactJacobian(Model &model, const Math::VectorNd &Q, const ConstraintSet &CS, Math::MatrixNd &G, bool update_kinematics=true)
Computes the Jacobian for the given ConstraintSet.
Definition: Contacts.cc:275
void calcContactSystemVariables(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS)
Definition: Contacts.cc:308
void clear()
Clears all variables in the constraint set.
Definition: Contacts.cc:127
Math::VectorNd a
Workspace for the accelerations of due to the test forces.
Definition: Contacts.h:290
VectorNd QDDot
bool bound
Whether the constraint set was bound to a model (mandatory!).
Definition: Contacts.h:233
ConstraintSet Copy()
Copies the constraints and resets its ConstraintSet::bound flag.
Definition: Contacts.h:191
Math::MatrixNd GT_qr_Q
Definition: Contacts.h:278
VectorNd QDot
std::vector< std::string > name
Definition: Contacts.h:235
void setSolver(Math::LinearSolver solver)
Specifies which method should be used for solving undelying linear systems.
Definition: Contacts.h:202
VectorNd Q
Math::SpatialForceV d_pA
Workspace for the bias force due to the test force.
Definition: Contacts.h:308
unsigned int addConstraint(unsigned int body_id, const Math::Vector3d &body_point, const Math::Vector3d &world_normal, const char *constraint_name=NULL, double normal_acceleration=0.)
Adds a constraint to the constraint set.
Definition: Contacts.cc:27
std::vector< Math::Vector3d > point
Definition: Contacts.h:237
Math::MatrixNd A
Workspace for the Lagrangian left-hand-side matrix.
Definition: Contacts.h:267
std::vector< Math::SpatialVector > d_U
Workspace when applying constraint forces.
Definition: Contacts.h:318
Math::VectorNd acceleration
Definition: Contacts.h:242
void computeContactImpulsesRangeSpaceSparse(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDotMinus, ConstraintSet &CS, Math::VectorNd &QDotPlus)
Resolves contact gain using solveContactSystemRangeSpaceSparse()
Definition: Contacts.cc:407
void forwardDynamicsContactsRangeSpaceSparse(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS, Math::VectorNd &QDDot)
Definition: Contacts.cc:362
Math::VectorNd QDDot_t
Workspace for the test accelerations.
Definition: Contacts.h:293
std::vector< Math::Vector3d > d_multdof3_u
Definition: Contacts.h:323
LinearSolver
Available solver methods for the linear systems.
Definition: rdl_mathutils.h:34
void forwardDynamicsContactsDirect(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS, Math::VectorNd &QDDot)
Computes forward dynamics with contact by constructing and solving the full lagrangian equation...
Definition: Contacts.cc:343
Structure that contains both constraint information and workspace memory.
Definition: Contacts.h:168
Math::VectorNd gamma
Workspace of the lower part of b.
Definition: Contacts.h:263
void solveContactSystemRangeSpaceSparse(Model &model, Math::MatrixNd &H, const Math::MatrixNd &G, const Math::VectorNd &c, const Math::VectorNd &gamma, Math::VectorNd &qddot, Math::VectorNd &lambda, Math::MatrixNd &K, Math::VectorNd &a, Math::LinearSolver linear_solver)
Solves the contact system by first solving for the the joint accelerations and then the contact force...
Definition: Contacts.cc:206
std::vector< unsigned int > body
Definition: Contacts.h:236
std::vector< Math::Vector3d > point_accel_0
Workspace for the default point accelerations.
Definition: Contacts.h:305
std::vector< Math::SpatialMatrix > d_IA
Workspace for the inertia when applying constraint forces.
Definition: Contacts.h:315
Eigen::VectorXd VectorNd
Definition: rdl_eigenmath.h:25
void forwardDynamicsContactsNullSpace(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS, Math::VectorNd &QDDot)
Definition: Contacts.cc:370
Math::VectorNd QDDot_0
Workspace for the default accelerations.
Definition: Contacts.h:296
Contains all information about the rigid body model.
Definition: Model.h:121
bool bind(const Model &model)
Initializes and allocates memory for the constraint set.
Definition: Contacts.cc:62
void computeContactImpulsesNullSpace(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDotMinus, ConstraintSet &CS, Math::VectorNd &QDotPlus)
Resolves contact gain using solveContactSystemNullSpace()
Definition: Contacts.cc:419
Eigen::MatrixXd MatrixNd
Definition: rdl_eigenmath.h:26
Math::VectorNd qddot_y
Definition: Contacts.h:281
Eigen::HouseholderQR< Math::MatrixNd > GT_qr
Workspace for the QR decomposition of the null-space method.
Definition: Contacts.h:276
Math::MatrixNd K
Workspace for the Inverse Articulated-Body Inertia.
Definition: Contacts.h:287
std::vector< Math::SpatialVector > d_a
Workspace for the acceleration due to the test force.
Definition: Contacts.h:311
Math::LinearSolver linear_solver
Method that should be used to solve internal linear systems.
Definition: Contacts.h:230
void solveContactSystemNullSpace(Math::MatrixNd &H, const Math::MatrixNd &G, const Math::VectorNd &c, const Math::VectorNd &gamma, Math::VectorNd &qddot, Math::VectorNd &lambda, Math::MatrixNd &Y, Math::MatrixNd &Z, Math::VectorNd &qddot_y, Math::VectorNd &qddot_z, Math::LinearSolver &linear_solver)
Solves the contact system by first solving for the joint accelerations and then for the constraint fo...
Definition: Contacts.cc:234
void solveContactSystemDirect(Math::MatrixNd &H, const Math::MatrixNd &G, const Math::VectorNd &c, const Math::VectorNd &gamma, Math::VectorNd &qddot, Math::VectorNd &lambda, Math::MatrixNd &A, Math::VectorNd &b, Math::VectorNd &x, Math::LinearSolver &linear_solver)
Solves the full contact system directly, i.e. simultaneously for contact forces and joint acceleratio...
Definition: Contacts.cc:175
Math::VectorNd qddot_z
Definition: Contacts.h:282
Namespace for all structures of the RobotDynamics library.
Definition: Body.h:21
Math::VectorNd x
Workspace for the Lagrangian solution.
Definition: Contacts.h:273
Math::MatrixNd H
Workspace for the joint space inertia matrix.
Definition: Contacts.h:257
std::vector< Math::Vector3d > normal
Definition: Contacts.h:238
void forwardDynamicsContactsKokkevis(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS, Math::VectorNd &QDDot)
Computes forward dynamics that accounts for active contacts in ConstraintSet.
Definition: Contacts.cc:682
size_t size() const
Returns the number of constraints.
Definition: Contacts.h:221
Math::VectorNd d_d
Workspace when applying constraint forces.
Definition: Contacts.h:321


rdl_dynamics
Author(s):
autogenerated on Tue Apr 20 2021 02:25:27