vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Vibration.h
Go to the documentation of this file.
1 #ifndef VF_VIBRATION
2 #define VF_VIBRATION
3 
4 #include <vrecko/Ability.h>
5 #include <vreckoDP/base/PHANToM.h>
6 
7 #include <osg/Timer>
8 #include "Auxiliary.h"
9 
10 using namespace vrecko;
11 using namespace vreckoDP_base;
12 namespace VirtualFixture{
13 
14 extern osg::Timer vtimer; //declare timer for vibration (it's not the same as in auxiliary.cpp !!!!)
15 
16 class Vibration: public PHANToMFilter {
17  public:
18  Vibration();
19  ~Vibration() {};
20 
22  void apply(PHANToM *pPHANToM, osg::Vec3 &force);
23  void processEvent(const std::string &input_name, void *value);
24 
25  void preInitialize(void);
26  void postInitialize(void);
27  void update(void);
28 
29  bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParametersNode);
30  XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *);
31 
32  bool active; //if true, it will be active
33 
34  float frequency; //frequency of vibration
35  float amplitude; //amplitude of vibration
36  osg::Vec3 direction; //direction of vibration -> if freq > 20 hz, direction is indistinguisable!!!
37  float duration; //how long will vibration last
38 
39  osg::Timer_t vstart_tick; //when vibration was started
40 
41  protected:
42  PHANToM *PHANToMDevice;
43  bool all_on;
44 };
45 
46 };
47 #endif