mbsim 4.0.0 MBSim Kernel

elastic_joint.h
1 /* Copyright (C) 2004-2016 MBSim Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact: martin.o.foerg@googlemail.com
18 */
19
20 #ifndef _ELASTIC_JOINT_H_
21 #define _ELASTIC_JOINT_H_
22
23 #include "mbsim/links/floating_frame_link.h"
24 #include "mbsim/functions/function.h"
25
26 namespace MBSim {
27
32 class ElasticJoint : public FloatingFrameLink {
33 public:
38 ElasticJoint(const std::string &name = "");
39
43 ~ElasticJoint() override;
44
45 void updateGeneralizedForces() override;
46 void updatexd() override;
47
48 void calcxSize() override { if(integrateGeneralizedRelativeVelocityOfRotation) xSize = momentDir.cols(); }
49 void init(InitStage stage, const InitConfigSet &config) override;
50
51 bool isSingleValued() const override { return true; }
52 bool isActive() const override { return true; }
53 bool gActiveChanged() override { return false; }
54
55 void setGeneralizedForceFunction(Function<fmatvec::VecV(fmatvec::VecV,fmatvec::VecV)> *func_) {
56 func=func_;
57 func->setParent(this);
58 func->setName("GeneralizedForce");
59 }
60
64 void setForceDirection(const fmatvec::Mat3xV& fd) { forceDir <<= fd; }
65
69 void setMomentDirection(const fmatvec::Mat3xV& md) { momentDir <<= md; }
70
71 void setIntegrateGeneralizedRelativeVelocityOfRotation(bool integrateGeneralizedRelativeVelocityOfRotation_) { integrateGeneralizedRelativeVelocityOfRotation = integrateGeneralizedRelativeVelocityOfRotation_; }
72
73 fmatvec::VecV evalGeneralizedRelativePositionOfRotation() override;
74 fmatvec::Vec3 evalGlobalRelativeAngle();
75
76 void initializeUsingXML(xercesc::DOMElement *element) override;
77
78 protected:
79 Function<fmatvec::VecV(fmatvec::VecV,fmatvec::VecV)> *func{nullptr};
80
84 fmatvec::Mat3xV JT;
85
86 bool integrateGeneralizedRelativeVelocityOfRotation{false};
87 };
88
89 }
90
91 #endif
MBSim::ElasticJoint::setMomentDirection
void setMomentDirection(const fmatvec::Mat3xV &md)
Definition: elastic_joint.h:69
MBSim::FloatingFrameLink
floating frame link
Definition: floating_frame_link.h:32
MBSim::ElasticJoint
class for elastic joints
Definition: elastic_joint.h:32
MBSim::ElasticJoint::init
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: elastic_joint.cc:52
MBSim::Link::xSize
int xSize
size and local index of order one parameters
Definition: link.h:479
MBSim::ElasticJoint::gActiveChanged
bool gActiveChanged() override
Definition: elastic_joint.h:53
MBSim::ElasticJoint::JT
fmatvec::Mat3xV JT
translational JACOBIAN (not empty for e.g. prismatic joints)
Definition: elastic_joint.h:84
MBSim::ElasticJoint::ElasticJoint
ElasticJoint(const std::string &name="")
constructor
Definition: elastic_joint.cc:35
MBSim::ElasticJoint::isActive
bool isActive() const override
Definition: elastic_joint.h:52
MBSim::FloatingFrameLink::forceDir
fmatvec::Mat3xV forceDir
directions of force and moment in frame of reference
Definition: floating_frame_link.h:80
MBSim::Element::InitStage
InitStage
The stages of the initialization.
Definition: element.h:62
MBSim::Function
Definition: contact_kinematics.h:32
MBSim::Element::name
std::string name
name of element
Definition: element.h:260
MBSim::ElasticJoint::~ElasticJoint
~ElasticJoint() override
destructor
Definition: elastic_joint.cc:38
MBSim::Element::setName
void setName(const std::string &str)
Definition: element.h:115
MBSim::ElasticJoint::isSingleValued
bool isSingleValued() const override
asks the link if it contains single valued force laws that contribute to the right-hand side vector h
Definition: elastic_joint.h:51
MBSim::ElasticJoint::setForceDirection
void setForceDirection(const fmatvec::Mat3xV &fd)
Definition: elastic_joint.h:64
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30