Simbody  3.8
Constraint_SphereOnPlaneContact.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_CONSTRAINT_SPHERE_ON_PLANE_CONTACT_H_
2 #define SimTK_SIMBODY_CONSTRAINT_SPHERE_ON_PLANE_CONTACT_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) 2014 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 // SPHERE ON PLANE CONTACT
36 //==============================================================================
87 : public Constraint {
88 public:
89  // no default constructor
90 
91 //------------------------------------------------------------------------------
104 
130  const Transform& defaultPlaneFrame,
131  MobilizedBody& sphereMobod,
132  const Vec3& defaultSphereCenter,
133  Real defaultSphereRadius,
134  bool enforceRolling);
135 
139 
144 
149 
153 bool isEnforcingRolling() const;
154 
155 
160 setDefaultPlaneFrame(const Transform& defaultPlaneFrame);
165 setDefaultSphereCenter(const Vec3& defaultSphereCenter);
170 setDefaultSphereRadius(Real defaultSphereRadius);
171 
172 
184 //------------------------------------------------------------------------------
204 //------------------------------------------------------------------------------
219 
224 const SphereOnPlaneContact&
225 setPlaneFrame(State& state, const Transform& planeFrame) const;
226 
232 const SphereOnPlaneContact&
233 setSphereCenter(State& state, const Vec3& sphereCenter) const;
234 
238 const SphereOnPlaneContact&
239 setSphereRadius(State& state, Real sphereRadius) const;
240 
246 const Transform& getPlaneFrame(const State& state) const;
250 const Vec3& getSphereCenter(const State& state) const;
253 Real getSphereRadius(const State& state) const;
256 //------------------------------------------------------------------------------
266 Real getPositionError(const State& state) const;
267 
277 Vec3 getVelocityErrors(const State& state) const;
278 
284 Vec3 getAccelerationErrors(const State& state) const;
285 
296 Vec3 getMultipliers(const State& state) const;
297 
306 Vec3 findForceOnSphereInG(const State& state) const;
307 
315 Vec3 findContactPointInG(const State& state) const;
316 
324 Real findSeparation(const State& state) const; // hide from Doxygen
329  (SphereOnPlaneContact, SphereOnPlaneContactImpl, Constraint);
331 };
332 
333 } // namespace SimTK
334 
335 #endif // SimTK_SIMBODY_CONSTRAINT_SPHERE_ON_PLANE_CONTACT_H_
336 
337 
338 
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
This constraint represents a bilateral connection between a sphere on one body and a plane on another...
Definition: Constraint_SphereOnPlaneContact.h:87
Vec3 getVelocityErrors(const State &state) const
The returned velocity error vector has the time derivative of the quantity returned by getPositionErr...
const MobilizedBody & getPlaneMobilizedBody() const
Return a reference to the MobilizedBody to which the plane is attached.
SphereOnPlaneContact & setDefaultSphereCenter(const Vec3 &defaultSphereCenter)
Replace the default center point that was supplied on construction.
bool isEnforcingRolling() const
Report whether this Constraint was constructed to generate rolling constraints (otherwise it is frict...
const Vec3 & getSphereCenter(const State &state) const
Return the sphere's center point location p_BO that is current in effect for this Constraint.
const SphereOnPlaneContact & setSphereRadius(State &state, Real sphereRadius) const
Modify the radius of the sphere in this state.
Vec3 getMultipliers(const State &state) const
This are the Lagrange multipliers required to enforce the constraint equations generated here.
Real getDefaultSphereRadius() const
Return the default sphere radius as set during construction or by the most recent call to setDefaultS...
SphereOnPlaneContact & setDefaultSphereRadius(Real defaultSphereRadius)
Replace the default sphere radius that was supplied on construction.
const SphereOnPlaneContact & setSphereCenter(State &state, const Vec3 &sphereCenter) const
Modify the location of the sphere in this state by providing a new vector p_BS giving the sphere cent...
Vec3 findForceOnSphereInG(const State &state) const
Return the force vector currently being applied by this constraint to the contact point on the sphere...
SphereOnPlaneContact(MobilizedBody &planeMobod, const Transform &defaultPlaneFrame, MobilizedBody &sphereMobod, const Vec3 &defaultSphereCenter, Real defaultSphereRadius, bool enforceRolling)
Construct a sphere-on-plane constraint as described in the Constraint::SphereOnPlaneContact class doc...
Vec3 findContactPointInG(const State &state) const
Return the contact point location in the Ground frame.
Real getPositionError(const State &state) const
The returned position error can be viewed as the signed distance from the lowest point of the sphere ...
Real findSeparation(const State &state) const
Calculate the separation distance or penetration depth of the sphere and the plane.
Real getSphereRadius(const State &state) const
Return the sphere radius that is currently in effect for this Constraint.
const Vec3 & getDefaultSphereCenter() const
Return the default center point as set during construction or by the most recent call to setDefaultSp...
const SphereOnPlaneContact & setPlaneFrame(State &state, const Transform &planeFrame) const
Modify the location of the plane in this state by providing a new transform X_FP giving the plane fra...
SphereOnPlaneContact()
Default constructor creates an empty handle that can be used to reference any SphereOnPlaneContact Co...
Definition: Constraint_SphereOnPlaneContact.h:138
const MobilizedBody & getSphereMobilizedBody() const
Return a reference to the MobilizedBody to which the sphere is attached.
SphereOnPlaneContact & setDefaultPlaneFrame(const Transform &defaultPlaneFrame)
Replace the default plane frame that was supplied on construction.
const Transform & getDefaultPlaneFrame() const
Return the default plane frame as set during construction or by the most recent call to setDefaultPla...
Real getPlaneDisplayHalfWidth() const
Return the plane half-width that will be used if we're asked to generate default visualization geomet...
Vec3 getAccelerationErrors(const State &state) const
This vector is the time derivative of the value returned by getVelocityError().
const Transform & getPlaneFrame(const State &state) const
Return the plane frame X_FP that is currently in effect for this Constraint.
SphereOnPlaneContact & setPlaneDisplayHalfWidth(Real halfWidth)
This affects only generated decorative geometry for default visualization; the plane is really infini...
This is the base class for all Constraint classes, which is just a handle for the underlying hidden i...
Definition: Constraint.h:67
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