ArtusAPI 1.1.1__tar.gz → 1.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/artus_api.py +72 -15
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/commands/commands.py +21 -1
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/communication/UART/uart.py +18 -1
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/communication/WiFi/wifi_server.py +12 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/communication/communication.py +45 -27
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/firmware_update/firmware_updater.py +55 -41
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/firmware_update/run_full_firmware_update.py +12 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/robot/artus_lite/artus_lite.py +15 -11
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/robot/robot.py +9 -12
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI.egg-info/PKG-INFO +1 -1
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI.egg-info/SOURCES.txt +1 -0
- ArtusAPI-1.1.2/ArtusAPI.egg-info/requires.txt +5 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/PKG-INFO +1 -1
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/README.md +79 -19
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/setup.py +9 -2
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/__init__.py +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/commands/__init__.py +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/communication/UART/__init__.py +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/communication/WiFi/__init__.py +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/communication/__init__.py +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/firmware_update/__init__.py +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/robot/__init__.py +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/robot/artus_lite/__init__.py +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/robot/artus_lite/artus_lite_left.py +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI/robot/artus_lite/artus_lite_right.py +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI.egg-info/dependency_links.txt +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/ArtusAPI.egg-info/top_level.txt +0 -0
- {ArtusAPI-1.1.1 → ArtusAPI-1.1.2}/setup.cfg +0 -0
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sarcomere Dynamics Software License Notice
|
|
3
|
+
------------------------------------------
|
|
4
|
+
This software is developed by Sarcomere Dynamics Inc. for use with the ARTUS family of robotic products,
|
|
5
|
+
including ARTUS Lite, ARTUS+, ARTUS Dex, and Hyperion.
|
|
1
6
|
|
|
7
|
+
Copyright (c) 2023–2025, Sarcomere Dynamics Inc. All rights reserved.
|
|
8
|
+
|
|
9
|
+
Licensed under the Sarcomere Dynamics Software License.
|
|
10
|
+
See the LICENSE file in the repository for full details.
|
|
11
|
+
"""
|
|
2
12
|
import sys
|
|
3
13
|
import logging
|
|
4
14
|
from pathlib import Path
|
|
@@ -79,7 +89,6 @@ class ArtusAPI:
|
|
|
79
89
|
# send wake command with it
|
|
80
90
|
if not self.awake:
|
|
81
91
|
self.wake_up()
|
|
82
|
-
self.awake = True
|
|
83
92
|
return
|
|
84
93
|
|
|
85
94
|
def disconnect(self):
|
|
@@ -102,6 +111,17 @@ class ArtusAPI:
|
|
|
102
111
|
self.logger.info(f'Finished calibration')
|
|
103
112
|
else:
|
|
104
113
|
self.logger.warning(f'Error in calibration')
|
|
114
|
+
self.awake = True
|
|
115
|
+
|
|
116
|
+
# get current position of the hand and set the last target positions to this value
|
|
117
|
+
# while True:
|
|
118
|
+
# joint_angles = self.get_joint_angles()
|
|
119
|
+
# time.sleep(1)
|
|
120
|
+
# if joint_angles is not None:
|
|
121
|
+
# break
|
|
122
|
+
|
|
123
|
+
# for joint,data in self._robot_handler.robot.hand_joints.items():
|
|
124
|
+
# data.target_angle = data.feedback_angle
|
|
105
125
|
|
|
106
126
|
def sleep(self):
|
|
107
127
|
"""
|
|
@@ -109,18 +129,22 @@ class ArtusAPI:
|
|
|
109
129
|
"""
|
|
110
130
|
robot_sleep_command = self._command_handler.get_sleep_command()
|
|
111
131
|
return self._communication_handler.send_data(robot_sleep_command)
|
|
112
|
-
|
|
132
|
+
|
|
133
|
+
def calibrate(self,joint=0,calibration_type=0):
|
|
113
134
|
"""
|
|
114
135
|
Calibrate the Artus Hand
|
|
136
|
+
:joint: joint to calibrate, 0 for all joints
|
|
115
137
|
"""
|
|
116
138
|
if not self.awake:
|
|
117
139
|
self.logger.warning(f'Hand not ready, send `wake_up` command')
|
|
118
140
|
return
|
|
119
141
|
robot_calibrate_command = self._command_handler.get_calibration_command()
|
|
142
|
+
robot_calibrate_command[1] = joint
|
|
143
|
+
robot_calibrate_command[2] = calibration_type
|
|
120
144
|
self._communication_handler.send_data(robot_calibrate_command)
|
|
121
145
|
|
|
122
146
|
# wait for data back
|
|
123
|
-
if self._communication_handler.wait_for_ack():
|
|
147
|
+
if self._communication_handler.wait_for_ack(visual=True):
|
|
124
148
|
self.logger.info(f'Finished calibration')
|
|
125
149
|
else:
|
|
126
150
|
self.logger.warning(f'Error in calibration')
|
|
@@ -142,6 +166,16 @@ class ArtusAPI:
|
|
|
142
166
|
return False
|
|
143
167
|
return self._communication_handler.send_data(robot_set_joint_angles_command)
|
|
144
168
|
|
|
169
|
+
def set_zero_manual_calibration(self):
|
|
170
|
+
"""
|
|
171
|
+
Set the zero position of the joints used in internal calibration
|
|
172
|
+
"""
|
|
173
|
+
if not self.awake:
|
|
174
|
+
self.logger.warning(f'Hand not ready, send `wake_up` command')
|
|
175
|
+
return
|
|
176
|
+
robot_set_zero_command = self._command_handler.get_set_zero_command()
|
|
177
|
+
self._communication_handler.send_data(robot_set_zero_command)
|
|
178
|
+
|
|
145
179
|
def set_home_position(self):
|
|
146
180
|
"""
|
|
147
181
|
sends the joints to home positions (0) which opens the Artus Hand
|
|
@@ -193,8 +227,14 @@ class ArtusAPI:
|
|
|
193
227
|
|
|
194
228
|
feedback_command = self._receive_feedback()
|
|
195
229
|
joint_angles = self._robot_handler.get_joint_angles(feedback_command)
|
|
230
|
+
if joint_angles is None:
|
|
231
|
+
return None
|
|
232
|
+
# separate joint angles into 3 lists
|
|
233
|
+
angles = joint_angles[1][0:16]
|
|
234
|
+
velocities = joint_angles[1][16:32]
|
|
235
|
+
temperatures = joint_angles[1][32:48]
|
|
196
236
|
# print(joint_angles)
|
|
197
|
-
return joint_angles
|
|
237
|
+
return joint_angles[0],angles,velocities,temperatures
|
|
198
238
|
|
|
199
239
|
# robot feedback stream
|
|
200
240
|
def get_streamed_joint_angles(self):
|
|
@@ -235,7 +275,8 @@ class ArtusAPI:
|
|
|
235
275
|
self._firmware_updater.file_location = 'not empty'
|
|
236
276
|
upload = False
|
|
237
277
|
else:
|
|
238
|
-
if file_location is None:
|
|
278
|
+
if file_location is None:
|
|
279
|
+
file_location = input('Please enter binfile absolute path: ')
|
|
239
280
|
self._firmware_updater.file_location = file_location
|
|
240
281
|
|
|
241
282
|
fw_size = self._firmware_updater.get_bin_file_info()
|
|
@@ -244,18 +285,34 @@ class ArtusAPI:
|
|
|
244
285
|
if drivers_to_flash == None:
|
|
245
286
|
drivers_to_flash = int(input(f'Which drivers would you like to flash? \n0: All Actuators \n1-8 Specific Actuator \n9: Peripheral Controller \nEnter: '))
|
|
246
287
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
288
|
+
if drivers_to_flash == 0:
|
|
289
|
+
|
|
290
|
+
for i in range(1,9):
|
|
291
|
+
print(f'Flashing driver {i}')
|
|
292
|
+
time.sleep(1)
|
|
293
|
+
self.update_firmware_single_driver(i,fw_size,upload)
|
|
294
|
+
if upload:
|
|
295
|
+
self._firmware_updater.update_firmware(fw_size)
|
|
296
|
+
upload = False
|
|
297
|
+
|
|
298
|
+
if not self._communication_handler.wait_for_ack(25,True):
|
|
299
|
+
print(f'Error flashing driver {i}')
|
|
300
|
+
return
|
|
301
|
+
else:
|
|
302
|
+
self.update_firmware_single_driver(drivers_to_flash,fw_size,upload)
|
|
303
|
+
if upload:
|
|
304
|
+
self._firmware_updater.update_firmware(fw_size)
|
|
305
|
+
|
|
306
|
+
print(f'Flashing driver {drivers_to_flash}')
|
|
307
|
+
self._communication_handler.wait_for_ack(25,True)
|
|
257
308
|
|
|
309
|
+
print(f'Power Cycle the device to take effect')
|
|
258
310
|
|
|
311
|
+
def update_firmware_single_driver(self,actuator_number,fw_size,upload):
|
|
312
|
+
"""
|
|
313
|
+
update firmware for a single driver
|
|
314
|
+
"""
|
|
315
|
+
self._communication_handler.send_data(self._command_handler.get_firmware_command(fw_size,upload,actuator_number))
|
|
259
316
|
|
|
260
317
|
def request_joint_and_motor(self):
|
|
261
318
|
"""
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sarcomere Dynamics Software License Notice
|
|
3
|
+
------------------------------------------
|
|
4
|
+
This software is developed by Sarcomere Dynamics Inc. for use with the ARTUS family of robotic products,
|
|
5
|
+
including ARTUS Lite, ARTUS+, ARTUS Dex, and Hyperion.
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2023–2025, Sarcomere Dynamics Inc. All rights reserved.
|
|
8
|
+
|
|
9
|
+
Licensed under the Sarcomere Dynamics Software License.
|
|
10
|
+
See the LICENSE file in the repository for full details.
|
|
11
|
+
"""
|
|
12
|
+
|
|
1
13
|
import os
|
|
2
14
|
import json
|
|
3
15
|
import time
|
|
@@ -14,6 +26,7 @@ class Commands:
|
|
|
14
26
|
target_command = 0x66,
|
|
15
27
|
get_feedback_command = 0x68,
|
|
16
28
|
update_param_command = 0x44,
|
|
29
|
+
set_zero_command = 0x15,
|
|
17
30
|
|
|
18
31
|
save_grasp_onboard_command = 0xC8,
|
|
19
32
|
return_grasps_command = 0xD2,
|
|
@@ -34,7 +47,8 @@ class Commands:
|
|
|
34
47
|
'return_grasps_command': return_grasps_command,
|
|
35
48
|
'execute_grasp_command': execute_grasp_command,
|
|
36
49
|
'update_param_command' : update_param_command,
|
|
37
|
-
'wipe_sd_command' : wipe_sd_command
|
|
50
|
+
'wipe_sd_command' : wipe_sd_command,
|
|
51
|
+
'set_zero_command' : set_zero_command
|
|
38
52
|
}
|
|
39
53
|
self.reset_on_start = reset_on_start
|
|
40
54
|
|
|
@@ -68,6 +82,11 @@ class Commands:
|
|
|
68
82
|
command_list.insert(0,self.commands['target_command'])
|
|
69
83
|
|
|
70
84
|
return command_list
|
|
85
|
+
|
|
86
|
+
def get_set_zero_command(self):
|
|
87
|
+
command_list = [0]*32
|
|
88
|
+
command_list.insert(0,self.commands['set_zero_command'])
|
|
89
|
+
return command_list
|
|
71
90
|
|
|
72
91
|
def get_firmware_command(self,fw_size,upload,drivers):
|
|
73
92
|
command_list = [0]*32
|
|
@@ -83,6 +102,7 @@ class Commands:
|
|
|
83
102
|
def get_calibration_command(self):
|
|
84
103
|
command_list = [0]*32
|
|
85
104
|
command_list.insert(0,self.commands['calibrate_command'])
|
|
105
|
+
|
|
86
106
|
return command_list
|
|
87
107
|
|
|
88
108
|
def get_sleep_command(self):
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sarcomere Dynamics Software License Notice
|
|
3
|
+
------------------------------------------
|
|
4
|
+
This software is developed by Sarcomere Dynamics Inc. for use with the ARTUS family of robotic products,
|
|
5
|
+
including ARTUS Lite, ARTUS+, ARTUS Dex, and Hyperion.
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2023–2025, Sarcomere Dynamics Inc. All rights reserved.
|
|
8
|
+
|
|
9
|
+
Licensed under the Sarcomere Dynamics Software License.
|
|
10
|
+
See the LICENSE file in the repository for full details.
|
|
11
|
+
"""
|
|
12
|
+
|
|
1
13
|
import serial
|
|
2
14
|
import logging
|
|
3
15
|
import time
|
|
16
|
+
from tqdm import tqdm
|
|
17
|
+
|
|
4
18
|
|
|
5
19
|
class UART:
|
|
6
20
|
def __init__(self,
|
|
@@ -35,8 +49,11 @@ class UART:
|
|
|
35
49
|
self.esp32.flush()
|
|
36
50
|
msg_bytes = self.esp32.read_all()
|
|
37
51
|
except Exception as e:
|
|
38
|
-
self.logger.error(f'Error opening port {self.port}')
|
|
39
52
|
self.logger.error(e)
|
|
53
|
+
self.logger.error(f'Error opening port {self.port} ......... QUITTING ........')
|
|
54
|
+
for i in range(25):
|
|
55
|
+
time.sleep(0.1)
|
|
56
|
+
quit()
|
|
40
57
|
|
|
41
58
|
def send(self, data:bytearray):
|
|
42
59
|
# print(data)
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sarcomere Dynamics Software License Notice
|
|
3
|
+
------------------------------------------
|
|
4
|
+
This software is developed by Sarcomere Dynamics Inc. for use with the ARTUS family of robotic products,
|
|
5
|
+
including ARTUS Lite, ARTUS+, ARTUS Dex, and Hyperion.
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2023–2025, Sarcomere Dynamics Inc. All rights reserved.
|
|
8
|
+
|
|
9
|
+
Licensed under the Sarcomere Dynamics Software License.
|
|
10
|
+
See the LICENSE file in the repository for full details.
|
|
11
|
+
"""
|
|
12
|
+
|
|
1
13
|
import socket
|
|
2
14
|
import time
|
|
3
15
|
import os
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sarcomere Dynamics Software License Notice
|
|
3
|
+
------------------------------------------
|
|
4
|
+
This software is developed by Sarcomere Dynamics Inc. for use with the ARTUS family of robotic products,
|
|
5
|
+
including ARTUS Lite, ARTUS+, ARTUS Dex, and Hyperion.
|
|
1
6
|
|
|
2
|
-
|
|
3
|
-
import time
|
|
4
|
-
|
|
7
|
+
Copyright (c) 2023–2025, Sarcomere Dynamics Inc. All rights reserved.
|
|
5
8
|
|
|
9
|
+
Licensed under the Sarcomere Dynamics Software License.
|
|
10
|
+
See the LICENSE file in the repository for full details.
|
|
11
|
+
"""
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# current_file_path = Path(__file__).resolve()
|
|
11
|
-
# # Add the desired path to the system path
|
|
12
|
-
# desired_path = current_file_path.parent.parent.parent
|
|
13
|
-
# sys.path.append(str(desired_path))
|
|
14
|
-
# print(desired_path)
|
|
13
|
+
import logging
|
|
14
|
+
import time
|
|
15
|
+
from tqdm import tqdm
|
|
15
16
|
|
|
16
|
-
# # Communication methodss
|
|
17
|
-
# from ArtusAPI.communication.WiFi.wifi_server import WiFiServer
|
|
18
|
-
# from ArtusAPI.communication.UART.uart import UART
|
|
19
|
-
# from ArtusAPI.ArtusAPI.communication.can import CAN
|
|
20
17
|
|
|
21
18
|
from .UART.uart import UART
|
|
22
19
|
from .WiFi.wifi_server import WiFiServer
|
|
@@ -87,9 +84,12 @@ class Communication:
|
|
|
87
84
|
def _byte_to_list_decode(self,package:bytearray) -> tuple:
|
|
88
85
|
recv_data = []
|
|
89
86
|
i = 0
|
|
87
|
+
# BYTE 0 : ACK
|
|
88
|
+
# BYTE 1 - 16 : 8 BIT POSITION
|
|
89
|
+
# BYTE 17 - 49 : 16 BIT POSITION
|
|
90
90
|
while i < 65:
|
|
91
|
-
if 17 <= i <=
|
|
92
|
-
recv_data.append(
|
|
91
|
+
if 17 <= i <= 47: # 16 bit signed integer to int
|
|
92
|
+
recv_data.append(package[i].from_bytes(package[i:i+2], byteorder='big', signed=True))
|
|
93
93
|
i+=2
|
|
94
94
|
else: # 8 bit signed integer to int
|
|
95
95
|
recv_data.append(package[i].from_bytes(package[i:i+1],byteorder='little',signed=True))
|
|
@@ -99,6 +99,8 @@ class Communication:
|
|
|
99
99
|
ack = recv_data[0]
|
|
100
100
|
del recv_data[0] # delete 0th value from array
|
|
101
101
|
|
|
102
|
+
# print(f'recv_data = {recv_data}')
|
|
103
|
+
|
|
102
104
|
return ack,recv_data
|
|
103
105
|
|
|
104
106
|
|
|
@@ -113,7 +115,7 @@ class Communication:
|
|
|
113
115
|
self.logger.error("unable to connect to Robot")
|
|
114
116
|
print(e)
|
|
115
117
|
|
|
116
|
-
def send_data(self, message:list,no_debug=
|
|
118
|
+
def send_data(self, message:list,no_debug=0):
|
|
117
119
|
"""
|
|
118
120
|
send message
|
|
119
121
|
"""
|
|
@@ -155,15 +157,31 @@ class Communication:
|
|
|
155
157
|
self.communicator.close()
|
|
156
158
|
|
|
157
159
|
|
|
158
|
-
def wait_for_ack(self):
|
|
160
|
+
def wait_for_ack(self,timeout=144,visual=False):
|
|
159
161
|
start_time = time.perf_counter()
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
if visual:
|
|
163
|
+
with tqdm(total=timeout, unit="s", desc="Waiting for ack") as pbar:
|
|
164
|
+
while 1:
|
|
165
|
+
tmp,rc_csum = self.receive_data()
|
|
166
|
+
if tmp is not None:
|
|
167
|
+
self.logger.info(f'ack received in {time.perf_counter() - start_time} seconds')
|
|
168
|
+
return 1
|
|
169
|
+
time.sleep(0.01)
|
|
170
|
+
if time.perf_counter() - start_time > timeout:
|
|
171
|
+
pbar.close()
|
|
172
|
+
self.logger.error('timeout error\r\ntimeout error\r\ntimeout error')
|
|
173
|
+
return 0
|
|
174
|
+
pbar.update(0.01)
|
|
175
|
+
else:
|
|
176
|
+
while 1:
|
|
177
|
+
tmp,rc_csum = self.receive_data()
|
|
178
|
+
if tmp is not None:
|
|
179
|
+
self.logger.info(f'ack received in {time.perf_counter() - start_time} seconds')
|
|
180
|
+
return 1
|
|
181
|
+
if time.perf_counter() - start_time > timeout:
|
|
182
|
+
self.logger.error('timeout error\r\ntimeout error\r\ntimeout error')
|
|
183
|
+
return 0
|
|
184
|
+
time.sleep(0.01)
|
|
167
185
|
|
|
168
186
|
##################################################################
|
|
169
187
|
############################## TESTS #############################
|
|
@@ -195,4 +213,4 @@ if __name__ == "__main__":
|
|
|
195
213
|
|
|
196
214
|
|
|
197
215
|
|
|
198
|
-
|
|
216
|
+
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sarcomere Dynamics Software License Notice
|
|
3
|
+
------------------------------------------
|
|
4
|
+
This software is developed by Sarcomere Dynamics Inc. for use with the ARTUS family of robotic products,
|
|
5
|
+
including ARTUS Lite, ARTUS+, ARTUS Dex, and Hyperion.
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2023–2025, Sarcomere Dynamics Inc. All rights reserved.
|
|
8
|
+
|
|
9
|
+
Licensed under the Sarcomere Dynamics Software License.
|
|
10
|
+
See the LICENSE file in the repository for full details.
|
|
11
|
+
"""
|
|
1
12
|
import os
|
|
2
13
|
import time
|
|
3
14
|
import logging
|
|
4
15
|
import platform
|
|
5
16
|
import subprocess
|
|
17
|
+
from tqdm import tqdm
|
|
6
18
|
|
|
7
19
|
BYTES_CHUNK = 32
|
|
8
20
|
UPLOAD_CHUNKS_COMMAND = 0x30
|
|
@@ -38,7 +50,7 @@ class FirmwareUpdater:
|
|
|
38
50
|
|
|
39
51
|
def update_firmware(self,file_size):
|
|
40
52
|
|
|
41
|
-
time.sleep(0.
|
|
53
|
+
time.sleep(0.02)
|
|
42
54
|
|
|
43
55
|
# wait for ACK back before sending data
|
|
44
56
|
self.wait_for_ack()
|
|
@@ -56,46 +68,48 @@ class FirmwareUpdater:
|
|
|
56
68
|
# init counter
|
|
57
69
|
i = 0
|
|
58
70
|
ret = False
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if i+BYTES_CHUNK > file_size:
|
|
63
|
-
chunk = list(file_data[i:])
|
|
64
|
-
while len(chunk) < BYTES_CHUNK: # Always make sure 32B of valid data
|
|
65
|
-
chunk.append(0xFF)
|
|
66
|
-
|
|
67
|
-
else:
|
|
68
|
-
chunk = list(file_data[i:i+BYTES_CHUNK])
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
# checksum last value
|
|
72
|
-
csum = self.calc_check_sum(chunk)
|
|
73
|
-
# set 33rd byte as checksum value
|
|
74
|
-
chunk.append(csum)
|
|
75
|
-
|
|
76
|
-
# print(f'{chunk} {len(chunk)}')
|
|
77
|
-
|
|
78
|
-
# send data
|
|
79
|
-
self._communication_handler.send_data(chunk,1)
|
|
80
|
-
|
|
81
|
-
# sleep
|
|
82
|
-
time.sleep(0.008)
|
|
83
|
-
|
|
84
|
-
# print([hex(x) for x in chunk])
|
|
71
|
+
with tqdm(total=len(file_data), unit="B", unit_scale=True, desc="Uploading") as pbar:
|
|
72
|
+
|
|
73
|
+
while i < len(file_data):
|
|
85
74
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
75
|
+
# if not enough file data for 32B, fill with 0xFFs
|
|
76
|
+
if i+BYTES_CHUNK > file_size:
|
|
77
|
+
chunk = list(file_data[i:])
|
|
78
|
+
while len(chunk) < BYTES_CHUNK: # Always make sure 32B of valid data
|
|
79
|
+
chunk.append(0xFF)
|
|
80
|
+
|
|
81
|
+
else:
|
|
82
|
+
chunk = list(file_data[i:i+BYTES_CHUNK])
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# checksum last value
|
|
86
|
+
csum = self.calc_check_sum(chunk)
|
|
87
|
+
# set 33rd byte as checksum value
|
|
88
|
+
chunk.append(csum)
|
|
89
|
+
|
|
90
|
+
# print(f'{chunk} {len(chunk)}')
|
|
91
|
+
|
|
92
|
+
# send data
|
|
93
|
+
self._communication_handler.send_data(chunk,1)
|
|
94
|
+
|
|
95
|
+
# sleep
|
|
96
|
+
time.sleep(0.008)
|
|
97
|
+
|
|
98
|
+
# print([hex(x) for x in chunk])
|
|
99
|
+
|
|
100
|
+
# wait for ack
|
|
101
|
+
ret = self.wait_for_ack()
|
|
102
|
+
# debug print
|
|
103
|
+
# print(f'CHUNKS LEFT {chunks_required} {csum}')
|
|
104
|
+
|
|
105
|
+
if ret:
|
|
106
|
+
chunks_required -= 1
|
|
107
|
+
i += BYTES_CHUNK
|
|
108
|
+
csum = 0
|
|
109
|
+
ret = 0
|
|
110
|
+
pbar.update(BYTES_CHUNK)
|
|
97
111
|
|
|
98
|
-
|
|
112
|
+
time.sleep(0.01)
|
|
99
113
|
|
|
100
114
|
print(f'Firmware update in progress..')
|
|
101
115
|
|
|
@@ -112,12 +126,12 @@ class FirmwareUpdater:
|
|
|
112
126
|
if rc_csum[0] == 1:
|
|
113
127
|
return True
|
|
114
128
|
else:
|
|
115
|
-
self.logger.
|
|
129
|
+
self.logger.warning(f'firmware flash checksum error')
|
|
116
130
|
return False
|
|
117
131
|
elif tmp == 9:
|
|
118
132
|
self.logger.error(f'firmware flash failed')
|
|
119
133
|
return False
|
|
120
|
-
time.sleep(0.
|
|
134
|
+
time.sleep(0.02)
|
|
121
135
|
|
|
122
136
|
|
|
123
137
|
def test_firmware_updater():
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sarcomere Dynamics Software License Notice
|
|
3
|
+
------------------------------------------
|
|
4
|
+
This software is developed by Sarcomere Dynamics Inc. for use with the ARTUS family of robotic products,
|
|
5
|
+
including ARTUS Lite, ARTUS+, ARTUS Dex, and Hyperion.
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2023–2025, Sarcomere Dynamics Inc. All rights reserved.
|
|
8
|
+
|
|
9
|
+
Licensed under the Sarcomere Dynamics Software License.
|
|
10
|
+
See the LICENSE file in the repository for full details.
|
|
11
|
+
"""
|
|
12
|
+
|
|
1
13
|
# ------------------------------------------------------------------------------
|
|
2
14
|
# ---------------------------- Import Libraries --------------------------------
|
|
3
15
|
# ------------------------------------------------------------------------------
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
class ArtusLite:
|
|
3
3
|
|
|
4
4
|
def __init__(self,
|
|
5
|
-
joint_max_angles=[
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
joint_min_angles=[-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
5
|
+
joint_max_angles=[40, 90, 90, 90, # thumb
|
|
6
|
+
17, 90, 90, # index
|
|
7
|
+
17, 90, 90, # middle
|
|
8
|
+
17, 90, 90, # ring
|
|
9
|
+
17, 90, 90], # pinky
|
|
10
|
+
joint_min_angles=[-40, 0, 0, 0, # thumb
|
|
11
|
+
-17, 0, 0, # index
|
|
12
|
+
-17, 0, 0, # middle
|
|
13
|
+
-17, 0, 0, # ring
|
|
14
|
+
-17, 0, 0], # pinky
|
|
15
15
|
|
|
16
16
|
joint_default_angles=[0, 0, 0, 0, # thumb
|
|
17
17
|
0, 0, 0, # index
|
|
@@ -172,7 +172,7 @@ class ArtusLite:
|
|
|
172
172
|
# create new target dictionary with default velocity and default angle
|
|
173
173
|
|
|
174
174
|
joint_angles = {key: {'index': value.index, 'target_angle':value.default_angle,'velocity':self.joint_velocities[value.index]} for key,value in self.hand_joints.items()}
|
|
175
|
-
print(self.hand_joints['thumb_spread'])
|
|
175
|
+
# print(self.hand_joints['thumb_spread'])
|
|
176
176
|
return self.set_joint_angles(joint_angles)
|
|
177
177
|
|
|
178
178
|
def get_joint_angles(self, feedback_package:list):
|
|
@@ -187,6 +187,10 @@ class ArtusLite:
|
|
|
187
187
|
joint_data.feedback_current = feedback_package[1][joint_data.index+15]
|
|
188
188
|
joint_data.feedback_temperature = feedback_package[1][joint_data.index+31]
|
|
189
189
|
|
|
190
|
+
if joint_data.index in [1,5,8,11,14] and joint_data.feedback_angle < 0:
|
|
191
|
+
joint_data.feedback_angle = -joint_data.feedback_angle
|
|
192
|
+
feedback_package[1][joint_data.index] = -feedback_package[1][joint_data.index]
|
|
193
|
+
|
|
190
194
|
return feedback_package
|
|
191
195
|
except TypeError:
|
|
192
196
|
# print(f'feedback_package is None')
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sarcomere Dynamics Software License Notice
|
|
3
|
+
------------------------------------------
|
|
4
|
+
This software is developed by Sarcomere Dynamics Inc. for use with the ARTUS family of robotic products,
|
|
5
|
+
including ARTUS Lite, ARTUS+, ARTUS Dex, and Hyperion.
|
|
1
6
|
|
|
7
|
+
Copyright (c) 2023–2025, Sarcomere Dynamics Inc. All rights reserved.
|
|
2
8
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
# current_file_path = Path(__file__).resolve()
|
|
7
|
-
# # Add the desired path to the system path
|
|
8
|
-
# desired_path = current_file_path.parent.parent.parent.parent
|
|
9
|
-
# sys.path.append(str(desired_path))
|
|
10
|
-
# print(desired_path)
|
|
11
|
-
|
|
12
|
-
# # Artus Lite Robots
|
|
13
|
-
# from ArtusAPI.robot.artus_lite.artus_lite_left import ArtusLite_LeftHand
|
|
14
|
-
# from ArtusAPI.robot.artus_lite.artus_lite_right import ArtusLite_RightHand
|
|
9
|
+
Licensed under the Sarcomere Dynamics Software License.
|
|
10
|
+
See the LICENSE file in the repository for full details.
|
|
11
|
+
"""
|
|
15
12
|
|
|
16
13
|
from .artus_lite.artus_lite_left import ArtusLite_LeftHand
|
|
17
14
|
from .artus_lite.artus_lite_right import ArtusLite_RightHand
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
This repository contains a Python API for controlling the ARTUS robotic hands by Sarcomere Dynamics Inc.
|
|
6
6
|
|
|
7
|
-
Please contact the team if there are any issues that arise through the use of the API.
|
|
7
|
+
Please contact the team if there are any issues that arise through the use of the API. See [Software License](/Software%20License_24March%202025.pdf).
|
|
8
8
|
|
|
9
9
|
## Introduction
|
|
10
|
+
>[!IMPORTANT]
|
|
10
11
|
__Please read through the entire README and the _User Manual_ before using the ARTUS hand__
|
|
11
12
|
|
|
12
13
|
The user manual contains in-depth operational and troubleshooting guidelines for the device.
|
|
@@ -22,6 +23,7 @@ Below is a list of the ARTUS hands that are compatible with the API:
|
|
|
22
23
|
### VERY IMPORTANT
|
|
23
24
|
* [Requirements](#requirements)
|
|
24
25
|
* [Normal Startup Procedure](#normal-startup-procedure)
|
|
26
|
+
* [Normal Shutdown Procedure](#normal-shutdown-procedure)
|
|
25
27
|
|
|
26
28
|
## Table of Contents
|
|
27
29
|
* [Getting Started](#getting-started)
|
|
@@ -46,34 +48,42 @@ Below is a list of the ARTUS hands that are compatible with the API:
|
|
|
46
48
|
* [Teleoperation Considerations](#teleoperation-considerations)
|
|
47
49
|
* [Directory Structure](#directory-structure)
|
|
48
50
|
|
|
49
|
-
## Getting Started
|
|
50
|
-
###
|
|
51
|
-
[
|
|
51
|
+
## 1. Getting Started
|
|
52
|
+
### Sections
|
|
53
|
+
* [1.1 Requirements](#11-requirements)
|
|
54
|
+
* [1.2 Python Requirements](#12-python-requirements)
|
|
55
|
+
* [1.2.1 Use-as-Released](#121-use-as-released)
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
Requires Python version >= 3.10 installed on the host system. Please visit the [Python website](https://www.python.org/downloads/) to install Python.
|
|
57
|
+
The first step to working with the Artus Lite is to connect to the hand, and achieve joint control. It is highly recommended that this should be done for the first time via the [example program provided](#running-examplepy). In preparation for this example, please follow the subsequent sections step by step, outlining all requirements for working with both the initial example program, as well as the API as a whole.
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
### 1.1 Requirements
|
|
60
|
+
Below is a list of Requirements for the Artus to be compatible
|
|
61
|
+
1. Python v3.10+ - Requires Python version >= 3.10 installed on the host system. Please visit the [Python website](https://www.python.org/downloads/) to install Python.
|
|
62
|
+
2. FTDI USB Driver (Windows Only) - Necessary for the Artus Lite to be recognized as a USB device once it is connected over USBC, go to [FTDI Driver Download](https://ftdichip.com/drivers/vcp-drivers/) to install the virtual COM port driver.
|
|
58
63
|
|
|
59
|
-
###
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
pip install psutil
|
|
63
|
-
pip install pyserial
|
|
64
|
-
pip install ArtusAPI
|
|
65
|
-
```
|
|
64
|
+
### 1.2 Python Requirements
|
|
65
|
+
There are two ways to install the API's python dependencies. The manner by which they are installed depend on your intended usage of the API and/or its source code.
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
Take a look at [these steps on creating and using a virtual environment](https://www.freecodecamp.org/news/how-to-setup-virtual-environments-in-python/)
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
#### 1.2.1 Use Cloned Repository
|
|
70
|
+
If you plan to eventually make changes to the source code, you will need to clone the GitHub *SARCOMERE_DYNAMICS_RESOURCES* repository. Once cloned, you can utilize the *requirements.txt* included in the package to install the dependencies. With a terminal open, execute the following command:
|
|
71
|
+
```
|
|
72
|
+
pip install -r path\to\requirements.txt
|
|
73
|
+
```
|
|
74
|
+
Alternatively, if your terminal is open in the cloned repo's folder, you can run the following simpler version of the above command.
|
|
75
|
+
```
|
|
70
76
|
pip install -r requirements.txt
|
|
71
77
|
```
|
|
72
78
|
|
|
73
79
|
## Usage
|
|
74
80
|
|
|
75
81
|
### Running example.py
|
|
76
|
-
See [General Example README](/examples/general_example/README.md)
|
|
82
|
+
See the [General Example README to complete this task](/examples/general_example/README.md)
|
|
83
|
+
|
|
84
|
+
#### Video Introduction
|
|
85
|
+
[](https://www.youtube.com/watch?v=30BkuA0EkP4)
|
|
86
|
+
|
|
77
87
|
|
|
78
88
|
### Creating an ArtusAPI Class Object
|
|
79
89
|
Below are some examples of instantiating the ArtusAPI class to control a single hand. Below is a description of the parameters and what they mean.
|
|
@@ -108,7 +118,17 @@ Second, the `ArtusAPI.wake_up()` function must be run to allow the hand to load
|
|
|
108
118
|
|
|
109
119
|
Once these two steps are complete, optionally, you can run `ArtusAPI.calibrate()` to calibrate the finger joints. Otherwise, the system is now ready to start sending and receiving data!
|
|
110
120
|
|
|
111
|
-
|
|
121
|
+
>[!NOTE]
|
|
122
|
+
>If running version v1.0.1, `wake_up` is called inside the `connect()` function_
|
|
123
|
+
|
|
124
|
+
### Normal Shutdown Procedure
|
|
125
|
+
When getting ready to power off the device please do the following:
|
|
126
|
+
* Send the zero position to all the joints so that the hand is opened
|
|
127
|
+
* Once the hand is in an open position, send the `artus.sleep()` command to save parameters to the SD Card.
|
|
128
|
+
* Once the LED turns yellow, then the device can be powered off.
|
|
129
|
+
|
|
130
|
+
>[!NOTE]
|
|
131
|
+
>This is different than the mk8 where the SD Card would save periodically. Now, saving to SD Card is more intentional.
|
|
112
132
|
|
|
113
133
|
## Interacting with the API
|
|
114
134
|
To get the most out of the Artus hands, the functions that will likely be most interacted with are `set_joint_angles(self, joint_angles:dict)` and `get_joint_angles(self)`. The `set_joint_angles` function allows the user to set 16 independent joint values with a desired velocity/force value in the form of a dictionary. See the [grasp_close file](data/hand_poses/grasp_close.json) for an example of a full 16 joint dictionary for the Artus Lite. See the [Artus Lite README](ArtusAPI/robot/artus_lite/README.md) for joint mapping.
|
|
@@ -207,6 +227,46 @@ artus_liteLeft = Artus3DAPI(target_ssid='Artus3DLH',port='COM5',communication_me
|
|
|
207
227
|
│ ├── artus_api.py # API Core
|
|
208
228
|
```
|
|
209
229
|
|
|
230
|
+
## Artus Lite Control Examples Setup
|
|
231
|
+
|
|
232
|
+
### 1. GUI Setup
|
|
233
|
+
Please check the [Artus GUI](https://github.com/Sarcomere-Dynamics/Sarcomere_Dynamics_Resources/tree/main/examples/Control/ArtusLiteControl/GUIControl) for a GUI setup to control the Artus Lite hand.
|
|
234
|
+
|
|
235
|
+
Also, check the video below for a demonstration of the GUI setup.
|
|
236
|
+
|
|
237
|
+
<div align="center">
|
|
238
|
+
<a href="https://www.youtube.com/watch?v=l_Sl6bAeGuc">
|
|
239
|
+
<img src="./data/images/gui.png" alt="Watch the video" width="200" />
|
|
240
|
+
</a>
|
|
241
|
+
</div>
|
|
242
|
+
|
|
243
|
+
### 2. ROS2 Node Control Setup
|
|
244
|
+
Please check the [Artus ROS2 Node](https://github.com/Sarcomere-Dynamics/Sarcomere_Dynamics_Resources/tree/main/ros2/artuslite_ws) for a ROS2 node setup to control the Artus Lite hand.
|
|
245
|
+
|
|
246
|
+
Also, check the video below for a demonstration of the ROS2 node setup.
|
|
247
|
+
|
|
248
|
+
<div align="center">
|
|
249
|
+
<a href="https://www.youtube.com/watch?v=GHyG1NuuRv4">
|
|
250
|
+
Watch the video
|
|
251
|
+
</a>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
### 3. Manus Glove Setup
|
|
257
|
+
|
|
258
|
+
Please check the [Manus Glove](https://github.com/Sarcomere-Dynamics/Sarcomere_Dynamics_Resources/tree/main/examples/Control/ArtusLiteControl/ManusGloveControl) for a Manus Glove setup to control the Artus Lite hand.
|
|
259
|
+
|
|
260
|
+
Also, check the video below for a demonstration of the Manus Glove setup.
|
|
261
|
+
|
|
262
|
+
<div align="center">
|
|
263
|
+
<a href="https://www.youtube.com/watch?v=SPXJlxMaDVQ&list=PLNUrV_GAAyA8HNBAvwBlsmIqoWiJJLRwW&index=2">
|
|
264
|
+
Watch the video
|
|
265
|
+
</a>
|
|
266
|
+
</div>
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
210
270
|
## Revision Control
|
|
211
271
|
| Date | Revision | Description | Pip Release |
|
|
212
272
|
| :---: | :------: | :---------: | :----------: |
|
|
@@ -2,11 +2,18 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='ArtusAPI',
|
|
5
|
-
version='1.1.
|
|
5
|
+
version='1.1.2',
|
|
6
6
|
description='API to control Artus Family of Robots by Sarcomere Dynamics Inc',
|
|
7
7
|
# package_dir={'': '/'}, # tells setuptools that your packages are under src
|
|
8
8
|
packages=find_packages(exclude=['data*', 'examples*', 'tests*','venv*', 'urdf*', 'ros2*']),
|
|
9
|
-
author='Sarcomere Dynamics Inc.'
|
|
9
|
+
author='Sarcomere Dynamics Inc.',
|
|
10
|
+
install_requires=[
|
|
11
|
+
'psutil==5.9.8',
|
|
12
|
+
'esptool',
|
|
13
|
+
'pyserial==3.5',
|
|
14
|
+
'tqdm',
|
|
15
|
+
'pyyaml'
|
|
16
|
+
]
|
|
10
17
|
# packages=find_packages(where='/'),
|
|
11
18
|
# other setup configurations
|
|
12
19
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|