Simbody  3.7
CompliantContactSubsystem.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_COMPLIANT_CONTACT_SUBSYSTEM_H_
2 #define SimTK_SIMBODY_COMPLIANT_CONTACT_SUBSYSTEM_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) 2008-13 Stanford University and the Authors. *
13  * Authors: Peter Eastman, 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 
27 #include "SimTKmath.h"
30 
31 #include <cassert>
32 
33 namespace SimTK {
34 
35 class MultibodySystem;
36 class SimbodyMatterSubsystem;
37 class ContactTrackerSubsystem;
38 class ContactForceGenerator;
39 class Contact;
40 class ContactForce;
41 class ContactPatch;
42 
43 
44 
45 //==============================================================================
46 // COMPLIANT CONTACT SUBSYSTEM
47 //==============================================================================
54 public:
57 
65 
67 Real getTransitionVelocity() const;
69 void setTransitionVelocity(Real vt);
71 Real getOOTransitionVelocity() const;
72 
81 void setTrackDissipatedEnergy(bool shouldTrack);
86 bool getTrackDissipatedEnergy() const;
87 
92 int getNumContactForces(const State& state) const;
99 const ContactForce& getContactForce(const State& state, int n) const;
107 const ContactForce& getContactForceById(const State& state, ContactId id) const;
108 
136 bool calcContactPatchDetailsById(const State& state,
137  ContactId id,
138  ContactPatch& patch) const;
139 
170 Real getDissipatedEnergy(const State& state) const;
171 
192 void setDissipatedEnergy(State& state, Real energy) const;
193 
194 
199 void adoptForceGenerator(ContactForceGenerator* generator);
200 
205 void adoptDefaultForceGenerator(ContactForceGenerator* generator);
206 
209 bool hasForceGenerator(ContactTypeId contact) const;
210 
214 bool hasDefaultForceGenerator() const;
215 
219 const ContactForceGenerator&
220  getContactForceGenerator(ContactTypeId contact) const;
221 
224 const ContactForceGenerator& getDefaultForceGenerator() const;
225 
230 const ContactTrackerSubsystem& getContactTrackerSubsystem() const;
231 
236 const MultibodySystem& getMultibodySystem() const;
237  // don't show in Doxygen docs
242 //--------------------------------------------------------------------------
243  private:
244 class CompliantContactSubsystemImpl& updImpl();
245 const CompliantContactSubsystemImpl& getImpl() const;
246 };
247 
248 
249 
250 //==============================================================================
251 // CONTACT FORCE
252 //==============================================================================
302 public:
304 ContactForce() {} // invalid
305 
310 ContactForce(ContactId id, const Vec3& contactPt,
311  const SpatialVec& forceOnSurface2,
312  Real potentialEnergy, Real powerLoss)
313 : m_contactId(id), m_contactPt(contactPt),
314  m_forceOnSurface2(forceOnSurface2),
315  m_potentialEnergy(potentialEnergy), m_powerLoss(powerLoss) {}
316 
318 ContactId getContactId() const {return m_contactId;}
322 const Vec3& getContactPoint() const {return m_contactPt;}
326 const SpatialVec& getForceOnSurface2() const {return m_forceOnSurface2;}
329 Real getPotentialEnergy() const {return m_potentialEnergy;}
333 Real getPowerDissipation() const {return m_powerLoss;}
334 
340 void setTo(ContactId id, const Vec3& contactPt,
341  const SpatialVec& forceOnSurface2,
342  Real potentialEnergy, Real powerLoss)
343 { m_contactId = id;
344  m_contactPt = contactPt;
345  m_forceOnSurface2 = forceOnSurface2;
346  m_potentialEnergy = potentialEnergy;
347  m_powerLoss = powerLoss; }
348 
350 void setContactId(ContactId id) {m_contactId=id;}
352 void setContactPoint(const Vec3& contactPt) {m_contactPt=contactPt;}
355 void setForceOnSurface2(const SpatialVec& forceOnSurface2)
356 { m_forceOnSurface2=forceOnSurface2; }
358 void setPotentialEnergy(Real potentialEnergy)
359 { m_potentialEnergy=potentialEnergy; }
361 void setPowerDissipation(Real powerLoss) {m_powerLoss=powerLoss;}
362 
365 void clear() {m_contactId.invalidate();}
367 bool isValid() const {return m_contactId.isValid();}
368 
373 void changeFrameInPlace(const Transform& X_BA) {
374  m_contactPt = X_BA*m_contactPt; // shift & reexpress in B
375  m_forceOnSurface2 = X_BA.R()*m_forceOnSurface2; // reexpress in B
376 }
377 
378 private:
379 ContactId m_contactId; // Which Contact produced this force?
380 Vec3 m_contactPt; // In some frame A
381 SpatialVec m_forceOnSurface2; // at contact pt, in A; neg. for Surf1
382 Real m_potentialEnergy; // > 0 when due to compression
383 Real m_powerLoss; // > 0 means dissipation
384 };
385 
386 // For debugging.
387 inline std::ostream& operator<<(std::ostream& o, const ContactForce& f) {
388  o << "ContactForce for ContactId " << f.getContactId() << " (ground frame):\n";
389  o << " contact point=" << f.getContactPoint() << "\n";
390  o << " force on surf2 =" << f.getForceOnSurface2() << "\n";
391  o << " pot. energy=" << f.getPotentialEnergy()
392  << " powerLoss=" << f.getPowerDissipation();
393  return o << "\n";
394 }
395 
396 //==============================================================================
397 // CONTACT DETAIL
398 //==============================================================================
465 public:
468 const Vec3& getContactPoint() const {return m_contactPt;}
472 const UnitVec3& getContactNormal() const {return m_patchNormal;}
476 const Vec3& getSlipVelocity() const {return m_slipVelocity;}
479 const Vec3& getForceOnSurface2() const {return m_forceOnSurface2;}
493 Real getPatchArea() const {return m_patchArea;}
505 
506 
510 void changeFrameInPlace(const Transform& X_BA) {
511  const Rotation& R_BA = X_BA.R();
512  m_contactPt = X_BA*m_contactPt; // shift & reexpress in B (18 flops)
513  m_patchNormal = R_BA*m_patchNormal; // reexpress only (3*15 flops)
514  m_slipVelocity = R_BA*m_slipVelocity; // "
516 }
517 
522  const Rotation& R_BA = X_BA.R();
523  m_contactPt = X_BA*m_contactPt; // shift & reexpress in B (18 flops)
524  m_patchNormal = R_BA*(-m_patchNormal); // reverse & reexpress (3*18 flops)
525  m_slipVelocity = R_BA*(-m_slipVelocity); // "
526  m_forceOnSurface2 = R_BA*(-m_forceOnSurface2); // "
527 }
528 
529 Vec3 m_contactPt; // location of contact point C in A
530 UnitVec3 m_patchNormal; // points outwards from body 1, exp. in A
531 Vec3 m_slipVelocity; // material slip rate, perp. to normal, in A
532 Vec3 m_forceOnSurface2; // applied at C, -force to surf1
533 Real m_deformation; // total normal compression (approach)
534 Real m_deformationRate; // d/dt deformation, w.r.t. A frame
536 Real m_peakPressure; // > 0 in compression
537 Real m_potentialEnergy; // > 0 when due to compression
538 Real m_powerLoss; // > 0 means dissipation
539 };
540 
541 // For debugging.
542 inline std::ostream& operator<<(std::ostream& o, const ContactDetail& d) {
543  o << "ContactDetail (ground frame):\n";
544  o << " contact point=" << d.m_contactPt << "\n";
545  o << " contact normal=" << d.m_patchNormal << "\n";
546  o << " slip velocity=" << d.m_slipVelocity << "\n";
547  o << " force on surf2 =" << d.m_forceOnSurface2 << "\n";
548  o << " deformation=" << d.m_deformation
549  << " deformation rate=" << d.m_deformationRate << "\n";
550  o << " patch area=" << d.m_patchArea
551  << " peak pressure=" << d.m_peakPressure << "\n";
552  o << " pot. energy=" << d.m_potentialEnergy << " powerLoss=" << d.m_powerLoss;
553  return o << "\n";
554 }
555 
556 
557 
558 //==============================================================================
559 // CONTACT PATCH
560 //==============================================================================
582 public:
583 void clear() {m_resultant.clear(); m_elements.clear();}
584 bool isValid() const {return m_resultant.isValid();}
585 const ContactForce& getContactForce() const {return m_resultant;}
586 int getNumDetails() const {return (int)m_elements.size();}
587 const ContactDetail& getContactDetail(int n) const {return m_elements[n];}
588 
592 void changeFrameInPlace(const Transform& X_BA) {
593  m_resultant.changeFrameInPlace(X_BA);
594  for (unsigned i=0; i<m_elements.size(); ++i)
595  m_elements[i].changeFrameInPlace(X_BA);
596 }
597 
600 };
601 
602 
603 
604 //==============================================================================
605 // CONTACT FORCE GENERATOR
606 //==============================================================================
616 public:
617 // Reasonably good physically-based compliant contact models.
618 class ElasticFoundation; // for TriangleMeshContact
619 class HertzCircular; // for CircularPointContact
620 class HertzElliptical; // for EllipticalPointContact
621 
622 // Penalty-based models enforcing non-penetration but without attempting
623 // to model the contacting materials physically.
624 class BrickHalfSpacePenalty; // for BrickHalfSpaceContact
625 
626 // These are for response to unknown ContactTypeIds.
627 class DoNothing; // do nothing if called
628 class ThrowError; // throw an error if called
629 
631 explicit ContactForceGenerator(ContactTypeId type): m_contactType(type) {}
632 
636 ContactTypeId getContactTypeId() const {return m_contactType;}
637 
639 { assert(m_compliantContactSubsys); return *m_compliantContactSubsys; }
641 { m_compliantContactSubsys = sub; }
642 
645 
656 virtual void calcContactForce
657  (const State& state,
658  const Contact& overlapping,
659  const SpatialVec& V_S1S2, // relative surface velocity (S2 in S1)
660  ContactForce& contactForce) const = 0;
661 
668 virtual void calcContactPatch
669  (const State& state,
670  const Contact& overlapping,
671  const SpatialVec& V_S1S2, // relative surface velocity (S2 in S1)
672  ContactPatch& patch) const = 0;
673 
674 
675 //--------------------------------------------------------------------------
676 private:
677  // This generator should be called only for Contact objects of the
678  // indicated type id.
679  ContactTypeId m_contactType;
680  // This is a reference to the owning CompliantContactSubsystem if any;
681  // don't delete on destruction.
682  const CompliantContactSubsystem* m_compliantContactSubsys;
683 };
684 
685 
686 
687 
688 //==============================================================================
689 // HERTZ CIRCULAR GENERATOR
690 //==============================================================================
691 
698 : public ContactForceGenerator {
699 public:
701 : ContactForceGenerator(CircularPointContact::classTypeId()) {}
702 
703 void calcContactForce
704  (const State& state,
705  const Contact& overlapping,
706  const SpatialVec& V_S1S2,
707  ContactForce& contactForce) const override;
708 
709 void calcContactPatch
710  (const State& state,
711  const Contact& overlapping,
712  const SpatialVec& V_S1S2,
713  ContactPatch& patch) const override;
714 };
715 
716 
717 
718 //==============================================================================
719 // HERTZ ELLIPTICAL GENERATOR
720 //==============================================================================
721 
728 : public ContactForceGenerator {
729 public:
732 
733 void calcContactForce
734  (const State& state,
735  const Contact& overlapping,
736  const SpatialVec& V_S1S2,
737  ContactForce& contactForce) const override;
738 
739 void calcContactPatch
740  (const State& state,
741  const Contact& overlapping,
742  const SpatialVec& V_S1S2,
743  ContactPatch& patch) const override;
744 };
745 
746 
747 
748 
749 //==============================================================================
750 // BRICK HALFSPACE GENERATOR
751 //==============================================================================
752 
756 : public ContactForceGenerator {
757 public:
759 : ContactForceGenerator(BrickHalfSpaceContact::classTypeId()) {}
760 
761 void calcContactForce
762  (const State& state,
763  const Contact& overlapping,
764  const SpatialVec& V_S1S2,
765  ContactForce& contactForce) const override;
766 
767 void calcContactPatch
768  (const State& state,
769  const Contact& overlapping,
770  const SpatialVec& V_S1S2,
771  ContactPatch& patch) const override;
772 };
773 
774 
775 
776 //==============================================================================
777 // ELASTIC FOUNDATION GENERATOR
778 //==============================================================================
783 : public ContactForceGenerator {
784 public:
786 : ContactForceGenerator(TriangleMeshContact::classTypeId()) {}
787 
788 void calcContactForce
789  (const State& state,
790  const Contact& overlapping,
791  const SpatialVec& V_S1S2,
792  ContactForce& contactForce) const override;
793 
794 void calcContactPatch
795  (const State& state,
796  const Contact& overlapping,
797  const SpatialVec& V_S1S2,
798  ContactPatch& patch) const override;
799 
800 private:
801 void calcContactForceAndDetails
802  (const State& state,
803  const Contact& overlapping,
804  const SpatialVec& V_S1S2,
805  ContactForce& contactForce,
806  Array_<ContactDetail>* contactDetails) const;
807 
808 void calcWeightedPatchCentroid
809  (const ContactGeometry::TriangleMesh& mesh,
810  const std::set<int>& insideFaces,
811  Vec3& weightedPatchCentroid,
812  Real& patchArea) const;
813 
814 void processOneMesh
815  (const State& state,
816  const ContactGeometry::TriangleMesh& mesh,
817  const std::set<int>& insideFaces,
818  const Transform& X_MO,
819  const SpatialVec& V_MO,
820  const ContactGeometry& other,
821  Real meshDeformationFraction, // 0..1
822  Real areaScaleFactor, // >= 0
823  Real k, Real c, Real us, Real ud, Real uv,
824  const Vec3& resultantPt_M, // where to apply forces
825  SpatialVec& resultantForceOnOther_M, // at resultant pt
826  Real& potentialEnergy,
827  Real& powerLoss,
828  Vec3& weightedCenterOfPressure_M, // COP
829  Real& sumOfAllPressureMoments, // COP weight
830  Array_<ContactDetail>* contactDetails) const;
831 };
832 
833 
834 
835 
836 //==============================================================================
837 // DO NOTHING FORCE GENERATOR
838 //==============================================================================
843 : public ContactForceGenerator {
844 public:
846 : ContactForceGenerator(type) {}
847 
848 void calcContactForce
849  (const State& state,
850  const Contact& overlapping,
851  const SpatialVec& V_S1S2,
852  ContactForce& contactForce) const override
853 { SimTK_ASSERT_ALWAYS(!"implemented",
854  "ContactForceGenerator::DoNothing::calcContactForce() not implemented yet."); }
855 void calcContactPatch
856  (const State& state,
857  const Contact& overlapping,
858  const SpatialVec& V_S1S2,
859  ContactPatch& patch) const override
860 { SimTK_ASSERT_ALWAYS(!"implemented",
861  "ContactForceGenerator::DoNothing::calcContactPatch() not implemented yet."); }
862 };
863 
864 
865 
866 //==============================================================================
867 // THROW ERROR FORCE GENERATOR
868 //==============================================================================
874 : public ContactForceGenerator {
875 public:
877 : ContactForceGenerator(type) {}
878 
879 void calcContactForce
880  (const State& state,
881  const Contact& overlapping,
882  const SpatialVec& V_S1S2,
883  ContactForce& contactForce) const override
884 { SimTK_ASSERT_ALWAYS(!"implemented",
885  "ContactForceGenerator::ThrowError::calcContactForce() not implemented yet."); }
886 void calcContactPatch
887  (const State& state,
888  const Contact& overlapping,
889  const SpatialVec& V_S1S2,
890  ContactPatch& patch) const override
891 { SimTK_ASSERT_ALWAYS(!"implemented",
892  "ContactForceGenerator::ThrowError::calcContactPatch() not implemented yet."); }
893 };
894 
895 } // namespace SimTK
896 
897 #endif // SimTK_SIMBODY_COMPLIANT_CONTACT_SUBSYSTEM_H_
This is a simple class containing the basic force information for a single contact between deformable...
Definition: CompliantContactSubsystem.h:301
#define SimTK_PIMPL_DOWNCAST(Derived, Parent)
Similar to the above but for private implementation abstract classes, that is, abstract class hierarc...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:593
Real getPeakPressure() const
This is the peak pressure on this element; typically it is just the normal force divided by the patch...
Definition: CompliantContactSubsystem.h:497
bool isValid() const
Return true if this contact force contains a valid ContactId.
Definition: CompliantContactSubsystem.h:367
void setCompliantContactSubsystem(const CompliantContactSubsystem *sub)
Definition: CompliantContactSubsystem.h:640
void setContactPoint(const Vec3 &contactPt)
Change the contact point contained in this ContactForce object.
Definition: CompliantContactSubsystem.h:352
void setPotentialEnergy(Real potentialEnergy)
Change the value stored for potential energy in this ContactForce object.
Definition: CompliantContactSubsystem.h:358
Array_< ContactDetail > m_elements
Definition: CompliantContactSubsystem.h:599
Real getDeformationRate() const
Get the instantaneous rate at which the material at the contact point is deforming; this is the mater...
Definition: CompliantContactSubsystem.h:491
virtual ~ContactForceGenerator()
Base class destructor is virtual but does nothing.
Definition: CompliantContactSubsystem.h:644
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
void changeFrameInPlace(const Transform &X_BA)
This object is currently in an assumed frame A; given a transform from another frame B to A we&#39;ll re-...
Definition: CompliantContactSubsystem.h:592
#define SimTK_ASSERT_ALWAYS(cond, msg)
Definition: ExceptionMacros.h:349
This ContactForceGenerator handles contact between a TriangleMesh and a variety of other geometric ob...
Definition: CompliantContactSubsystem.h:782
ContactForce()
Default constructor has invalid contact id, other fields garbage.
Definition: CompliantContactSubsystem.h:304
This is a small integer that serves as the unique typeid for each type of concrete Contact class...
Real m_patchArea
Definition: CompliantContactSubsystem.h:535
Real getPowerDissipation() const
Get the energy dissipation rate (power loss) due to the deformation rate and friction losses for this...
Definition: CompliantContactSubsystem.h:333
const Vec3 & getForceOnSurface2() const
Get the total force applied to body 2 at the contact point by this contact element; negate this to fi...
Definition: CompliantContactSubsystem.h:479
bool isValid() const
Definition: CompliantContactSubsystem.h:584
Real m_potentialEnergy
Definition: CompliantContactSubsystem.h:537
Real getPotentialEnergy() const
Get the amount of potential energy currently stored in the deformation of this contact patch...
Definition: CompliantContactSubsystem.h:329
This subclass of Contact is used when one ContactGeometry object is a half plane and the other is a B...
Definition: Contact.h:418
const Rotation_< P > & R() const
Return a read-only reference to the contained rotation R_BF.
Definition: Transform.h:215
ContactForce(ContactId id, const Vec3 &contactPt, const SpatialVec &forceOnSurface2, Real potentialEnergy, Real powerLoss)
Construct with values for all fields.
Definition: CompliantContactSubsystem.h:310
Real m_powerLoss
Definition: CompliantContactSubsystem.h:538
This provides deformed geometry and force details for one element of a contact patch that may be comp...
Definition: CompliantContactSubsystem.h:464
Every Simbody header and source file should include this header before any other Simbody header...
This is a unique integer Id assigned to each contact pair when we first begin to track it...
void setForceOnSurface2(const SpatialVec &forceOnSurface2)
Change the value stored in this ContactForce object for the spatial force being applied on surface 2...
Definition: CompliantContactSubsystem.h:355
const ContactForce & getContactForce() const
Definition: CompliantContactSubsystem.h:585
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
const SpatialVec & getForceOnSurface2() const
Get the total spatial force applied to body 2 at the contact point (that is, a force and a moment); n...
Definition: CompliantContactSubsystem.h:326
Real getPowerDissipation() const
Get the energy dissipation rate (power loss) due to the deformation rate and friction losses for this...
Definition: CompliantContactSubsystem.h:504
Real m_deformation
Definition: CompliantContactSubsystem.h:533
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
This subclass of Contact is used when one or both of the ContactGeometry objects is a TriangleMesh...
Definition: Contact.h:478
This ContactForceGenerator handles contact between non-conforming objects that meet at a point and ge...
Definition: CompliantContactSubsystem.h:727
A ContactPatch is the description of the forces and the deformed shape of the contact surfaces that r...
Definition: CompliantContactSubsystem.h:581
void changeFrameInPlace(const Transform &X_BA)
This object is currently in an assumed frame A; given a transform from another frame B to A we&#39;ll re-...
Definition: CompliantContactSubsystem.h:510
ElasticFoundation()
Definition: CompliantContactSubsystem.h:785
void changeFrameAndSwitchSurfacesInPlace(const Transform &X_BA)
Assuming that this object is currently reporting surface 2 information in frame A, here we want to both change the frame to B and swap which surface is to be considered as surface 2.
Definition: CompliantContactSubsystem.h:521
HertzCircular()
Definition: CompliantContactSubsystem.h:700
Real m_peakPressure
Definition: CompliantContactSubsystem.h:536
This is a force subsystem that implements a compliant contact model to respond to Contact objects as ...
Definition: CompliantContactSubsystem.h:53
This ContactGeometry subclass represents an arbitrary shape described by a mesh of triangular faces...
Definition: ContactGeometry.h:1163
The Array_<T> container class is a plug-compatible replacement for the C++ standard template library ...
Definition: Array.h:53
void changeFrameInPlace(const Transform &X_BA)
This object is currently in an assumed frame A; given a transform from another frame B to A we&#39;ll re-...
Definition: CompliantContactSubsystem.h:373
void clear()
Restore the ContactForce object to its default-constructed state with an invalid contact id and garba...
Definition: CompliantContactSubsystem.h:365
A ContactGeometry object describes the shape of all or part of the boundary of a solid object...
Definition: ContactGeometry.h:110
This subsystem identifies and tracks potential contacts between the mobilized bodies of a multibody s...
Definition: ContactTrackerSubsystem.h:148
const Vec3 & getContactPoint() const
This is the point at which this contact element applies equal and opposite forces to the two bodies...
Definition: CompliantContactSubsystem.h:468
The job of the MultibodySystem class is to coordinate the activities of various subsystems which can ...
Definition: MultibodySystem.h:48
ContactForce m_resultant
Definition: CompliantContactSubsystem.h:598
Real getPotentialEnergy() const
Get the amount of potential energy currently stored in the deformation of this contact element...
Definition: CompliantContactSubsystem.h:500
This subclass of Contact represents a contact between two non-conforming surfaces 1 and 2 that initia...
Definition: Contact.h:260
const CompliantContactSubsystem & getCompliantContactSubsystem() const
Definition: CompliantContactSubsystem.h:638
BrickHalfSpacePenalty()
Definition: CompliantContactSubsystem.h:758
This ContactForceGenerator handles contact between non-conforming objects that meet at a point and ge...
Definition: CompliantContactSubsystem.h:697
This is logically an abstract class, more specialized than "Subsystem" but not yet concrete...
Definition: ForceSubsystem.h:36
HertzElliptical()
Definition: CompliantContactSubsystem.h:730
Real getPatchArea() const
This is the surface area represented by this contact element.
Definition: CompliantContactSubsystem.h:493
ContactTypeId getContactTypeId() const
Return the ContactTypeId handled by this force generator.
Definition: CompliantContactSubsystem.h:636
std::ostream & operator<<(std::ostream &o, const ContactForce &f)
Definition: CompliantContactSubsystem.h:387
This subclass of Contact represents a contact between two non-conforming surfaces 1 and 2 that initia...
Definition: Contact.h:355
const ContactDetail & getContactDetail(int n) const
Definition: CompliantContactSubsystem.h:587
DoNothing(ContactTypeId type=ContactTypeId(0))
Definition: CompliantContactSubsystem.h:845
ThrowError(ContactTypeId type=ContactTypeId(0))
Definition: CompliantContactSubsystem.h:876
void setPowerDissipation(Real powerLoss)
Change the value stored for power loss in this ContactForce object.
Definition: CompliantContactSubsystem.h:361
ContactForceGenerator(ContactTypeId type)
Base class constructor for use by the concrete classes.
Definition: CompliantContactSubsystem.h:631
This ContactForceGenerator throws an error if it is every invoked.
Definition: CompliantContactSubsystem.h:873
Vec3 m_slipVelocity
Definition: CompliantContactSubsystem.h:531
const UnitVec3 & getContactNormal() const
This is the normal direction for this contact element, pointing away from body 1&#39;s exterior and towar...
Definition: CompliantContactSubsystem.h:472
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
UnitVec3 m_patchNormal
Definition: CompliantContactSubsystem.h:530
void setContactId(ContactId id)
Change the ContactId contained in this ContactForce object.
Definition: CompliantContactSubsystem.h:350
A Contact contains information about the spatial relationship between two surfaces that are near...
Definition: Contact.h:85
This ContactForceGenerator handles contact between a brick and a half-space.
Definition: CompliantContactSubsystem.h:755
const Vec3 & getContactPoint() const
This is the point at which this contact element applies equal and opposite forces to the two bodies...
Definition: CompliantContactSubsystem.h:322
void setTo(ContactId id, const Vec3 &contactPt, const SpatialVec &forceOnSurface2, Real potentialEnergy, Real powerLoss)
Replace the current contents of this ContactForce object with the given arguments.
Definition: CompliantContactSubsystem.h:340
Real m_deformationRate
Definition: CompliantContactSubsystem.h:534
Vec3 m_forceOnSurface2
Definition: CompliantContactSubsystem.h:532
ContactId getContactId() const
Return the ContactId of the Contact that generated this ContactForce.
Definition: CompliantContactSubsystem.h:318
This ContactForceGenerator silently does nothing.
Definition: CompliantContactSubsystem.h:842
CompliantContactSubsystem()
Default constructor creates an empty handle.
Definition: CompliantContactSubsystem.h:56
A ContactForceGenerator implements an algorithm for responding to overlaps or potential overlaps betw...
Definition: CompliantContactSubsystem.h:615
Vec3 m_contactPt
Definition: CompliantContactSubsystem.h:529
void clear()
Definition: CompliantContactSubsystem.h:583
const Vec3 & getSlipVelocity() const
Get the relative slip velocity between the bodies at the contact point, as body 2&#39;s velocity in body ...
Definition: CompliantContactSubsystem.h:476
Real getDeformation() const
Get the total normal material deformation at the contact point; this is the sum of the deformations o...
Definition: CompliantContactSubsystem.h:485
int getNumDetails() const
Definition: CompliantContactSubsystem.h:586