Simbody  3.7
Constraint_Rod.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_CONSTRAINT_ROD_H_
2 #define SimTK_SIMBODY_CONSTRAINT_ROD_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * Simbody(tm) *
6  * -------------------------------------------------------------------------- *
7  * This is part of the SimTK biosimulation toolkit originating from *
8  * Simbios, the NIH National Center for Physics-Based Simulation of *
9  * Biological Structures at Stanford, funded under the NIH Roadmap for *
10  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
11  * *
12  * Portions copyright (c) 2007-14 Stanford University and the Authors. *
13  * Authors: Michael Sherman *
14  * Contributors: *
15  * *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
17  * not use this file except in compliance with the License. You may obtain a *
18  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
19  * *
20  * Unless required by applicable law or agreed to in writing, software *
21  * distributed under the License is distributed on an "AS IS" BASIS, *
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
23  * See the License for the specific language governing permissions and *
24  * limitations under the License. *
25  * -------------------------------------------------------------------------- */
26 
31 
32 namespace SimTK {
33 
34 //==============================================================================
35 // ROD (CONSTANT DISTANCE) CONSTRAINT
36 //==============================================================================
37 
53 public:
54  // no default constructor
55 
56 //------------------------------------------------------------------------------
93 Rod(MobilizedBody& mobod1, const Vec3& defaultPointOnBody1,
94  MobilizedBody& mobod2, const Vec3& defaultPointOnBody2,
95  Real defaultRodLength);
96 
115 Rod(MobilizedBody& mobod1, MobilizedBody& mobod2,
116  Real defaultRodLength);
117 
120 Rod() {}
121 
125 
129 
134 Rod& setDefaultPointOnBody1(const Vec3& defaultPoint);
139 Rod& setDefaultPointOnBody2(const Vec3& defaultPoint);
144 Rod& setDefaultRodLength(Real defaultRodLength);
145 
162 //------------------------------------------------------------------------------
174  // nothing yet
177 //------------------------------------------------------------------------------
201 const Rod& setPointOnBody1(State& state, const Vec3& p_B1P) const;
208 const Rod& setPointOnBody2(State& state, const Vec3& p_B2Q) const;
213 const Rod& setRodLength(State& state, Real rodLength) const;
219 const Vec3& getPointOnBody1(const State& state) const;
225 const Vec3& getPointOnBody2(const State& state) const;
228 Real getRodLength(const State& state) const;
231 //------------------------------------------------------------------------------
241 
246 
249 
255 Real getMultiplier(const State&) const;
256 
261 Real getRodTension(const State&) const;
262 
269 
276 Real findLengthViolation(const State& state) const;
277 
280 //------------------------------------------------------------------------------
287 MobilizedBodyIndex getBody2MobilizedBodyIndex() const; // hide from Doxygen
293 };
294 
295 } // namespace SimTK
296 
297 #endif // SimTK_SIMBODY_CONSTRAINT_ROD_H_
298 
299 
300 
SimTK::State
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
MobilizedBodyIndex
SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
SimTK::Constraint::Rod
This constraint consists of one constraint equation that enforces a constant distance between a point...
Definition: Constraint_Rod.h:52
SimTK::Constraint::Rod::getMobilizedBody2
const MobilizedBody & getMobilizedBody2() const
Return a reference to the second MobilizedBody given in the constructor.
SimTK::Constraint::Rod::setPointOnBody2
const Rod & setPointOnBody2(State &state, const Vec3 &p_B2Q) const
Modify the location of the point Q on the second body, mobod2, in this state by providing a new vecto...
SimTK::Constraint::Rod::getDefaultPointOnBody2
const Vec3 & getDefaultPointOnBody2() const
Return the default location for the point attached to the second mobilized body, mobod2,...
SimTK::Constraint::Rod::getAccelerationError
Real getAccelerationError(const State &) const
This is the time derivative of the value returned by getVelocityError().
Constraint.h
SimTK
This is a System that represents the dynamics of a particle moving along a smooth surface.
Definition: Assembler.h:37
SimTK::UnitVec< Real, 1 >
SimTK::Constraint::Rod::Rod
Rod(MobilizedBody &mobod1, const Vec3 &defaultPointOnBody1, MobilizedBody &mobod2, const Vec3 &defaultPointOnBody2, Real defaultRodLength)
Construct a Rod (constant distance) constraint as described in the Constraint::Rod class documentatio...
SimTK::Vec< 3 >
SimTK::Constraint::Rod::getRodTension
Real getRodTension(const State &) const
This returns the tension in the Rod being used to enforce the constraint.
SimTK::Constraint::Rod::Rod
Rod()
Default constructor creates an empty handle that can be used to reference any Rod Constraint.
Definition: Constraint_Rod.h:120
SimTK::Constraint::Rod::getVelocityError
Real getVelocityError(const State &) const
This is the time derivative of the value returned by getPositionError(); in this case it is the relat...
SimTK::Constraint::Rod::getDefaultRodLength
Real getDefaultRodLength() const
Return the default rod length (distance) as set during construction or by the most recent call to set...
SimTK::Constraint::Rod::getDefaultPointOnBody1
const Vec3 & getDefaultPointOnBody1() const
Return the default location for the point attached to the first mobilized body, mobod1,...
SimTK::Constraint::Rod::getPointOnBody1
const Vec3 & getPointOnBody1(const State &state) const
Return the position on body 1 of the rod end point P on the first body, mobod1, as currently set in t...
SimTK::Constraint::Rod::getBody1MobilizedBodyIndex
MobilizedBodyIndex getBody1MobilizedBodyIndex() const
(Obscure) Use getMobilizedBody1() instead.
SimTK::Constraint::Rod::setDefaultRodLength
Rod & setDefaultRodLength(Real defaultRodLength)
Replace the default rod length (distance), replacing whatever value was supplied on construction.
SimTK::Constraint::Rod::setDefaultPointOnBody1
Rod & setDefaultPointOnBody1(const Vec3 &defaultPoint)
Replace the default location for the point attached to the first body, mobod1, that was supplied on c...
SimTK::Constraint::Rod::setDefaultPointOnBody2
Rod & setDefaultPointOnBody2(const Vec3 &defaultPoint)
Replace the default location for the point attached to the second body, mobod2, that was supplied on ...
SimTK::Constraint::Rod::findLengthViolation
Real findLengthViolation(const State &state) const
Calculate the amount by which this constraint is violated.
SimTK::Constraint
This is the base class for all Constraint classes, which is just a handle for the underlying hidden i...
Definition: Constraint.h:67
SimTK::Constraint::Rod::getMultiplier
Real getMultiplier(const State &) const
This is the Lagrange multiplier required to enforce the constraint equation generated here.
SimTK::MobilizedBody
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:169
SimTK_SIMBODY_EXPORT
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
SimTK::Constraint::Rod::getRodLength
Real getRodLength(const State &state) const
Return the rod length (distance) as currently set in the given state.
SimTK::Real
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:606
SimTK::Constraint::Rod::getMobilizedBody1
const MobilizedBody & getMobilizedBody1() const
Return a reference to the first MobilizedBody given in the constructor.
SimTK::Constraint::Rod::Rod
Rod(MobilizedBody &mobod1, MobilizedBody &mobod2, Real defaultRodLength)
Construct a Rod (constant distance) constraint as described in the Constraint::Rod class documentatio...
SimTK::Constraint::Rod::findRodOrientationInG
UnitVec3 findRodOrientationInG(const State &state) const
Return the instantaneous orientation of the Rod in the Ground frame.
SimTK::Constraint::Rod::getBody2MobilizedBodyIndex
MobilizedBodyIndex getBody2MobilizedBodyIndex() const
(Obscure) Use getMobilizedBody2() instead.
SimTK::Constraint::Rod::getPointOnBody2
const Vec3 & getPointOnBody2(const State &state) const
Return the position on body 2 of the rod end point Q attached to the second body, mobod2,...
SimTK::Constraint::Rod::setPointOnBody1
const Rod & setPointOnBody1(State &state, const Vec3 &p_B1P) const
Modify the location of the point P on the first body, mobod1, in this state by providing a new vector...
SimTK::Constraint::Rod::getPositionError
Real getPositionError(const State &) const
This is the signed violation of the position constraint, in length units.
SimTK::Constraint::Rod::setRodLength
const Rod & setRodLength(State &state, Real rodLength) const
Modify the rod length (distance) in this state.