00001 #ifndef HISPIDAR2_H
00002 #define HISPIDAR2_H
00003
00004 #include <HIS/HIHapticDevice.h>
00005 #include <HIS/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 HISpidar2: 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 HISpidar2();
00074
00075 HIOBJECTDEF(HISpidar2);
00076
00077 virtual ~HISpidar2();
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){ SetForce(f, 0.1f); }
00090 virtual void SetForce(const Vec3f& f,float eff){ SetForce(f, eff, 0.0f); }
00091 virtual void SetForce(const Vec3f& f, float eff, float cont);
00092
00093 virtual void Update(float dt);
00094 virtual Vec3f GetForce();
00095 virtual Vec3f GetPos(){ return pos; }
00096
00097 HISpidarMotor* Motor(){
00098 return motor;
00099 }
00100
00101 };
00102
00103
00104 }
00105 #endif
00106