Drake
Element.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdint.h>
4 #include <memory>
5 #include <utility>
6 
7 #include <Eigen/Dense>
8 #include <Eigen/StdVector>
9 
10 #include "drake/drakeCollision_export.h"
12 
13 // Forward declaration.
14 // This forward declaration is made in order to be able to add a reference
15 // to the parent body without the collision element ever using the RigidBody or
16 // any of its methods.
17 // This is particularly useful when the physics engine (at the RigidBody or
18 // RigidBodyTree scope) needs to retrieve the parent body (for instance to
19 // query its world transform).
20 class RigidBody;
21 
22 namespace DrakeCollision {
23 typedef uintptr_t ElementId;
24 
25 class DRAKECOLLISION_EXPORT Element : public DrakeShapes::Element {
26  public:
27  Element(const Eigen::Isometry3d& T_element_to_local =
28  Eigen::Isometry3d::Identity());
29 
30  Element(const DrakeShapes::Geometry& geometry,
31  const Eigen::Isometry3d& T_element_to_local =
32  Eigen::Isometry3d::Identity());
33 
34  virtual ~Element() {}
35 
36  virtual Element* clone() const;
37 
38  ElementId getId() const;
39 
40  virtual bool isStatic() const { return false; }
41 
44  void set_static() { is_static_ = true;}
45 
51  bool is_static() { return is_static_;}
52 
58  virtual bool CollidesWith(const Element* other) const { return true; }
59 
62  const RigidBody* get_body() const;
63 
65  void set_body(const RigidBody *body);
66 
70  friend DRAKECOLLISION_EXPORT std::ostream& operator<<(std::ostream&,
71  const Element&);
72 
73  protected:
74  Element(const Element& other);
75 
76  private:
77  ElementId id;
78  bool is_static_{false};
79  const RigidBody* body_{};
80 
81  public:
82  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
83 };
84 
85 } // namespace DrakeCollision
void set_static()
Flags this collision element to be static, i.e.
Definition: Element.h:44
ostream & operator<<(ostream &out, const Element &ee)
Definition: Element.cpp:36
Definition: Element.h:25
bool is_static()
Returns true if the shape does not move, false otherwise.
Definition: Element.h:51
Definition: Geometry.h:29
Definition: RigidBody.h:16
virtual bool CollidesWith(const Element *other) const
Returns true if this element should be checked for collisions with the other object.
Definition: Element.h:58
virtual bool isStatic() const
Definition: Element.h:40
virtual ~Element()
Definition: Element.h:34
Definition: Element.h:14
Definition: bullet_model.cc:17
uintptr_t ElementId
Definition: Element.h:23