Simbody  3.7
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 
SimTK::State
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
SimTK::Constraint::SphereOnPlaneContact::getSphereRadius
Real getSphereRadius(const State &state) const
Return the sphere radius that is currently in effect for this Constraint.
SimTK::Constraint::SphereOnPlaneContact::setSphereRadius
const SphereOnPlaneContact & setSphereRadius(State &state, Real sphereRadius) const
Modify the radius of the sphere in this state.
SimTK::Constraint::SphereOnPlaneContact::setDefaultSphereRadius
SphereOnPlaneContact & setDefaultSphereRadius(Real defaultSphereRadius)
Replace the default sphere radius that was supplied on construction.
SimTK::Constraint::SphereOnPlaneContact::getPlaneFrame
const Transform & getPlaneFrame(const State &state) const
Return the plane frame X_FP that is currently in effect for this Constraint.
SimTK::Constraint::SphereOnPlaneContact::getDefaultPlaneFrame
const Transform & getDefaultPlaneFrame() const
Return the default plane frame as set during construction or by the most recent call to setDefaultPla...
SimTK::Constraint::SphereOnPlaneContact::getPositionError
Real getPositionError(const State &state) const
The returned position error can be viewed as the signed distance from the lowest point of the sphere ...
Constraint.h
SimTK
This is a System that represents the dynamics of a particle moving along a smooth surface.
Definition: Assembler.h:37
SimTK::Constraint::SphereOnPlaneContact::getDefaultSphereRadius
Real getDefaultSphereRadius() const
Return the default sphere radius as set during construction or by the most recent call to setDefaultS...
SimTK::Constraint::SphereOnPlaneContact::setSphereCenter
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...
SimTK::Constraint::SphereOnPlaneContact::getPlaneMobilizedBody
const MobilizedBody & getPlaneMobilizedBody() const
Return a reference to the MobilizedBody to which the plane is attached.
SimTK::Constraint::SphereOnPlaneContact::setDefaultPlaneFrame
SphereOnPlaneContact & setDefaultPlaneFrame(const Transform &defaultPlaneFrame)
Replace the default plane frame that was supplied on construction.
SimTK::Vec< 3 >
SimTK::Constraint::SphereOnPlaneContact
This constraint represents a bilateral connection between a sphere on one body and a plane on another...
Definition: Constraint_SphereOnPlaneContact.h:87
SimTK::Constraint::SphereOnPlaneContact::SphereOnPlaneContact
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...
SimTK::Constraint::SphereOnPlaneContact::getVelocityErrors
Vec3 getVelocityErrors(const State &state) const
The returned velocity error vector has the time derivative of the quantity returned by getPositionErr...
SimTK::Constraint::SphereOnPlaneContact::setDefaultSphereCenter
SphereOnPlaneContact & setDefaultSphereCenter(const Vec3 &defaultSphereCenter)
Replace the default center point that was supplied on construction.
SimTK::Constraint::SphereOnPlaneContact::getSphereMobilizedBody
const MobilizedBody & getSphereMobilizedBody() const
Return a reference to the MobilizedBody to which the sphere is attached.
SimTK::Constraint::SphereOnPlaneContact::getPlaneDisplayHalfWidth
Real getPlaneDisplayHalfWidth() const
Return the plane half-width that will be used if we're asked to generate default visualization geomet...
SimTK::Constraint::SphereOnPlaneContact::getAccelerationErrors
Vec3 getAccelerationErrors(const State &state) const
This vector is the time derivative of the value returned by getVelocityError().
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::SphereOnPlaneContact::SphereOnPlaneContact
SphereOnPlaneContact()
Default constructor creates an empty handle that can be used to reference any SphereOnPlaneContact Co...
Definition: Constraint_SphereOnPlaneContact.h:138
SimTK::MobilizedBody
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:169
SimTK::Constraint::SphereOnPlaneContact::setPlaneFrame
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...
SimTK_SIMBODY_EXPORT
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
SimTK::Constraint::SphereOnPlaneContact::isEnforcingRolling
bool isEnforcingRolling() const
Report whether this Constraint was constructed to generate rolling constraints (otherwise it is frict...
SimTK::Constraint::SphereOnPlaneContact::findSeparation
Real findSeparation(const State &state) const
Calculate the separation distance or penetration depth of the sphere and the plane.
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::SphereOnPlaneContact::findForceOnSphereInG
Vec3 findForceOnSphereInG(const State &state) const
Return the force vector currently being applied by this constraint to the contact point on the sphere...
SimTK::Constraint::SphereOnPlaneContact::findContactPointInG
Vec3 findContactPointInG(const State &state) const
Return the contact point location in the Ground frame.
SimTK::Constraint::SphereOnPlaneContact::getDefaultSphereCenter
const Vec3 & getDefaultSphereCenter() const
Return the default center point as set during construction or by the most recent call to setDefaultSp...
SimTK::Constraint::SphereOnPlaneContact::getMultipliers
Vec3 getMultipliers(const State &state) const
This are the Lagrange multipliers required to enforce the constraint equations generated here.
SimTK::Transform_< Real >
SimTK::Constraint::SphereOnPlaneContact::getSphereCenter
const Vec3 & getSphereCenter(const State &state) const
Return the sphere's center point location p_BO that is current in effect for this Constraint.
SimTK::Constraint::SphereOnPlaneContact::setPlaneDisplayHalfWidth
SphereOnPlaneContact & setPlaneDisplayHalfWidth(Real halfWidth)
This affects only generated decorative geometry for default visualization; the plane is really infini...