ArtusAPI 1.3.16__tar.gz → 1.3.18__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 (34) hide show
  1. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/artus_api.py +13 -9
  2. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/commands/commands.py +3 -1
  3. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/communication/UART/uart.py +5 -2
  4. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/communication/communication.py +7 -5
  5. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/robot/artus_lite/artus_lite_plus.py +26 -1
  6. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/robot/robot.py +5 -2
  7. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI.egg-info/PKG-INFO +2 -1
  8. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/PKG-INFO +2 -1
  9. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/setup.py +3 -3
  10. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/__init__.py +0 -0
  11. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/commands/__init__.py +0 -0
  12. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/communication/UART/__init__.py +0 -0
  13. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/communication/WiFi/__init__.py +0 -0
  14. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/communication/WiFi/wifi_server.py +0 -0
  15. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/communication/__init__.py +0 -0
  16. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/firmware_update/__init__.py +0 -0
  17. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/firmware_update/firmware_updater.py +0 -0
  18. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/firmware_update/run_full_firmware_update.py +0 -0
  19. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/robot/__init__.py +0 -0
  20. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/robot/artus_lite/__init__.py +0 -0
  21. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/robot/artus_lite/artus_lite.py +0 -0
  22. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/robot/artus_lite/artus_lite_left.py +0 -0
  23. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/robot/artus_lite/artus_lite_plus_left.py +0 -0
  24. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/robot/artus_lite/artus_lite_plus_right.py +0 -0
  25. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/robot/artus_lite/artus_lite_right.py +0 -0
  26. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/sensors/ForceSensor.py +0 -0
  27. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI/sensors/__init__.py +0 -0
  28. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI.egg-info/SOURCES.txt +0 -0
  29. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI.egg-info/dependency_links.txt +0 -0
  30. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI.egg-info/entry_points.txt +0 -0
  31. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI.egg-info/requires.txt +0 -0
  32. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/ArtusAPI.egg-info/top_level.txt +0 -0
  33. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/README.md +0 -0
  34. {ArtusAPI-1.3.16 → ArtusAPI-1.3.18}/setup.cfg +0 -0
@@ -47,7 +47,7 @@ class ArtusAPI:
47
47
  ArtusAPI class controls the communication and control of between a system and an Artus Hand by Sarcomere Dynamics Inc. This file contains the high-level calls that
48
48
  are used to control the hand. The low-level calls are separated by robot, command and communication classes.
49
49
  :communication_method: communication method that is supported on the Artus Hand, see Robot folder for supported methods. Default is UART over USBC
50
- - UART (USBC or RS485), CAN
50
+ - UART, RS485, CAN
51
51
  :communication_channel_identifier: channel identifier for the communication method. Usually a COM Port
52
52
  :robot_type: name of the series of robot hand. See Robot folder for list of robots
53
53
  :hand_type: left or right
@@ -223,7 +223,7 @@ class ArtusAPI:
223
223
  return True
224
224
 
225
225
  # robot feedback
226
- def _receive_feedback(self):
226
+ def _receive_feedback(self,type=0):
227
227
  """
228
228
  Send a request for feedback data and receive feedback data
229
229
 
@@ -234,15 +234,19 @@ class ArtusAPI:
234
234
  self.logger.warning(f'Hand not ready, send `wake_up` command')
235
235
  return
236
236
 
237
- feedback_command = self._command_handler.get_states_command()
237
+ feedback_command = self._command_handler.get_states_command(type=type)
238
238
  self._communication_handler.send_data(feedback_command)
239
239
  # test
240
240
  time.sleep(0.001)
241
- return self._communication_handler.receive_data()
241
+ return self._communication_handler.receive_data(type)
242
242
 
243
- def get_joint_angles(self):
243
+
244
+ def get_joint_angles(self,type=0):
244
245
  """
245
246
  Populate feedback fields in self._robot_handler.hand_joints dict
247
+ type: only applicable to artus+
248
+ 0: get joint angles and force values from fingertip
249
+ 1: get actuator data (temperature and current)
246
250
 
247
251
  Returns:
248
252
  :tuple: (ack, angles, velocities, temperatures)
@@ -255,16 +259,16 @@ class ArtusAPI:
255
259
  self.logger.warning(f'Hand not ready, send `wake_up` command')
256
260
  return
257
261
 
258
- feedback_command = self._receive_feedback()
262
+ feedback_command = self._receive_feedback(type)
259
263
  if not self._check_communication_frequency(1):
260
264
  return None
261
- joint_angles = self._robot_handler.get_joint_angles(feedback_command)
265
+ joint_angles = self._robot_handler.get_joint_angles(feedback_command,type=type)
262
266
  if joint_angles is None:
263
267
  return None
264
268
 
265
269
  angles = joint_angles[1][0:16]
266
270
 
267
- if self._robot_handler.robot_type == 'artus_lite':
271
+ if self._robot_handler.robot_type == 'artus_lite' or type == 1:
268
272
  # separate joint angles into 3 lists
269
273
  velocities = joint_angles[1][16:32]
270
274
  temperatures = joint_angles[1][32:48]
@@ -298,7 +302,7 @@ class ArtusAPI:
298
302
  if not feedback_command:
299
303
  print(f'feedback is none')
300
304
  return None
301
- joint_angles = self._robot_handler.get_joint_angles(feedback_command)
305
+ joint_angles = self._robot_handler.get_joint_angles(feedback_command,type=0)
302
306
  return joint_angles
303
307
 
304
308
  def update_firmware(self,upload_flag='y',file_location=None,drivers_to_flash=0):
@@ -110,9 +110,11 @@ class Commands:
110
110
  command_list.insert(0,self.commands['sleep_command'])
111
111
  return command_list
112
112
 
113
- def get_states_command(self):
113
+ def get_states_command(self,type=0):
114
114
  command_list = [0]*32
115
115
  command_list.insert(0,self.commands['get_feedback_command'])
116
+ if type == 1:
117
+ command_list[1] = 1 # get actuator data -- only applicable to artus+
116
118
  return command_list
117
119
 
118
120
  def get_firmware_update_command(self):
@@ -21,12 +21,14 @@ class UART:
21
21
  port='COM9',
22
22
  baudrate=921600, #115200,
23
23
  timeout=0.5,
24
- logger = None):
24
+ logger = None,
25
+ type='UART'):
25
26
 
26
27
  # automatically connect to the first available port
27
28
  self.port = port
28
29
  self.baudrate = baudrate
29
30
  self.timeout = timeout
31
+ self.type = type
30
32
 
31
33
  self.esp32 = serial.Serial(baudrate=self.baudrate, timeout= self.timeout)
32
34
 
@@ -89,7 +91,8 @@ class UART:
89
91
  # print(msg_bytes)
90
92
  return msg_bytes
91
93
  elif self.esp32.in_waiting > 0:
92
- # msg_bytes = self.esp32.read_all()
94
+ if self.type == 'RS485':
95
+ msg_bytes = self.esp32.read_all()
93
96
  # self.logger.warning(f"Incomplete data received - package size = {(self.esp32.in_waiting)}")
94
97
  return None
95
98
  else: # non blocking
@@ -59,7 +59,9 @@ class Communication:
59
59
  """
60
60
  # setup communication based on the method
61
61
  if self.communication_method == 'UART':
62
- self.communicator = UART(port=self.communication_channel_identifier,baudrate=self.baudrate)
62
+ self.communicator = UART(port=self.communication_channel_identifier,baudrate=921600,type='UART')
63
+ elif self.communication_method == 'RS485':
64
+ self.communicator = UART(port=self.communication_channel_identifier,baudrate=115200,type='RS485')
63
65
  elif self.communication_method == 'WiFi':
64
66
  self.communicator = WiFiServer(target_ssid=self.communication_channel_identifier)
65
67
  elif self.communication_method == 'None':
@@ -89,11 +91,11 @@ class Communication:
89
91
  # return byte array to send
90
92
  return send_data
91
93
 
92
- def _byte_to_list_decode(self,package:bytearray) -> tuple:
94
+ def _byte_to_list_decode(self,package:bytearray,type=0) -> tuple:
93
95
  recv_data = []
94
96
  i = 0
95
97
 
96
- if self.robot_type == 'artus_lite':
98
+ if self.robot_type == 'artus_lite' or type == 1:
97
99
  # BYTE 0 : ACK
98
100
  # BYTE 1 - 16 : 8 BIT POSITION
99
101
  # BYTE 17 - 49 : 16 BIT POSITION
@@ -164,7 +166,7 @@ class Communication:
164
166
  pass
165
167
  return False
166
168
 
167
- def receive_data(self) -> list:
169
+ def receive_data(self,type=0) -> list:
168
170
  """
169
171
  receive message
170
172
  """
@@ -174,7 +176,7 @@ class Communication:
174
176
  if not byte_msg_recv:
175
177
  # self.logger.warning("No data received")
176
178
  return None,None
177
- ack,message_received = self._byte_to_list_decode(byte_msg_recv)
179
+ ack,message_received = self._byte_to_list_decode(byte_msg_recv,type)
178
180
  if ack == 9:
179
181
  self.logger.warning("[E] error ack")
180
182
  # print(ack)
@@ -27,7 +27,7 @@ class ArtusLite_Plus(ArtusLite):
27
27
  'indices' : indices[i]
28
28
  }
29
29
 
30
- def get_joint_angles(self, feedback_package:list):
30
+ def get_joint_angles_force(self, feedback_package:list):
31
31
  """
32
32
  Get the joint angles and feedback list data
33
33
  and populate the feedback fields in the hand_joints dictionary
@@ -54,6 +54,31 @@ class ArtusLite_Plus(ArtusLite):
54
54
  object['data'].z = feedback_slice[i+2]
55
55
  i += 3
56
56
 
57
+ return feedback_package
58
+ except TypeError:
59
+ # print(f'feedback_package is None')
60
+ return None
61
+ except Exception as e:
62
+ print(e)
63
+ return None
64
+
65
+ def get_joint_angles(self, feedback_package:list):
66
+ """
67
+ Get the joint angles and feedback list data
68
+ and populate the feedback fields in the hand_joints dictionary
69
+ """
70
+ # print(f'FB PACKAGE = {feedback_package}')
71
+ try:
72
+ for name,joint_data in self.hand_joints.items():
73
+ joint_data.feedback_angle = feedback_package[1][joint_data.index]
74
+ joint_data.feedback_current = feedback_package[1][joint_data.index+15]
75
+ joint_data.feedback_force = round(feedback_package[1][joint_data.index+15] * 0.0035904, 2) # take current value and convert to force
76
+ joint_data.feedback_temperature = feedback_package[1][joint_data.index+31]
77
+
78
+ if joint_data.index in [1,5,8,11,14] and joint_data.feedback_angle < 0:
79
+ joint_data.feedback_angle = -joint_data.feedback_angle
80
+ feedback_package[1][joint_data.index] = -feedback_package[1][joint_data.index]
81
+
57
82
  return feedback_package
58
83
  except TypeError:
59
84
  # print(f'feedback_package is None')
@@ -71,11 +71,14 @@ class Robot:
71
71
  """
72
72
  return self.robot.set_home_position()
73
73
 
74
- def get_joint_angles(self, joint_angles):
74
+ def get_joint_angles(self, joint_angles,type=0):
75
75
  """
76
76
  Get the joint angles of the hand
77
77
  """
78
- return self.robot.get_joint_angles(joint_angles)
78
+ if type == 1 or self.robot_type == 'artus_lite':
79
+ return self.robot.get_joint_angles(joint_angles)
80
+ elif self.robot_type == 'artus_lite_plus':
81
+ return self.robot.get_joint_angles_force(joint_angles)
79
82
 
80
83
 
81
84
  def main():
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ArtusAPI
3
- Version: 1.3.16
3
+ Version: 1.3.18
4
4
  Summary: API to control Artus Family of Robots by Sarcomere Dynamics Inc
5
5
  Home-page: https://sarcomeredynamics.com/home
6
6
  Author: Sarcomere Dynamics Inc.
7
+ Author-email: support@sarcomeredynamics.com
7
8
  License: UNKNOWN
8
9
  Project-URL: Source, https://github.com/Sarcomere-Dynamics/Sarcomere_Dynamics_Resources
9
10
  Keywords: robotics,artus,sarcomere dynamics,control
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ArtusAPI
3
- Version: 1.3.16
3
+ Version: 1.3.18
4
4
  Summary: API to control Artus Family of Robots by Sarcomere Dynamics Inc
5
5
  Home-page: https://sarcomeredynamics.com/home
6
6
  Author: Sarcomere Dynamics Inc.
7
+ Author-email: support@sarcomeredynamics.com
7
8
  License: UNKNOWN
8
9
  Project-URL: Source, https://github.com/Sarcomere-Dynamics/Sarcomere_Dynamics_Resources
9
10
  Keywords: robotics,artus,sarcomere dynamics,control
@@ -2,12 +2,13 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='ArtusAPI',
5
- version='1.3.16',
5
+ version='1.3.18',
6
6
  description='API to control Artus Family of Robots by Sarcomere Dynamics Inc',
7
7
  long_description=open('README.md').read(),
8
8
  long_description_content_type='text/markdown',
9
- packages=find_packages(exclude=['data*', 'examples*', 'tests*','venv*', 'urdf*', 'ros2*']),
9
+ packages=find_packages(exclude=['data*', 'examples*', 'tests*','venv*', 'urdf*', 'ros2*','changelog*']),
10
10
  author='Sarcomere Dynamics Inc.',
11
+ author_email='support@sarcomeredynamics.com',
11
12
  install_requires=[
12
13
  'psutil==5.9.8',
13
14
  'pyserial==3.5',
@@ -16,7 +17,6 @@ setup(
16
17
  'tqdm',
17
18
  'requests'
18
19
  ],
19
- changelog=open('changelog/pip_changelog.md').read(),
20
20
  python_requires='>=3.10',
21
21
  url='https://sarcomeredynamics.com/home',
22
22
  project_urls={
File without changes
File without changes