1 #ifndef SimTK_SIMBODY_CONTACT_TRACKER_SUBSYSTEM_H_ 2 #define SimTK_SIMBODY_CONTACT_TRACKER_SUBSYSTEM_H_ 34 class MultibodySystem;
38 class ContactSnapshot;
156 int getNumSurfaces()
const;
186 bool& reverseOrder)
const;
225 bool realizeActiveContacts(
const State& state,
227 Real& stepAdvice)
const;
232 bool realizePredictedContacts(
const State& state,
234 Real& stepAdvice)
const;
240 class ContactTrackerSubsystemImpl& updImpl();
241 const ContactTrackerSubsystemImpl& getImpl()
const;
261 typedef std::map<ContactId,int> ContactMap;
264 typedef std::map<std::pair<ContactSurfaceIndex,ContactSurfaceIndex>,
274 m_id2contact.clear();
275 m_surfPair2id.clear();
292 assert(
id.isValid() && surf1.isValid() && surf2.isValid());
295 if (surf1 > surf2) std::swap(surf1,surf2);
297 assert(!hasContact(
id));
298 assert(!hasContact(surf1,surf2));
300 const int indx = m_contacts.size();
301 m_contacts.push_back(contact);
302 m_id2contact[id] = indx;
303 m_surfPair2id[std::make_pair(surf1,surf2)] = id;
308 {
return m_id2contact.find(
id) != m_id2contact.end(); }
312 {
if (surf1 > surf2) std::swap(surf1,surf2);
313 return m_surfPair2id.find(std::make_pair(surf1,surf2))
314 != m_surfPair2id.end(); }
328 ContactMap::const_iterator p = m_id2contact.find(
id);
329 return p==m_id2contact.end() ? empty : m_contacts[p->second]; }
335 {
if (surf1 > surf2) std::swap(surf1,surf2);
336 SurfaceMap::const_iterator p =
337 m_surfPair2id.find(std::make_pair(surf1,surf2));
338 return p==m_surfPair2id.end() ?
ContactId() : p->second; }
346 void removeContact(
int n) {
347 assert(0 <= n && n < m_contacts.size());
348 if (n+1 == m_contacts.size()) {
349 m_contacts.pop_back();
353 m_contacts[
n] = m_contacts.back();
354 m_contacts.pop_back();
355 m_id2contact[m_contacts[
n].getContactId()] =
n;
361 ContactMap m_id2contact;
362 SurfaceMap m_surfPair2id;
375 #endif // SimTK_SIMBODY_CONTACT_TRACKER_SUBSYSTEM_H_ #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:580
A Subsystem is expected to be part of a larger System and to have interdependencies with other subsys...
Definition: Subsystem.h:55
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
Every Simbody header and source file should include this header before any other Simbody header...
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:593
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:276
const Real NaN
This is the IEEE "not a number" constant for this implementation of the default-precision Real type; ...
that it contains events that have triggered but have not been processed Thus it is not a legitimate point along the systems trajectory and should never be returned to the caller For discussion we label this improper state EMBED Equation DSMT4 The event handler will correct the state creating a modified state with time still at thigh but not triggering any events We label the modified state EMBED Equation DSMT4 Once the systems handler the state EMBED Equation DSMT4 can be output as part of the trajectory and used as the initial condition for the next continuous interval Thus the time stepper generates the sequence of legitimate trajectory points just prior to event immediately followed by EMBED Equation DSMT4 which is the time at which the but after the event handler has modified the state to deal with those events Consecutive intervals I and I will consist of trajectory points EMBED Equation DSMT4 with round brackets indicating that EMBED Equation DSMT4 is not part of the trajectory Event handlers Event handlers are solvers which are able to take a state in an resolve the set up appropriate event triggers for the next and report back to the time stepper the degree to which the system continuity has been so that the integrator can be reinitialized appropriately An event handler can also indicate that the simulation should be in which case the time stepper will return the final state to its caller and disallow further time stepping Other event types Not all events have to be localized There are several special case clock time
Definition: SimmathUserGuide.doc:219
The SimTK::Array_<T> container class is a plug-compatible replacement for the C++ standard template l...
Definition: Array.h:50
The job of the MultibodySystem class is to coordinate the activities of various subsystems which can ...
Definition: MultibodySystem.h:48
std::ostream & operator<<(std::ostream &o, const ContactForce &f)
Definition: CompliantContactSubsystem.h:387
gikDdMV wfaIJt A٩t1 JcA nr S q is3 ֧ VK C 9Z D q Fxn n T Y < ['jd< K JvTMH"sw>}o_o? z'z:mV$yng͖i۸J{ Ta*dE|lzbX@!^Ooi_=O}&ŲQUVWTsh!P_7DRAVfʿbOԹɫt0Y!|'x'óݥ:/ V[,}-B֞/܂;:;;Iޘ[nK4#-='Gf\lb41۩> Os7x f pZzB I g n
Definition: SimmathUserGuide.doc:2262
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:72
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:167