Simbody  3.8
Constraint_Ball.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_CONSTRAINT_BALL_H_
2 #define SimTK_SIMBODY_CONSTRAINT_BALL_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 // CONSTRAINT:: BALL (COINCIDENT POINTS)
36 //==============================================================================
37 
58 public:
66 Ball(MobilizedBody& body1, const Vec3& defaultPoint1,
67  MobilizedBody& body2, const Vec3& defaultPoint2);
68 
70 Ball() {}
71 
76 void setPointOnBody1(State& state, const Vec3& point_B1) const;
81 void setPointOnBody2(State& state, const Vec3& point_B2) const;
82 
85 const Vec3& getPointOnBody1(const State& state) const;
88 const Vec3& getPointOnBody2(const State& state) const;
89 
94 Ball& setDefaultPointOnBody1(const Vec3& defaultPoint_B1);
99 Ball& setDefaultPointOnBody2(const Vec3& defaultPoint_B2);
100 
111 
112 
119 
124 
125 
131 Vec3 getPositionErrors(const State& state) const;
132 
139 Vec3 getVelocityErrors(const State& state) const;
140 
150 
159 
167 Vec3 getMultipliers(const State& state) const;
168  // hide from Doxygen
172 };
173 
174 
175 } // namespace SimTK
176 
177 #endif // SimTK_SIMBODY_CONSTRAINT_BALL_H_
178 
179 
180 
This defines the base Constraint class and related classes, which are used to specify limitations on ...
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
Enforce that a fixed station on one body remains coincident with a fixed station on a second body,...
Definition: Constraint_Ball.h:57
Vec3 getBallReactionForceOnBody1(const State &) const
Return the force currently being applied by this Constraint to the point of body 1 that is coincident...
Vec3 getPositionErrors(const State &state) const
Return the current position-level constraint error for this Constraint.
void setPointOnBody1(State &state, const Vec3 &point_B1) const
Change the station point on body 1 at which this Constraint acts.
Vec3 getVelocityErrors(const State &state) const
Return the current velocity-level constraint error for this Constraint.
Ball()
Default constructor creates an empty handle.
Definition: Constraint_Ball.h:70
Ball(MobilizedBody &body1, MobilizedBody &body2)
Connect the origin of body1 to the origin of body2.
Vec3 getBallReactionForceOnBody2(const State &) const
Return the force currently being applied by this Constraint to body 2, at its constrained station poi...
Ball(MobilizedBody &body1, const Vec3 &defaultPoint1, MobilizedBody &body2, const Vec3 &defaultPoint2)
Connect body1 and body2 at given station points, given in the body frame of the corresponding body.
Ball & setDefaultPointOnBody2(const Vec3 &defaultPoint_B2)
Change the default station location on body 2.
MobilizedBodyIndex getBody2MobilizedBodyIndex() const
Return the MobilizedBodyIndex corresponding to body 2.
const Vec3 & getPointOnBody1(const State &state) const
Return from the given state the constrained station on body 1, in the body 1 frame.
const Vec3 & getDefaultPointOnBody2() const
Return the default location for the station point on body 2, as a vector in the body 2 frame.
void setPointOnBody2(State &state, const Vec3 &point_B2) const
Change the station point on body 2 at which this Constraint acts.
const Vec3 & getDefaultPointOnBody1() const
Return the default location for the station point on body 1, as a vector in the body 1 frame.
Vec3 getAccelerationErrors(const State &) const
Return the current acceleration-level constraint error for this Constraint.
Vec3 getMultipliers(const State &state) const
Return the three Lagrange multipliers associated with the three accleration-level constraint equation...
MobilizedBodyIndex getBody1MobilizedBodyIndex() const
Return the MobilizedBodyIndex corresponding to body 1.
const Vec3 & getPointOnBody2(const State &state) const
Return from the given state the constrained station on body 2, in the body 2 frame.
Ball & setDefaultPointOnBody1(const Vec3 &defaultPoint_B1)
Change the default station location on body 1.
Real getDefaultRadius() const
Retrieve the radius being used for visualization of this Constraint.
Ball & setDefaultRadius(Real r)
For visualization only, you can override the default radius used by this Constraint to draw itself.
This is the base class for all Constraint classes, which is just a handle for the underlying hidden i...
Definition: Constraint.h:67
This is for arrays indexed by mobilized body number within a subsystem (typically the SimbodyMatterSu...
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:169
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
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:607