NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
heightSensor.h
1 /*
2  * abstractMarker.h
3  *
4  * Created on: Jul 15, 2014
5  * Author: atiliscen
6  */
7 
8 #ifndef HEIGHTSENSOR_H_
9 #define HEIGHTSENSOR_H_
10 
11 #include "LinearMath/btVector3.h"
12 #include "BulletDynamics/Dynamics/btRigidBody.h"
13 #include "core/tgSubject.h"
14 #include "btBulletDynamicsCommon.h"
15 #include "core/tgWorld.h"
16 #include "core/tgBulletUtil.h"
17 
18 
19 /* ColoredMarkers are non-physical markers that are attached to a specific physical body.
20  * They are presented as colored spheres at the simulation.
21  * Markers are considered to move with the physical body.
22  * (they use orientation and translation vectors of the body)
23  * Using the orientation of the physical body, it can return its absolute position when requested.
24 */
25 
26 class heightSensor : public tgSubject<heightSensor>
27 {
28 public:
29  heightSensor();
30  /*construct by attaching to the body using the absolute position pos, and highlight it with the given color.*/
31  heightSensor(const btRigidBody *body,btVector3 pos, int nodeNumber, tgWorld& world);
32  /* Returns the current world position by looking at the attached objects transformation quaternion */
33  btVector3 getWorldPosition() const;
34  /* Returns the relative position to the center of mass of the attached body */
35  btVector3 getRelativePosition() const;
36  double getHeight() const;
37 
38  int getNodeNumber() const {
39  return nodeNumber;
40  }
41 
42 private:
43  const btRigidBody *attachedBody;
44  //Relative position to the body when it is first constructed
45  btVector3 attachedRelativeOriginalPosition;
46  int nodeNumber;
47  btDynamicsWorld *btworld;
48 };
49 
50 #endif /* HEIGHTSENSOR_H_ */
Definition of tgSubject class.
Contains the definition of class tgWorld $Id$.
Contains the definition of class tgBulletUtil.