🤚PND Dexterous hands
Adam can be equipped with self-developed humanoid five-fingered dexterous hand. This dexterous hand has 6 degrees of freedom and 12 moving joints, and can simulate human hands to achieve complex actions.
🕹️Control method
The official dexterous hand defaults to using serial port/485 communication for control. Adam will use a passthrough module to convert it to Ethernet protocol, making it a node sub-device of Adam, facilitating Ethernet operations such as tcp/udp and better integrating into the Adam robot ecosystem.
- Communication process:
udp/tcp
<->serial port
<->485
<->hand
.
The following control example uses udp to control five fingers.
id | 0 | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|---|
Joint | pinky | ring | middle | index | thumb-bend | thumb-rotation |
The above id corresponds to the control of each finger and corresponds to the numerical input order of the write6
function in the following demo.
🐍Python demo
import time
import socket
import threading
import signal
import sys
global port
port = 2562
global addr_l, addr_r
addr_l = '10.10.10.18'
addr_r = '10.10.10.38'
global sok_l, sok_r
def add_checksum(sbytes):
checksum = 0x00
for i in range(2, len(sbytes)):
checksum += sbytes[i]
checksum &= 0xFF
sbytes.append(checksum)
return sbytes
def hand_creat_pack(id, cmd, index, data):
length = len(data)
sbytes = [0x55, 0xAA]
sbytes.append(length+2)
sbytes.append(id)
sbytes.append(cmd)
sbytes.append(index)
for i in range(length):
sbytes.append(data[i])
sbytes = add_checksum(sbytes)
return sbytes
def hand_ctrl_all_pack(p):
return hand_ctrl_pack([p, p, p, p, p, p], id=[1, 2, 3, 4, 5, 6])
def hand_ctrl_pack(position, id=[1, 2, 3, 4, 5, 6]):
if position is None:
return None
if len(id) != len(position):
return None
if len(id) > 6:
return None
if len(id) <= 0:
return None
length = len(id)
sbytes = [0x55, 0xAA]
sbytes.append(1+3*length)
sbytes.append(0xff) # id
sbytes.append(0xF2) # cmd
for i in range(length):
sbytes.append(id[i])
sbytes.append(position[i] & 0xFF)
sbytes.append((position[i] >> 8) & 0xFF)
sbytes = add_checksum(sbytes)
return sbytes
def hand_write_to_flash_pack(id):
cmd = 4
index = 0x00
data = [0x20,]
sbytes = hand_creat_pack(id, cmd, index, data)
return sbytes
def hand_get_id_pack():
id = 0xff
cmd = 1
index = 0x62
data = [2,]
sbytes = hand_creat_pack(id, cmd, index, data)
return sbytes
def hand_change_id_pack(sid, tid):
id = sid
cmd = 2
index = 2
data = [tid,]
sbytes = hand_creat_pack(id, cmd, index, data)
return sbytes
# 55 AA 03 03 02 02 02 0C
def hand_get_state_pack(id):
cmd = 4
index = 0x00
data = [0x22,]
sbytes = hand_creat_pack(id, cmd, index, data)
return sbytes
def hand_err_clear_pack(id):
cmd = 4
index = 0x00
data = [0x1E,]
sbytes = hand_creat_pack(id, cmd, index, data)
return sbytes
def ctrl_one(id):
global sok_l, sok_r
global port
global addr_l, addr_r
sbytes = hand_ctrl_pack([2000], [id])
sok_l.sendto(bytes(sbytes), (addr_l, port))
sok_r.sendto(bytes(sbytes), (addr_r, port))
time.sleep(1)
sbytes = hand_ctrl_pack([0], [id])
sok_l.sendto(bytes(sbytes), (addr_l, port))
sok_r.sendto(bytes(sbytes), (addr_r, port))
time.sleep(1)
def ctrl():
global sok_l, sok_r
global port
global addr_l, addr_r
# sbytes = pnd_hand.hand_ctrl_pack([200],[id])
# sok_l.sendto(bytes(sbytes),(addr_l,port))
# sok_r.sendto(bytes(sbytes),(addr_r,port))
# time.sleep(1)
# sbytes = pnd_hand.hand_ctrl_pack([0],[id])
# sok_l.sendto(bytes(sbytes),(addr_l,port))
# sok_r.sendto(bytes(sbytes),(addr_r,port))
sbytes = hand_ctrl_pack([0, 0, 0, 0, 0, 0])
sok_l.sendto(bytes(sbytes), (addr_l, port))
sok_r.sendto(bytes(sbytes), (addr_r, port))
time.sleep(0.8)
sbytes = hand_ctrl_pack([1900, 1900, 1900, 1900, 0, 0])
sok_l.sendto(bytes(sbytes), (addr_l, port))
sok_r.sendto(bytes(sbytes), (addr_r, port))
time.sleep(0.8)
sbytes = hand_ctrl_pack([0, 0, 0, 0, 0, 0])
sok_l.sendto(bytes(sbytes), (addr_l, port))
sok_r.sendto(bytes(sbytes), (addr_r, port))
time.sleep(0.8)
sbytes = hand_ctrl_pack([0, 0, 0, 0, 1900, 1900])
sok_l.sendto(bytes(sbytes), (addr_l, port))
sok_r.sendto(bytes(sbytes), (addr_r, port))
time.sleep(0.8)
# sbytes = pnd_hand.hand_ctrl_pack([0,0,0,0,0,0])
# sok_l.sendto(bytes(sbytes),(addr_l,port))
# sok_r.sendto(bytes(sbytes),(addr_r,port))
# time.sleep(0.5)
sok_l = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sok_l.settimeout(1)
sok_r = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sok_r.settimeout(1)
# change_id(2,4)
# ctrl()
# get_id()
while True:
ctrl()
# for i in range(6):
# ctrl_one(i+1)