In the last tutorial, 2. Allegro Hand Joint Position Control, we developed a controller that commands the joints in a sinusoidal fashion. While any motion can be established at this point, we will show this same motion in the actual Allegro Hand to demonstrate the ease of developing a controller for use with both the virtual and actual Allegro Hand systems.

This tutorial assumes you have completed both of the previous tutorials, 1. Setup: DLL Project, Control XDL & the AHAS Lua file and 2. Allegro Hand Joint Position Control. Also, this tutorial assumes that you have one of the four stock supported CAN devices


Contents

Lua File

Navigate to the Allegro Hand Application Studio (AHAS) controls directory and locate the file called ERHAND_NI-CAN_LEFT.

C:\Program Files (x86)\SimLab\Allegro Hand Application Studio\bin\controls

Find the Lua file called ERHAND_NI-CAN_LEFT.lua and copy it to your Desktop. Rename the file ALLEGROHAND1_ACTUAL.lua. Open ALLEGROHAND1_ACTUAL.lua to see the following code.

 function Awake()
 	print("Begin Allegro Hand")
 	version()
 
	-- If you just want to simulate, comment "rtTimer" and "createRTSystem"
	-- and uncomment loadModel
	-- to change CAN interface, change "createRTSystem" line
 
 	--loadModel("hand", "models/Etc/ERHand/ERHand.aml")
 	rtTimer = createTimer("RTTimer", rTimer_MODE_REAL_WIN32)
 	print(rtTimer)
 	createRTSystem("models/Etc/ERHand/ERHandL_RT_NICAN.aml", "RTSys", rtTimer)
 	createController("RTController", "RTSys") --, 1, "controls/control_ERHand.xdl", "")
 	setControlAlgorithm("RTController", "controls/control_ERHandL.xdl")
 	--setNominalSystem("HandController", "")
 end
 
  function Update()
  	-- body
  end
 
 BH_READY = RCMD_USER + 2
 CAN_CMD_RESET_ENC = 4
 
 
  function OnGUI()
 
    if (GUIButton(5, 5, 120, 25, "On")) then
      onDevice("RTSys", "COMM")
      sendCommand("RTController", RESERVED_CMD_SERVO_ON)
    end
 
    if (GUIButton(130, 5, 120, 25, "Off")) then
      --offDevice("RTSys", "COMM")
      --sendCommand("RTController", RESERVED_CMD_SERVO_OFF)
	  sendCommand("RTController", RCMD_USER + 0)
	  print("None")
    end
 
  	if (GUIButton(5, 35, 120, 25, "Home")) then
  		sendCommand("RTController", RCMD_GO_HOME, VK_H)
  		print("Home button pressed")
  	end
  	if (GUIButton(130, 35, 120, 25, "Ready")) then
  		sendCommand("RTController", BH_READY, VK_R)
  		print("Ready button pressed")
  	end
 
    if (GUIButton(5, 65, 120, 25, "GRASP 3")) then
  		sendCommand("RTController", RCMD_USER + 3, VK_G)
  		print("Grasp 3 button pressed")
  	end
    if (GUIButton(130, 65, 120, 25, "GRASP 4")) then
      sendCommand("RTController", RCMD_USER + 4)
    end
 
  	if (GUIButton(5, 95, 120, 25, "PINCHING(I)")) then
  		sendCommand("RTController", RCMD_USER + 5, VK_P)
  		print("Pinching button pressed")
  	end
    if (GUIButton(130, 95, 120, 25, "PINCHING(M)")) then
      sendCommand("RTController", RCMD_USER + 6)
    end
 
    if (GUIButton(5, 125, 245, 25, "Envelop")) then
      sendCommand("RTController", RCMD_USER + 8)
      print("Envelop")
    end
 
    if (GUIButton(5, 155, 245, 25, "Show Off")) then
      sendCommand("RTController", RCMD_USER + 50)
      print("Show Off")
    end
 
 
	if (GUIButton(5, 185, 120, 25, "Test Encoders")) then
 
	  for i=1,16 do
		encName = "enc"..i
 
		if i == 1 then
			print(" ")
			print("Finger 1")
		end
 
		if i == 5 then
			print(" ")
			print("Finger 2")
		end
 
		if i == 9 then
			print(" ")
			print("Finger 3")
		end
 
		if i == 13 then
			print(" ")
			print("Finger 4")
		end
 
		deviceCommand("RTSys", encName, CAN_CMD_RESET_ENC)
		--print("Test Encoders")
	  end
 
    end
 
	if (GUIButton(130, 185, 120, 25, "Test Motors")) then
      sendCommand("RTController", RCMD_USER + 99)
      print("Test Motors")
    end
 
 
    width = (ScreenWidth-10)/4
    --print(width)
    top = ScreenHeight - 35*5;
 
 
    for i=1,4 do
      for j=1,4 do
        context = "Finger"..i.."_Link"..j
        pos = jointPosition("RTSys", context)
        context=context..string.format(": %.3f",math.deg(pos))
        GUILabel(10 + (i-1)*width, top + 35*(j-1), width-10, 15, context)
        GUISlider(10 + (i-1)*width, top+ 15 + 35*(j-1), width-10, 16, math.deg(pos), -180, 180)
      end
    end
 
 
  end

The line below loads the NI-CAN interfacing Allegro Hand model. We must change this to reflect the hand (left/right) and the CAN interface (NI/Softing/ESD/Kvaser) that are using. Please refer to the following table to determine with what model you must replace "ERHandL_RT_NICAN.aml".

createRTSystem("models/Etc/ERHand/ERHandL_RT_NICAN.aml", "RTSys", rtTimer)
NI CAN
Softing
Kvaser
ESD
Right
stuff stuff stuff stuff
Left
stuff stuff stuff stuff






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