00001 #ifndef HISPIDAR4_H
00002 #define HISPIDAR4_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 HISpidar4: public HIForceDevice3D{
00045 public:
00046
00047 typedef HIForceDevice3D superclass;
00048 protected:
00049 Vec3f pos;
00050
00051 Vec3f posSqrConst;
00052
00053 Matrix3f matPos;
00054 Vec3f phi[4];
00055 float tension[4];
00056
00057 protected:
00058
00059 HISpidarMotor motor[4];
00060
00061
00062
00063
00064
00065
00066
00067 float AvailableForce(int disable, Vec3f& f, Vec3f* v3Str);
00068
00069 void InitMat();
00070
00071 public:
00072
00073 HISpidar4();
00074
00075 HIOBJECTDEF(HISpidar4);
00076
00077 virtual ~HISpidar4();
00078
00079 virtual bool Init(DVDeviceManager& dev);
00080
00081 virtual bool Init(DVDeviceManager& dev, Vec3f* motorPos, float vpn, float lpp, float minF, float maxF);
00082
00083 virtual bool BeforeCalib(){ SetMinForce(); return true; }
00084
00085 virtual bool Calib();
00086
00087 void SetMinForce();
00088
00089 virtual void SetForce(const Vec3f& f, const Vec3f& t){ SetForce(f); }
00090 virtual void SetForce(const Vec3f& f){ SetForce(f, 0.1f); }
00091 virtual void SetForce(const Vec3f& f,float eff){ SetForce(f, eff, 0.0f); }
00092 virtual void SetForce(const Vec3f& f, float eff, float cont);
00093
00094 virtual void Update(float dt);
00095 virtual Vec3f GetForce();
00096 virtual Vec3f GetPos(){ return pos; }
00097
00098 HISpidarMotor* Motor(){
00099 return motor;
00100 }
00101
00102 };
00103
00104
00105 }
00106 #endif
00107