Line 13: Line 13:
 
#Win32 Application, DLL, empty proj
 
#Win32 Application, DLL, empty proj
 
#Add cpp, h, and h
 
#Add cpp, h, and h
#
+
 
#
+
  
 
'''control_AllegroHandCmd.h:'''
 
'''control_AllegroHandCmd.h:'''
Line 28: Line 27:
 
#endif
 
#endif
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
 +
 +
 +
 +
'''control_AllegroHand.h:'''
 +
<syntaxhighlight lang="cpp">
 +
#ifndef __CONTROL_ALLEGROHAND_H__
 +
#define __CONTROL_ALLEGROHAND_H__
 +
 +
#include <list>
 +
#include "rControlAlgorithm/rControlAlgorithm.h"
 +
#include "BHand/BHand.h"
 +
//#include "rDeviceERHandRemoteCmd.h" // for BlueTooth or TCPIP control
 +
 +
#define JDOF 16 // Degrees of freedom
 +
 +
class REXPORT control_AllegroHand : public rControlAlgorithmEx
 +
{
 +
public:
 +
control_AllegroHand(rDC rdc);
 +
~control_AllegroHand();
 +
 +
virtual void init(int mode = 0);
 +
virtual void update(const rTime& t);
 +
 +
//// dont use
 +
// virtual void setNominalSystem(const TCHAR* path, const TCHAR* aml, const HTransform& T0, const dVector& q0);
 +
 +
//// dont use
 +
//virtual void setPeriod(const rTime& dT);
 +
 +
virtual int command(const short& cmd, const int& arg = 0);
 +
 +
//// for plotting
 +
// virtual void datanames(vector<string_type>& names, int channel = -1);
 +
// virtual void collect(vector<double>& data, int channel = -1);
 +
 +
//// for Move Object?? for telling where to grasp
 +
// virtual void onSetInterestFrame(const TCHAR* name, const HTransform& T);
 +
 +
private:
 +
// virtual void _estimate();
 +
virtual void _readDevices();
 +
virtual void _writeDevices();
 +
 +
//virtual void _reflect();
 +
virtual void _compute(const rTime& t);
 +
 +
void _arrangeJointDevices();
 +
 +
void _servoOn();
 +
void _servoOff();
 +
 +
 +
private:
 +
rTime _cur_time;
 +
 +
BHand* _hand;
 +
bool _is_left_hand;
 +
 +
rID _motor[16];
 +
rID _enc[16];
 +
//rID _remoteTP_BT;
 +
//rID _remoteTP_TCPIP;
 +
 +
dVector _q; // joint position for 16 joints
 +
dVector _qdot; // joint velocity
 +
dVector _torque; // joint torque
 +
 +
int _jdof;
 +
 +
double _x[4];
 +
double _y[4];
 +
double _z[4];
 +
 +
//// for testing each motor
 +
//int _jid_test;
 +
//bool _test_mode;
 +
 +
//// for remote control
 +
//MessageRemoteTP_t _msgRTP;
 +
//int _sz2read_msgRTP;
 +
 +
//// for show off
 +
//int _demo_mode;
 +
//rTime _demo_start_time;
 +
//dVector _demo_q_des;
 +
};
 +
 +
#endif
 +
</syntaxhighlight>
 +
 +
 +
 +
 +
 +
 +
 
#
 
#
 
#
 
#

Revision as of 19:12, 29 October 2012

DLL project sim or app not necessary, just plugin to AAS

Create XDL path to DLL

Create Custom Lua file with new controller Add buttons, maybe


  1. create new project
  2. Win32 Application, DLL, empty proj
  3. Add cpp, h, and h


control_AllegroHandCmd.h:

#ifndef __CONTROL_ALLEGROHAND_AUTO_CMD_H__
#define __CONTROL_ALLEGROHAND_AUTO_CMD_H__
 
#include "rCommand/rCmdDefine.h"
 
#define DEFAULT_CMD		(RCMD_USER + 1)
//#define USER_CMD_1	(RCMD_USER + 10)
 
#endif



control_AllegroHand.h:

#ifndef __CONTROL_ALLEGROHAND_H__
#define __CONTROL_ALLEGROHAND_H__
 
#include <list>
#include "rControlAlgorithm/rControlAlgorithm.h"
#include "BHand/BHand.h"
//#include "rDeviceERHandRemoteCmd.h" // for BlueTooth or TCPIP control
 
#define JDOF 16 // Degrees of freedom
 
class REXPORT control_AllegroHand : public rControlAlgorithmEx
{
public:
	control_AllegroHand(rDC rdc);
	~control_AllegroHand();
 
	virtual void init(int mode = 0);
	virtual void update(const rTime& t);
 
	//// dont use
	// virtual void setNominalSystem(const TCHAR* path, const TCHAR* aml, const HTransform& T0, const dVector& q0);
 
	//// dont use
	//virtual void setPeriod(const rTime& dT);
 
	virtual int command(const short& cmd, const int& arg = 0);
 
	//// for plotting
	// virtual void datanames(vector<string_type>& names, int channel = -1);
	// virtual void collect(vector<double>& data, int channel = -1);
 
	//// for Move Object?? for telling where to grasp
	// virtual void onSetInterestFrame(const TCHAR* name, const HTransform& T);
 
private:
	// virtual void _estimate();
	virtual void _readDevices();
	virtual void _writeDevices();
 
	//virtual void _reflect();
	virtual void _compute(const rTime& t);
 
	void _arrangeJointDevices();
 
	void _servoOn();
	void _servoOff();
 
 
private:
	rTime				_cur_time;
 
	BHand*				_hand;
	bool				_is_left_hand;
 
	rID					_motor[16];
	rID					_enc[16];
	//rID				_remoteTP_BT;
	//rID				_remoteTP_TCPIP;
 
	dVector				_q;			// joint position for 16 joints
	dVector				_qdot;		// joint velocity
	dVector				_torque;	// joint torque
 
	int					_jdof;
 
	double				_x[4];
	double				_y[4];
	double				_z[4];
 
	//// for testing each motor
	//int					_jid_test;
	//bool				_test_mode;
 
	//// for remote control
	//MessageRemoteTP_t	_msgRTP;
	//int					_sz2read_msgRTP;
 
	//// for show off
	//int					_demo_mode;
	//rTime				_demo_start_time;
	//dVector				_demo_q_des;
};
 
#endif








Whos here now:   Members 0   Guests 14   Bots & Crawlers 1