00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef P_VRPNFEEDBACK_H
00024 #define P_VRPNFEEDBACK_H 
00025 
00026 #if defined(VMDVRPN)
00027 
00028 #include "P_Feedback.h"
00029 #include "vrpn_ForceDevice.h"  
00030 
00032 class VRPNFeedback : public Feedback {
00033  private:
00034   vrpn_ForceDevice_Remote *fdv;
00035   vrpn_float32 F[3], jac[3][3]; 
00036 
00037  protected:
00038   virtual int do_start(const SensorConfig *);
00039 
00040  public:
00041   VRPNFeedback();
00042   ~VRPNFeedback();
00043  
00044   virtual const char *device_name() const { return "vrpnfeedback"; }
00045   virtual Feedback *clone() { return new VRPNFeedback; }
00046 
00047   virtual void update();
00048   inline virtual int alive() { 
00049     if(fdv) if(fdv->connectionAvailable()) return 1;
00050     return 0;
00051   }
00052   virtual void addconstraint(float k, const float *location);
00053   virtual void addplaneconstraint(float k, const float *point,
00054                                   const float *normal);
00055   virtual void addforcefield(const float *origin, const float *force,
00056                              const float *jacobian);
00057   inline virtual void zeroforce();
00058   inline virtual void forceoff();
00059   virtual void sendforce(const float *initial_pos);
00060 };
00061 
00062 #endif
00063 
00064 #endif