ArtusAPI 1.1.0__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.
Files changed (28) hide show
  1. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/artus_api.py +94 -31
  2. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/commands/commands.py +21 -1
  3. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/communication/UART/uart.py +24 -6
  4. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/communication/WiFi/wifi_server.py +12 -0
  5. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/communication/communication.py +50 -31
  6. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/firmware_update/firmware_updater.py +55 -41
  7. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/firmware_update/run_full_firmware_update.py +12 -0
  8. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/robot/artus_lite/artus_lite.py +29 -18
  9. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/robot/robot.py +9 -12
  10. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI.egg-info/PKG-INFO +1 -1
  11. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI.egg-info/SOURCES.txt +1 -0
  12. ArtusAPI-1.1.2/ArtusAPI.egg-info/requires.txt +5 -0
  13. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/PKG-INFO +1 -1
  14. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/README.md +79 -19
  15. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/setup.py +9 -2
  16. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/__init__.py +0 -0
  17. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/commands/__init__.py +0 -0
  18. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/communication/UART/__init__.py +0 -0
  19. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/communication/WiFi/__init__.py +0 -0
  20. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/communication/__init__.py +0 -0
  21. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/firmware_update/__init__.py +0 -0
  22. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/robot/__init__.py +0 -0
  23. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/robot/artus_lite/__init__.py +0 -0
  24. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/robot/artus_lite/artus_lite_left.py +0 -0
  25. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI/robot/artus_lite/artus_lite_right.py +0 -0
  26. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI.egg-info/dependency_links.txt +0 -0
  27. {ArtusAPI-1.1.0 → ArtusAPI-1.1.2}/ArtusAPI.egg-info/top_level.txt +0 -0
  28. {ArtusAPI-1.1.0 → 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
@@ -54,11 +64,15 @@ class ArtusAPI:
54
64
  hand_type = hand_type)
55
65
 
56
66
  self._last_command_sent_time = time.perf_counter()
57
- self._communication_frequency = 1 / communication_frequency
58
- self._communication_frequency_us = int(self._communication_frequency * 1000000)
67
+ self._communication_frequency = communication_frequency
68
+ self._communication_period = 1 / self._communication_frequency
69
+ self._communication_period_ms = self._communication_period * 1000
59
70
  self.stream = stream
60
71
  self.awake = awake
61
72
 
73
+ # only used during streaming
74
+ self.last_command_recv_time = time.perf_counter()
75
+
62
76
  if not logger:
63
77
  self.logger = logging.getLogger(__name__)
64
78
  else:
@@ -75,7 +89,6 @@ class ArtusAPI:
75
89
  # send wake command with it
76
90
  if not self.awake:
77
91
  self.wake_up()
78
- self.awake = True
79
92
  return
80
93
 
81
94
  def disconnect(self):
@@ -89,8 +102,8 @@ class ArtusAPI:
89
102
  """
90
103
  Wake-up the Artus Hand
91
104
  """
92
- print(f"communication frequency in useconds = {self._communication_frequency_us}")
93
- robot_wake_up_command = self._command_handler.get_robot_start_command(self.stream,self._communication_frequency_us) # to ms for masterboard
105
+ print(f"communication period = {self._communication_period_ms} ms")
106
+ robot_wake_up_command = self._command_handler.get_robot_start_command(self.stream,int(self._communication_period_ms)) # to ms for masterboard
94
107
  self._communication_handler.send_data(robot_wake_up_command)
95
108
 
96
109
  # wait for data back
@@ -98,6 +111,17 @@ class ArtusAPI:
98
111
  self.logger.info(f'Finished calibration')
99
112
  else:
100
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
101
125
 
102
126
  def sleep(self):
103
127
  """
@@ -105,18 +129,22 @@ class ArtusAPI:
105
129
  """
106
130
  robot_sleep_command = self._command_handler.get_sleep_command()
107
131
  return self._communication_handler.send_data(robot_sleep_command)
108
- def calibrate(self):
132
+
133
+ def calibrate(self,joint=0,calibration_type=0):
109
134
  """
110
135
  Calibrate the Artus Hand
136
+ :joint: joint to calibrate, 0 for all joints
111
137
  """
112
138
  if not self.awake:
113
139
  self.logger.warning(f'Hand not ready, send `wake_up` command')
114
140
  return
115
141
  robot_calibrate_command = self._command_handler.get_calibration_command()
142
+ robot_calibrate_command[1] = joint
143
+ robot_calibrate_command[2] = calibration_type
116
144
  self._communication_handler.send_data(robot_calibrate_command)
117
145
 
118
146
  # wait for data back
119
- if self._communication_handler.wait_for_ack():
147
+ if self._communication_handler.wait_for_ack(visual=True):
120
148
  self.logger.info(f'Finished calibration')
121
149
  else:
122
150
  self.logger.warning(f'Error in calibration')
@@ -134,10 +162,20 @@ class ArtusAPI:
134
162
  self._robot_handler.set_joint_angles(joint_angles=joint_angles,name=False)
135
163
  robot_set_joint_angles_command = self._command_handler.get_target_position_command(self._robot_handler.robot.hand_joints)
136
164
  # check communication frequency
137
- if not self._check_communication_frequency():
165
+ if not self._check_communication_frequency(self._last_command_sent_time):
138
166
  return False
139
167
  return self._communication_handler.send_data(robot_set_joint_angles_command)
140
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
+
141
179
  def set_home_position(self):
142
180
  """
143
181
  sends the joints to home positions (0) which opens the Artus Hand
@@ -149,19 +187,19 @@ class ArtusAPI:
149
187
  self._robot_handler.set_home_position()
150
188
  robot_set_home_position_command = self._command_handler.get_target_position_command(hand_joints=self._robot_handler.robot.hand_joints)
151
189
  # check communication frequency
152
- if not self._check_communication_frequency():
190
+ if not self._check_communication_frequency(self._last_command_sent_time):
153
191
  return False
154
192
  return self._communication_handler.send_data(robot_set_home_position_command)
155
193
 
156
- def _check_communication_frequency(self):
194
+ def _check_communication_frequency(self,last_command_time):
157
195
  """
158
196
  check if the communication frequency is too high
159
197
  """
160
198
  current_time = time.perf_counter()
161
- if current_time - self._last_command_sent_time < self._communication_frequency:
199
+ if current_time - last_command_time < self._communication_period:
162
200
  self.logger.warning("Command not sent. Communication frequency is too high.")
163
201
  return False
164
- self._last_command_sent_time = current_time
202
+ last_command_time = current_time
165
203
  return True
166
204
 
167
205
  # robot feedback
@@ -176,7 +214,7 @@ class ArtusAPI:
176
214
  feedback_command = self._command_handler.get_states_command()
177
215
  self._communication_handler.send_data(feedback_command)
178
216
  # test
179
- time.sleep(0.005)
217
+ time.sleep(0.001)
180
218
  return self._communication_handler.receive_data()
181
219
 
182
220
  def get_joint_angles(self):
@@ -189,8 +227,14 @@ class ArtusAPI:
189
227
 
190
228
  feedback_command = self._receive_feedback()
191
229
  joint_angles = self._robot_handler.get_joint_angles(feedback_command)
192
- print(joint_angles)
193
- return joint_angles
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]
236
+ # print(joint_angles)
237
+ return joint_angles[0],angles,velocities,temperatures
194
238
 
195
239
  # robot feedback stream
196
240
  def get_streamed_joint_angles(self):
@@ -201,12 +245,14 @@ class ArtusAPI:
201
245
  self.logger.warning(f'Hand not ready, send `wake_up` command')
202
246
  return
203
247
 
204
- if not self._check_communication_frequency():
205
- return False
206
- feedback_command = self._communication_handler.receive_data()
207
- if not feedback_command:
248
+ if not self._check_communication_frequency(self.last_command_recv_time):
208
249
  return None
209
- joint_angles = self._robot_handler.get_joint_angles(feedback_command)
250
+ else:
251
+ feedback_command = self._communication_handler.receive_data()
252
+ if not feedback_command:
253
+ print(f'feedback is none')
254
+ return None
255
+ joint_angles = self._robot_handler.get_joint_angles(feedback_command)
210
256
  return joint_angles
211
257
 
212
258
  def update_firmware(self,upload_flag='y',file_location=None,drivers_to_flash=0):
@@ -229,7 +275,8 @@ class ArtusAPI:
229
275
  self._firmware_updater.file_location = 'not empty'
230
276
  upload = False
231
277
  else:
232
- if file_location is None: file_location = input('Please enter binfile absolute path: ')
278
+ if file_location is None:
279
+ file_location = input('Please enter binfile absolute path: ')
233
280
  self._firmware_updater.file_location = file_location
234
281
 
235
282
  fw_size = self._firmware_updater.get_bin_file_info()
@@ -238,18 +285,34 @@ class ArtusAPI:
238
285
  if drivers_to_flash == None:
239
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: '))
240
287
 
241
- firmware_command = self._command_handler.get_firmware_command(fw_size,upload,drivers_to_flash)
242
- self._communication_handler.send_data(firmware_command)
243
- if upload:
244
- self._firmware_updater.update_firmware(fw_size)
245
-
246
- print(f'File size = {fw_size}')
247
- print(f'flashing...')
248
- self._communication_handler.wait_for_ack()
249
- print(f'Power Cycle the device to take effect')
250
-
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)
251
308
 
309
+ print(f'Power Cycle the device to take effect')
252
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))
253
316
 
254
317
  def request_joint_and_motor(self):
255
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)
@@ -60,22 +77,23 @@ class UART:
60
77
  # pass
61
78
  try:
62
79
  x = time.perf_counter()
63
- # print(f'time start: {x}')
80
+ # # print(f'time start: {x}')
64
81
  while self.esp32.in_waiting < 65:
65
- if time.perf_counter() - x > 0.02:
82
+ if time.perf_counter() - x > 0.001:
66
83
  break
67
84
  # print(f'elapsed time: {time.perf_counter() - x}')
68
85
  # time.sleep(0.03)
69
86
  # check data
70
87
  if self.esp32.in_waiting >= 65: # get data if greater or equal to 65
71
88
  msg_bytes = self.esp32.read(65)
72
- print(msg_bytes)
89
+ # print(msg_bytes)
73
90
  return msg_bytes
74
- elif self.esp32.in_waiting > 0: # clear buffer if not correct amount of data
91
+ elif self.esp32.in_waiting > 0:
75
92
  # msg_bytes = self.esp32.read_all()
76
- self.logger.warning(f"Incomplete data received - package size = {(self.esp32.in_waiting)}")
93
+ # self.logger.warning(f"Incomplete data received - package size = {(self.esp32.in_waiting)}")
77
94
  return None
78
95
  else: # non blocking
96
+ # self.logger.warning(f"No data available to receive")
79
97
  return None
80
98
  except Exception as e:
81
99
  self.logger.warning(f"No data available to receive {e}")
@@ -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
- import logging
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
- # import sys
8
- # from pathlib import Path
9
- # # Current file's directory
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 <= 49: # 16 bit signed integer to int
92
- recv_data.append(int.from_bytes(package[i:i+2],byteorder='big',signed=True))
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=None):
118
+ def send_data(self, message:list,no_debug=0):
117
119
  """
118
120
  send message
119
121
  """
@@ -137,11 +139,10 @@ class Communication:
137
139
  """
138
140
  byte_msg_recv = None
139
141
  try:
140
- while byte_msg_recv is None:
141
- byte_msg_recv = self.communicator.receive()
142
- if not byte_msg_recv:
143
- # self.logger.warning("No data received")
144
- return None,None
142
+ byte_msg_recv = self.communicator.receive()
143
+ if not byte_msg_recv:
144
+ # self.logger.warning("No data received")
145
+ return None,None
145
146
  ack,message_received = self._byte_to_list_decode(byte_msg_recv)
146
147
  if ack == 9:
147
148
  self.logger.warning("[E] error ack")
@@ -156,13 +157,31 @@ class Communication:
156
157
  self.communicator.close()
157
158
 
158
159
 
159
- def wait_for_ack(self):
160
- while 1:
161
- tmp,rc_csum = self.receive_data()
162
- if tmp is not None:
163
- return 1
164
- time.sleep(0.001)
165
-
160
+ def wait_for_ack(self,timeout=144,visual=False):
161
+ start_time = time.perf_counter()
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)
166
185
 
167
186
  ##################################################################
168
187
  ############################## TESTS #############################
@@ -194,4 +213,4 @@ if __name__ == "__main__":
194
213
 
195
214
 
196
215
 
197
-
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.1)
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
- while i < len(file_data):
60
-
61
- # if not enough file data for 32B, fill with 0xFFs
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
- # wait for ack
87
- ret = self.wait_for_ack()
88
- # debug print
89
- # print(f'CHUNKS LEFT {chunks_required} {csum}')
90
-
91
- if ret:
92
- chunks_required -= 1
93
- i += BYTES_CHUNK
94
- csum = 0
95
- ret = 0
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
- time.sleep(0.01)
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.warn(f'firmware flash checksum error')
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.001)
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=[25, 90, 90, 90, # thumb
6
- 12, 90, 90, # index
7
- 12, 90, 90, # middle
8
- 12, 90, 90, # ring
9
- 12, 90, 90], # pinky
10
- joint_min_angles=[-25, 0, 0, 0, # thumb
11
- -12, 0, 0, # index
12
- -12, 0, 0, # middle
13
- -12, 0, 0, # ring
14
- -12, 0, 0], # pinky
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):
@@ -180,13 +180,24 @@ class ArtusLite:
180
180
  Get the joint angles and feedback list data
181
181
  and populate the feedback fields in the hand_joints dictionary
182
182
  """
183
- print(f'FB PACKAGE = {feedback_package}')
184
- for name,joint_data in self.hand_joints.items():
185
- joint_data.feedback_angle = feedback_package[1][joint_data.index]
186
- joint_data.feedback_current = feedback_package[1][joint_data.index+15]
187
- joint_data.feedback_temperature = feedback_package[1][joint_data.index+31]
188
-
189
- return feedback_package
183
+ # print(f'FB PACKAGE = {feedback_package}')
184
+ try:
185
+ for name,joint_data in self.hand_joints.items():
186
+ joint_data.feedback_angle = feedback_package[1][joint_data.index]
187
+ joint_data.feedback_current = feedback_package[1][joint_data.index+15]
188
+ joint_data.feedback_temperature = feedback_package[1][joint_data.index+31]
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
+
194
+ return feedback_package
195
+ except TypeError:
196
+ # print(f'feedback_package is None')
197
+ return None
198
+ except Exception as e:
199
+ print(e)
200
+ return None
190
201
 
191
202
 
192
203
  def main():
@@ -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
- # import sys
4
- # from pathlib import Path
5
- # # Current file's directory
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ArtusAPI
3
- Version: 1.1.0
3
+ Version: 1.1.2
4
4
  Summary: API to control Artus Family of Robots by Sarcomere Dynamics Inc
5
5
  Home-page: UNKNOWN
6
6
  Author: Sarcomere Dynamics Inc.
@@ -5,6 +5,7 @@ ArtusAPI/artus_api.py
5
5
  ArtusAPI.egg-info/PKG-INFO
6
6
  ArtusAPI.egg-info/SOURCES.txt
7
7
  ArtusAPI.egg-info/dependency_links.txt
8
+ ArtusAPI.egg-info/requires.txt
8
9
  ArtusAPI.egg-info/top_level.txt
9
10
  ArtusAPI/commands/__init__.py
10
11
  ArtusAPI/commands/commands.py
@@ -0,0 +1,5 @@
1
+ esptool
2
+ psutil==5.9.8
3
+ pyserial==3.5
4
+ pyyaml
5
+ tqdm
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ArtusAPI
3
- Version: 1.1.0
3
+ Version: 1.1.2
4
4
  Summary: API to control Artus Family of Robots by Sarcomere Dynamics Inc
5
5
  Home-page: UNKNOWN
6
6
  Author: Sarcomere Dynamics Inc.
@@ -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
- ### Video Introduction
51
- [![Getting Started Video](/data/images/thumbnail.png)](https://www.youtube.com/watch?v=30BkuA0EkP4)
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
- ### Requirements
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
- #### USB Driver
57
- If the host system cannot find the Artus Lite 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 (usually only required for Windows).
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
- ### Installation
60
- Using pip:
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
- __Alternatively, cloning the repository and using the repository locally in a project scope is another option, it may be more up-to-date than the pip stable release.__
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
- ```bash
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
+ [![Getting Started Video](/data/images/thumbnail.png)](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
- **_Note: If running version v1.0.1, `wake_up` is called inside the `connect()` function_**
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.0',
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