mbsim 4.0.0 MBSim Kernel

generalized_acceleration_constraint.h
1 /* Copyright (C) 2004-2009 MBSim Development Team
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
6 *
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * Contact: martin.o.foerg@googlemail.com
17 */
18
19 #ifndef _GENERALIZED_ACCELERATION_CONSTRAINT_H
20 #define _GENERALIZED_ACCELERATION_CONSTRAINT_H
21
22 #include "mbsim/constraints/generalized_dual_constraint.h"
23 #include "mbsim/functions/time_dependent_function.h"
24 #include "mbsim/functions/state_dependent_function.h"
25
26 namespace MBSim {
27
28 class GeneralizedAccelerationConstraint : public GeneralizedDualConstraint {
29
30 public:
31 GeneralizedAccelerationConstraint(const std::string &name="") : GeneralizedDualConstraint(name) { }
32 ~GeneralizedAccelerationConstraint() override { delete f; }
33
34 void init(InitStage stage, const InitConfigSet &config) override;
35
36 void calcxSize() override;
37
38 void setInitialState(const fmatvec::Vec &x0_) { x0 <<= x0_; }
39 // NOTE: we can not use a overloaded setConstraintFunction here due to restrictions in XML but define them for convinience in c++
40 void setGeneralConstraintFunction(Function<fmatvec::VecV(fmatvec::VecV,double)>* f_) {
41 f = f_;
42 f->setParent(this);
43 f->setName("Constraint");
44 }
45 void setTimeDependentConstraintFunction(Function<fmatvec::VecV(double)>* f_) {
46 setGeneralConstraintFunction(new TimeDependentFunction<fmatvec::VecV>(f_));
47 }
48 void setStateDependentConstraintFunction(Function<fmatvec::VecV(fmatvec::VecV)>* f_) {
49 setGeneralConstraintFunction( new StateDependentFunction<fmatvec::VecV>(f_));
50 }
51 void setConstraintFunction(Function<fmatvec::VecV(fmatvec::VecV,double)>* f_) { setGeneralConstraintFunction(f_); }
52 void setConstraintFunction(Function<fmatvec::VecV(double)>* f_) { setTimeDependentConstraintFunction(f_); }
53 void setConstraintFunction(Function<fmatvec::VecV(fmatvec::VecV)>* f_) { setStateDependentConstraintFunction(f_); }
54
55 void setUpInverseKinetics() override;
56
57 void updatexd() override;
58 void updateGeneralizedCoordinates() override;
59 void updateGeneralizedJacobians(int j=0) override;
60
61 void initializeUsingXML(xercesc::DOMElement * element) override;
62
63 private:
64 Function<fmatvec::VecV(fmatvec::VecV,double)> *f;
65 };
66
67 }
68
69 #endif
MBSim::GeneralizedAccelerationConstraint
Definition: generalized_acceleration_constraint.h:28
MBSim::TimeDependentFunction
Definition: time_dependent_function.h:28
MBSim::GeneralizedDualConstraint
Class for dual generalized constraints.
Definition: generalized_dual_constraint.h:32
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::Constraint::x0
fmatvec::Vec x0
order one initial value
Definition: constraint.h:90
MBSim::GeneralizedAccelerationConstraint::init
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: generalized_acceleration_constraint.cc:35
MBSim::StateDependentFunction
Definition: state_dependent_function.h:28
MBSim::Element::setName
void setName(const std::string &str)
Definition: element.h:115
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30