Simbody  3.7
Constraint_SphereOnSphereContact.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_CONSTRAINT_SPHERE_ON_SPHERE_CONTACT_H_
2 #define SimTK_SIMBODY_CONSTRAINT_SPHERE_ON_SPHERE_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 SPHERE CONTACT
36 //==============================================================================
103 : public Constraint {
104 public:
105  // no default constructor
106 
107 //------------------------------------------------------------------------------
123 
157  const Vec3& defaultCenterOnF,
158  Real defaultRadiusOnF,
159  MobilizedBody& mobod_B,
160  const Vec3& defaultCenterOnB,
161  Real defaultRadiusOnB,
162  bool enforceRolling);
163 
167 
172 
177 
181 bool isEnforcingRolling() const;
182 
188 setDefaultCenterOnF(const Vec3& defaultCenter);
194 setDefaultRadiusOnF(Real defaultRadius);
200 setDefaultCenterOnB(const Vec3& defaultCenter);
206 setDefaultRadiusOnB(Real defaultRadius);
207 
212 const Vec3& getDefaultCenterOnF() const;
222 const Vec3& getDefaultCenterOnB() const;
230 //------------------------------------------------------------------------------
238  // nothing yet
242 //------------------------------------------------------------------------------
260 
266 const SphereOnSphereContact&
267 setCenterOnF(State& state, const Vec3& sphereCenter) const;
268 
272 const SphereOnSphereContact&
273 setRadiusOnF(State& state, Real sphereRadius) const;
274 
280 const SphereOnSphereContact&
281 setCenterOnB(State& state, const Vec3& sphereCenter) const;
282 
286 const SphereOnSphereContact&
287 setRadiusOnB(State& state, Real sphereRadius) const;
288 
293 const Vec3& getCenterOnF(const State& state) const;
296 Real getRadiusOnF(const State& state) const;
297 
302 const Vec3& getCenterOnB(const State& state) const;
305 Real getRadiusOnB(const State& state) const;
308 //------------------------------------------------------------------------------
318 Real getPositionError(const State& state) const;
319 
329 Vec3 getVelocityErrors(const State& state) const;
330 
336 Vec3 getAccelerationErrors(const State& state) const;
337 
348 Vec3 getMultipliers(const State& state) const;
349 
359 Vec3 findForceOnSphereBInG(const State& state) const;
360 
373 Transform findContactFrameInG(const State& state) const;
374 
381 Real findSeparation(const State& state) const; // hide from Doxygen
386  (SphereOnSphereContact, SphereOnSphereContactImpl, Constraint);
388 };
389 
390 } // namespace SimTK
391 
392 #endif // SimTK_SIMBODY_CONSTRAINT_SPHERE_ON_SPHERE_CONTACT_H_
393 
394 
395 
SimTK::Constraint::SphereOnSphereContact::getPositionError
Real getPositionError(const State &state) const
The returned position error can be viewed as the signed distance between the spheres.
SimTK::State
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
SimTK::Constraint::SphereOnSphereContact::findSeparation
Real findSeparation(const State &state) const
Calculate the separation distance or penetration depth of the two spheres.
SimTK::Constraint::SphereOnSphereContact::getDefaultRadiusOnF
Real getDefaultRadiusOnF() const
Return the default radius for the sphere attached to the first body, mobod_F, as set during construct...
SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
SimTK::Constraint::SphereOnSphereContact::getMobilizedBodyB
const MobilizedBody & getMobilizedBodyB() const
Return a reference to the second MobilizedBody to which a sphere is attached.
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::SphereOnSphereContact::getDefaultCenterOnF
const Vec3 & getDefaultCenterOnF() const
Return the default center point for the sphere attached to the first body, mobod_F,...
SimTK::Constraint::SphereOnSphereContact::setRadiusOnF
const SphereOnSphereContact & setRadiusOnF(State &state, Real sphereRadius) const
Modify the radius of the sphere on the first body, mobod_F, in this state.
SimTK::Constraint::SphereOnSphereContact::getRadiusOnB
Real getRadiusOnB(const State &state) const
Return the radius of the sphere attached to the first body, mobod_F, as currently set in the given st...
SimTK::Constraint::SphereOnSphereContact::getDefaultRadiusOnB
Real getDefaultRadiusOnB() const
Return the default radius for the sphere attached to the second body, mobod_B, as set during construc...
SimTK::Constraint::SphereOnSphereContact::getVelocityErrors
Vec3 getVelocityErrors(const State &state) const
The returned velocity error vector has the time derivative of the quantity returned by getPositionErr...
SimTK::Vec< 3 >
SimTK::Constraint::SphereOnSphereContact::setCenterOnF
const SphereOnSphereContact & setCenterOnF(State &state, const Vec3 &sphereCenter) const
Modify the location of the sphere on the first body, mobod_F, in this state by providing a new vector...
SimTK::Constraint::SphereOnSphereContact::getAccelerationErrors
Vec3 getAccelerationErrors(const State &state) const
This vector is the time derivative of the value returned by getVelocityError().
SimTK::Constraint::SphereOnSphereContact::getCenterOnB
const Vec3 & getCenterOnB(const State &state) const
Return the position of the center point of the sphere attached to the second body,...
SimTK::Constraint::SphereOnSphereContact::setDefaultRadiusOnB
SphereOnSphereContact & setDefaultRadiusOnB(Real defaultRadius)
Replace the default radius for the sphere attached to the second body, mobod_B, that was supplied on ...
SimTK::Constraint::SphereOnSphereContact::setDefaultRadiusOnF
SphereOnSphereContact & setDefaultRadiusOnF(Real defaultRadius)
Replace the default radius for the sphere attached to the first body, mobod_F, that was supplied on c...
SimTK::Constraint::SphereOnSphereContact::findForceOnSphereBInG
Vec3 findForceOnSphereBInG(const State &state) const
Return the force vector currently being applied by this constraint to the contact point Co on the sph...
SimTK::Constraint::SphereOnSphereContact::getDefaultCenterOnB
const Vec3 & getDefaultCenterOnB() const
Return the default center point for the sphere attached to the second body, mobod_B,...
SimTK::Constraint::SphereOnSphereContact::setCenterOnB
const SphereOnSphereContact & setCenterOnB(State &state, const Vec3 &sphereCenter) const
Modify the location of the sphere on the second body, mobod_B, in this state by providing a new vecto...
SimTK::Constraint::SphereOnSphereContact::setDefaultCenterOnF
SphereOnSphereContact & setDefaultCenterOnF(const Vec3 &defaultCenter)
Replace the default center point for the sphere attached to the first body, mobod_F,...
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::MobilizedBody
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:169
SimTK::Constraint::SphereOnSphereContact::isEnforcingRolling
bool isEnforcingRolling() const
Report whether this Constraint was constructed to generate rolling constraints (otherwise it is frict...
SimTK::Constraint::SphereOnSphereContact::getMultipliers
Vec3 getMultipliers(const State &state) const
These are the Lagrange multipliers required to enforce the constraint equations generated here.
SimTK_SIMBODY_EXPORT
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
SimTK::Constraint::SphereOnSphereContact::getCenterOnF
const Vec3 & getCenterOnF(const State &state) const
Return the position of the center point of the sphere attached to the first body, mobod_F,...
SimTK::Constraint::SphereOnSphereContact::getMobilizedBodyF
const MobilizedBody & getMobilizedBodyF() const
Return a reference to the first MobilizedBody to which a sphere is attached.
SimTK::Constraint::SphereOnSphereContact::findContactFrameInG
Transform findContactFrameInG(const State &state) const
Return the instantaneous contact frame C in the Ground frame.
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::SphereOnSphereContact::setRadiusOnB
const SphereOnSphereContact & setRadiusOnB(State &state, Real sphereRadius) const
Modify the radius of the sphere on the second body, mobod_B, in this state.
SimTK::Constraint::SphereOnSphereContact
This constraint represents a bilateral connection between a sphere on one body and a sphere on anothe...
Definition: Constraint_SphereOnSphereContact.h:103
SimTK::Constraint::SphereOnSphereContact::SphereOnSphereContact
SphereOnSphereContact()
Default constructor creates an empty handle that can be used to reference any SphereOnSphereContact C...
Definition: Constraint_SphereOnSphereContact.h:166
SimTK::Transform_< Real >
SimTK::Constraint::SphereOnSphereContact::getRadiusOnF
Real getRadiusOnF(const State &state) const
Return the radius of the sphere attached to the first body, mobod_F, as currently set in the given st...
SimTK::Constraint::SphereOnSphereContact::SphereOnSphereContact
SphereOnSphereContact(MobilizedBody &mobod_F, const Vec3 &defaultCenterOnF, Real defaultRadiusOnF, MobilizedBody &mobod_B, const Vec3 &defaultCenterOnB, Real defaultRadiusOnB, bool enforceRolling)
Construct a sphere-on-sphere constraint as described in the Constraint::SphereOnSphereContact class d...
SimTK::Constraint::SphereOnSphereContact::setDefaultCenterOnB
SphereOnSphereContact & setDefaultCenterOnB(const Vec3 &defaultCenter)
Replace the default center point for the sphere attached to the second body, mobod_B,...