00001 #ifndef HISPIDAR4D_H
00002 #define HISPIDAR4D_H
00003
00004 #include "HIHapticDevice.h"
00005 #include "HISpidarMotor.h"
00006 #include "Device/DVDeviceManager.h"
00007 #include <vector>
00008
00009 namespace Spr {
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 class SPR_DLL HISpidar4D: public HIForceDevice3D{
00045 public:
00046 HIOBJECTDEF(HISpidar4D);
00047
00048 typedef HIForceDevice3D superclass;
00049 protected:
00050 Vec3f pos;
00051
00052 Vec3f posSqrConst;
00053
00054 Matrix3f matPos;
00055 Vec3f phi[4];
00056 float tension[4];
00057
00058 protected:
00059
00060 HISpidarMotor motor[4];
00061
00062
00063
00064
00065
00066
00067
00068 float AvailableForce(int disable, Vec3f& f, Vec3f* v3Str);
00069
00070 void InitMat();
00071
00072 public:
00073
00074 HISpidar4D();
00075
00076 virtual ~HISpidar4D();
00077
00078 virtual bool Init(DVDeviceManager& dev);
00079
00080 virtual bool Init(DVDeviceManager& dev, Vec3f* motorPos, float vpn, float lpp, float minF, float maxF);
00081
00082 virtual bool BeforeCalib(){ SetMinForce(); return true; }
00083
00084 virtual bool Calib();
00085
00086 void SetMinForce();
00087
00088 virtual void SetForce(const Vec3f& f){ SetForce(f, 0.1f); }
00089 virtual void SetForce(const Vec3f& f,float eff){ SetForce(f, eff, 0.0f); }
00090 virtual void SetForce(const Vec3f& f, float eff, float cont);
00091
00092 virtual void Update(float dt);
00093 virtual Vec3f GetForce();
00094 virtual Vec3f GetPos(){ return pos; }
00095
00096 HISpidarMotor* Motor(){
00097 return motor;
00098 }
00099
00100 };
00101
00102
00103 }
00104 #endif
00105