4. AHAS Buttons and BHand Library Motions Revision as of 18:06, 8 November 2012 by Alexalspach (Talk | contribs)
In the last few tutorials, we verified created a control algorithm project and verified our setup by performing a simple user-defined motion on both the virtual and actual Allegro Hands. We did all this ignoring the features of Allegro Hand Application Studio (AHAS) as a robust GUI interface for controlling the hand and visualizing certain data.
In this tutorial, we will take advantage of buttons in AHAS and use them to invoke our own algorithms and those supplied along with AHAS in the BHand Library.
AHAS Buttons
In your AHAS bin/controls directory, locate the file ALLEGROHAND1.lua. This is the file that we made in Tutorial 1 which links to out new controller. Copy this file to your Desktop.
Note: Once again, we must copy this file to the desktop for editing then move it back to the controls folder when we are finished.
From the Desktop, let's open up ALLEGROHAND1.lua and take a look.
The function OnGUI() is the area of interest. This function contains the buttons and joint angle sliders we seen on the AHAS GUI. To create a button and link its press to a command is as simple as follows:
... -- if button is pressed -- GUIButton(x-pos, y-pos, width, height, "name") if (GUIButton(5, 35, 120, 25, "Home")) then -- command to be send to controller: -- RCMD_GO_HOME, RCMD_GO_READY or RCMD_USER + # sendCommand("HandController", RCMD_GO_HOME, VK_H) -- command prompt output print("Home button pressed") end ...
This button, when pressed, will cause the hand to assume its Home position. As mentioned in the comments, the arguments of GUIButtons() specify the button's location and the string displayed on the button.
x-pos: button's distance from the left side of the AHAS window (pixels) y-pos: button's distance from the top of the AHAS window (pixels) width: button width (pixels) height: button height (pixels)
The function sendCommand is used to forward a command to the hand controller, the DLL plug-in, control_AllegroHand.dll.
... -- "HandController", name assigned to controller plugin control_AllegroHand.dll (linked through control_AllegroHand.xdl) -- code from function Awake() -- createController("HandController", "hand") --, 1, "controls/control_AllegroHand.xdl", "") -- setControlAlgorithm("HandController", "controls/control_AllegroHand.xdl") -- RCMD_GO_HOME, command value recognized by switch statement within control_AllegroHand.cpp's command() function. -- RCMD_GO_HOME defined in control_AllegroHandCmd.h sendCommand("HandController", RCMD_GO_HOME) ...
Notice that all of the button code to command the Allegro Hand library motion is already available within the original LUA file, yet, if clicked, these buttons do nothing. We must develop the command() function in control_AllegroHand.cpp to handle the incoming commands.
Plug-in Command Handling
control_AllegroHand.cpp
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>
Whos here now: Members 0 Guests 0 Bots & Crawlers 1 |