Contents

Allegro Hand Controller Basis

In the last tutorial, we created a Visual Studio (VS) project with three files:

control_AllegroHand.cpp
control_AllegroHand.h
control_AllegroHandCmd.h

Goals:

  1. Our first goal is to print the standard Hello World in the terminal window that accompanies AHAS. This will let us know that the controller is exporting to the correct directory, that the XDL is properly linking to the DLL and that the AHAS Lua file is, in fact, loading the correct controller for the virtual Allegro Hand.
  2. Create a simple hand motion to run at the start of AHAS.
  3. Link this motion to a button in AHAS.
  4. Call some of the BHand library grasping motions using AHAS buttons.


The following code is the basis for your AHAS control plug-in. Please paste this code into the respective files, compile, then click the shortcut on the desktop to launch your custom AHAS application. In the command (terminal) window, you should see the confirming "Hello, World!", letting you know that you have everything set up correctly. You can now begin to develop your Allegro Hand controller.

For more information, please read the comments below and reference the RoboticsLab Programming Guide.
File:RoboticsLab BegProgrammingGuide.pdf - Page 139, Section 4. Custom Control Algorithms

control_AllegroHand.h

#ifndef __CONTROL_ALLEGROHAND_H__
#define __CONTROL_ALLEGROHAND_H__
 
#include <list>
#include "rControlAlgorithm/rControlAlgorithm.h"
#include "BHand/BHand.h"
 
// control_AllegroHand inherited from algorithm interface class
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);
	virtual int  command(const short& cmd, const int& arg = 0);
 
private:
	virtual void _readDevices();
	virtual void _writeDevices();
 
	virtual void _compute(const rTime& t);
 
	void _arrangeJointDevices();
 
 
private:
 
	// algorithm variables go here
};
 
#endif

control_AllegroHandCmd.h

#ifndef __CONTROL_ALLEGROHAND_CMD_H__
#define __CONTROL_ALLEGROHAND_CMD_H__
 
#include "rCommand/rCmdManipulator.h"
 
// These commands will be fed into command()
// and can be used to envoke certain actions
// by the robot. Allegro Application Studio
// will use these to interface with the
// cotroller plug-in.
#define BH_NONE		(RCMD_USER + 0)
#define BH_HOME		(RCMD_GO_HOME)
// #define BH_ONE		(RCMD_USER + 1)
 
#endif

control_AllegroHand.cpp

#include "control_AllegroHand.h"
#include "control_AllegroHandCmd.h"
 
 
control_AllegroHand::control_AllegroHand(rDC rdc) 
:rControlAlgorithmEx(rdc)
{
	// initialize all the class member variables
}
 
control_AllegroHand::~control_AllegroHand()
{
 
}
 
void control_AllegroHand::_arrangeJointDevices()
{
}
 
void control_AllegroHand::init(int mode)
{
	// create hand and find devices
	// arrange joint devices function will be called here
	// set degrees of freedom
	// make sure all vectors are the correct size and
	// set all of the components to zero before computing
 
	printf("\nHello World!");
}
 
void control_AllegroHand::update(const rTime& t)
{
	// Evokes _readDevices(), _estimate(), _reflect(),
	// _compute(), _writeDevices() in turn by default.
}
 
void control_AllegroHand::_readDevices()
{
	// read sensors
}
 
void control_AllegroHand::_writeDevices()
{
	// write to actuators
}
 
void control_AllegroHand::_compute(const double& t)
{
	// Computes control inputs
}
 
int control_AllegroHand::command(const short& cmd, const int& arg)
{
	// Handles user-defined commands according to cmd.
	// Further information can be retrieved from the second argument.
 
	// The variable cmd will be received from Allegro Application Studio
	// and will be used to envoke hand actions
	return 0;
}
 
rControlAlgorithm* CreateControlAlgorithm(rDC& rdc)
{
	 return new control_AllegroHand(rdc);
}






You are not allowed to post comments.




Copyright & Trademark Notice
Allegro, the Allegro logo, RoboticsLab, the RoboticsLab logo, and all related files and documentation are Copyright ⓒ 2008-2020 Wonik Robotics Co., Ltd. All rights reserved. RoboticsLab and Allegro are trademarks of Wonik Robotics. All other trademarks or registered trademarks mentioned are the properties of their respective owners.

Wonik Robotics's Allegro Hand is based on licensed technology developed by the Humanoid Robot Hand research group at the Korea Institute of Industrial Technology (KITECH).

Any references to the BHand Library or the Allegro Hand Motion and/or Grasping Library refer to a library of humanoid robotic hand grasping algorithms and motions developed and published by KITECH researchers.
J.-H. Bae, S.-W. Park, D. Kim, M.-H. Baeg, and S.-R. Oh, "A Grasp Strategy with the Geometric Centroid of a Groped Object Shape Derived from Contact Spots," Proc. of the 2012 IEEE Int. Conf. on Robotics and Automation (ICRA2012), pp. 3798-3804

Wiki maintained by Sean Yi <seanyi@wonikrobotics.com>

KitechLogo.jpg Wonikrobotics logo.png





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