1 // =============================================================================
2 // PROJECT CHRONO - http://projectchrono.org
3 //
4 // Copyright (c) 2014 projectchrono.org
5 // All rights reserved.
6 //
7 // Use of this source code is governed by a BSD-style license that can be found
8 // in the LICENSE file at the top level of the distribution and at
9 // http://projectchrono.org/license-chrono.txt.
10 //
11 // =============================================================================
12 // Authors: Antonio Recuero
13 // =============================================================================
14 // Class that inherits from ChLinkLock as a free joint. Compliances are added
15 // to the relative motion between two rigid bodies. Out of the 6 possible dofs
16 // available to apply compliance, only those corresponding to the bushing type
17 // selected by the user are introduced.
18 // =============================================================================
19 
20 #ifndef CHLINKBUSHING_H
21 #define CHLINKBUSHING_H
22 
23 #include "chrono/physics/ChLinkLock.h"
24 
25 namespace chrono {
26 
27 /// ChLinkBushing class. This class allows imposing up to 6-degree-of-freedom
28 /// linear compliance between rigid bodies. In case a spherical or revolute joint is
29 /// selected upon construction of the joint, the compliance will only be applied
30 /// to the 3 or 5 degrees of freedom, respectively, which are constrained for
31 /// the case of an ideal constraint.
32 
33 class ChApi ChLinkBushing : public ChLinkLock {
34   public:
35     enum bushing_joint {
36         Mount,      ///< Mount bushing: 6 compliant degrees of freedom
37         Spherical,  ///< Spherical bushing: 3 compliant degrees of freedom
38     };
39 
40     /// Default bushing 'joint' is Mount: six applied compliances.
41     ChLinkBushing(bushing_joint m_bushing_joint = ChLinkBushing::Mount);
42 
43     virtual ~ChLinkBushing();
44 
Clone()45     virtual ChLinkBushing* Clone() const override { return new ChLinkBushing(*this); }
46 
47     void Initialize(std::shared_ptr<ChBody> mbody1,
48                     std::shared_ptr<ChBody> mbody2,
49                     const ChCoordsys<>& mpos,
50                     const ChMatrixNM<double, 6, 6>& K,
51                     const ChMatrixNM<double, 6, 6>& R);
52 
53     bushing_joint m_bushing_joint;  ///< Enum for bushing joint type
54 
55     /// Method to allow serialization of transient data to archives.
56     virtual void ArchiveOUT(ChArchiveOut& marchive) override;
57 
58     /// Method to allow deserialization of transient data from archives.
59     virtual void ArchiveIN(ChArchiveIn& marchive) override;
60 
61   private:
62     using ChLinkMarkers::Initialize;
63 
64     ChMatrixNM<double, 6, 6> m_constants_K;  ///< 6x6 matrices for linear stiffness- TODO, coupling terms
65     ChMatrixNM<double, 6, 6> m_constants_R;  ///< 6x6 matrices for linear damping- TODO, coupling terms
66 
67   public:
68     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
69 };
70 
71 CH_CLASS_VERSION(ChLinkBushing, 0)
72 
73 }  // end namespace chrono
74 
75 #endif
76