Drake
contact_results.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
8 
9 namespace drake {
10 namespace systems {
11 
12 // Forward declaration
13 template <typename T>
15 
16 /**
17  A class containg the contact results (contact points and response spatial
18  forces for each colliding pair of collision elements).
19 
20  @tparam T The scalar type. It must be a valid Eigen scalar.
21 
22  Instantiated templates for the following ScalarTypes are provided:
23  - double
24  */
25 template <typename T>
27  public:
29 
31 
32  /** Returns the number of unique collision element pairs in contact. */
33  int get_num_contacts() const;
34 
35  /** Retrieves the ith ContactInfo instance. No bounds checking will be done
36  in a release build (but will be done in debug). It is assumed the caller
37  will only use values in the range [0, get_num_contacts() -1], inclusive.
38  */
39  const ContactInfo<T>& get_contact_info(int i) const;
40 
41  // Clears the set of contact information for when the old data becomes
42  // invalid.
43  void Clear();
44 
45  // Reports a contact between two elements and prepares a ContactInfo. The
46  // caller should populate the ContactInfo with the appropriate details.
49 
50  private:
51  std::vector<ContactInfo<T>> contacts_;
52 };
53 
54 } // namespace systems
55 } // namespace drake
uintptr_t ElementId
Definition: element.h:26
int get_num_contacts() const
Returns the number of unique collision element pairs in contact.
Definition: contact_results.cc:9
A class containing information regarding contact response between two bodies including: ...
Definition: contact_info.h:47
Definition: automotive_demo.cc:88
A class containg the contact results (contact points and response spatial forces for each colliding p...
Definition: contact_results.h:26
const ContactInfo< T > & get_contact_info(int i) const
Retrieves the ith ContactInfo instance.
Definition: contact_results.cc:14
ContactResults()
Definition: contact_results.cc:20
#define DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Classname)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN defaults the special member functions for copy-construction, copy-assignment, move-construction, and move-assignment.
Definition: drake_copyable.h:57
This class provides a System interface around a multibody dynamics model of the world represented by ...
Definition: contact_results.h:14
void Clear()
Definition: contact_results.cc:23
ContactInfo< T > & AddContact(drake::multibody::collision::ElementId element_a, drake::multibody::collision::ElementId element_b)
Definition: contact_results.cc:28
Provides careful macros to selectively enable or disable the special member functions for copy-constr...