ArtusAPI 0.1.0__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.
Potentially problematic release.
This version of ArtusAPI might be problematic. Click here for more details.
- ArtusAPI-0.1.0/ArtusAPI/ArtusAPI.egg-info/PKG-INFO +4 -0
- ArtusAPI-0.1.0/ArtusAPI/ArtusAPI.egg-info/SOURCES.txt +9 -0
- ArtusAPI-0.1.0/ArtusAPI/ArtusAPI.egg-info/dependency_links.txt +1 -0
- ArtusAPI-0.1.0/ArtusAPI/ArtusAPI.egg-info/top_level.txt +1 -0
- ArtusAPI-0.1.0/ArtusAPI/commands/__init__.py +0 -0
- ArtusAPI-0.1.0/ArtusAPI/commands/commands.py +91 -0
- ArtusAPI-0.1.0/PKG-INFO +4 -0
- ArtusAPI-0.1.0/README.md +34 -0
- ArtusAPI-0.1.0/setup.cfg +4 -0
- ArtusAPI-0.1.0/setup.py +10 -0
- ArtusAPI-0.1.0/test/test.py +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
ArtusAPI/ArtusAPI.egg-info/PKG-INFO
|
|
4
|
+
ArtusAPI/ArtusAPI.egg-info/SOURCES.txt
|
|
5
|
+
ArtusAPI/ArtusAPI.egg-info/dependency_links.txt
|
|
6
|
+
ArtusAPI/ArtusAPI.egg-info/top_level.txt
|
|
7
|
+
ArtusAPI/commands/__init__.py
|
|
8
|
+
ArtusAPI/commands/commands.py
|
|
9
|
+
test/test.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
commands
|
|
File without changes
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
|
|
2
|
+
import time
|
|
3
|
+
import json
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
# Current file's directory
|
|
8
|
+
current_file_path = Path(__file__).resolve()
|
|
9
|
+
# Add the desired path to the system path
|
|
10
|
+
desired_path = current_file_path.parent.parent
|
|
11
|
+
sys.path.append(str(desired_path))
|
|
12
|
+
print(desired_path)
|
|
13
|
+
|
|
14
|
+
class Commands:
|
|
15
|
+
|
|
16
|
+
def __init__(self):
|
|
17
|
+
|
|
18
|
+
# commands
|
|
19
|
+
with open(os.path.join(desired_path,'commands',"commands.json")) as file:
|
|
20
|
+
self.commands = json.load(file)
|
|
21
|
+
|
|
22
|
+
def get_robot_start_command(self,stream:bool,freq:int) -> list:
|
|
23
|
+
"""
|
|
24
|
+
Creates a message to start the hand
|
|
25
|
+
"""
|
|
26
|
+
# RTC start time from PC
|
|
27
|
+
year = int(time.localtime().tm_year - 2000)
|
|
28
|
+
month = int(time.localtime().tm_mon)
|
|
29
|
+
day = int(time.localtime().tm_mday)
|
|
30
|
+
hour = int(time.localtime().tm_hour)
|
|
31
|
+
minute = int(time.localtime().tm_min)
|
|
32
|
+
second = int(time.localtime().tm_sec)
|
|
33
|
+
|
|
34
|
+
if stream:
|
|
35
|
+
return [self.commands['start_command'],20,year,month,day,hour,minute,second,1,(freq>>16)&0xff,(freq>>8)&0xff,freq&0xff]
|
|
36
|
+
else:
|
|
37
|
+
return [self.commands['start_command'],20,year,month,day,hour,minute,second]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def get_target_position_command(self,hand_joints:dict) -> list:
|
|
41
|
+
command_list = [0]*32 # create empty buffer
|
|
42
|
+
# fill command list with data
|
|
43
|
+
for name,joint_data in hand_joints.items():
|
|
44
|
+
command_list[joint_data.index] = joint_data.target_angle
|
|
45
|
+
command_list[joint_data.index+16] = joint_data.velocity
|
|
46
|
+
# insert the command
|
|
47
|
+
command_list.insert(0,self.commands['target_command'])
|
|
48
|
+
|
|
49
|
+
return command_list
|
|
50
|
+
|
|
51
|
+
def get_calibration_command(self):
|
|
52
|
+
command_list = [0]*32
|
|
53
|
+
command_list.insert(0,self.commands['calibration_command'])
|
|
54
|
+
return command_list
|
|
55
|
+
|
|
56
|
+
def get_sleep_command(self):
|
|
57
|
+
command_list = [0]*32
|
|
58
|
+
command_list.insert(0,self.commands['sleep_command'])
|
|
59
|
+
return command_list
|
|
60
|
+
|
|
61
|
+
def get_states_command(self):
|
|
62
|
+
command_list = [0]*32
|
|
63
|
+
command_list.insert(0,self.commands['get_feedback_command'])
|
|
64
|
+
return command_list
|
|
65
|
+
|
|
66
|
+
def get_firmware_update_command(self):
|
|
67
|
+
command_list = [0]*32
|
|
68
|
+
command_list.insert(0,self.commands['firmware_update_command'])
|
|
69
|
+
return command_list
|
|
70
|
+
|
|
71
|
+
def get_locked_reset_low_command(self, joint=None, motor=None):
|
|
72
|
+
command_list = [0]*32
|
|
73
|
+
command_list.insert(0,self.commands['reset_command'])
|
|
74
|
+
|
|
75
|
+
# constraint checker
|
|
76
|
+
if 0 <= joint <= 15:
|
|
77
|
+
command_list[0] = joint
|
|
78
|
+
else:
|
|
79
|
+
# TODO logging
|
|
80
|
+
None
|
|
81
|
+
if 0 <= motor <= 2:
|
|
82
|
+
command_list[1] = motor
|
|
83
|
+
else:
|
|
84
|
+
# TODO logging
|
|
85
|
+
None
|
|
86
|
+
|
|
87
|
+
return command_list
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if __name__ == "__main__":
|
|
91
|
+
None
|
ArtusAPI-0.1.0/PKG-INFO
ADDED
ArtusAPI-0.1.0/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Python Artus Robotic Hand API
|
|
2
|
+
This repository contains a Python API for controlling the Artus robotic hands.
|
|
3
|
+
|
|
4
|
+
## Directory Structure
|
|
5
|
+
```bash
|
|
6
|
+
├── ArtusAPI
|
|
7
|
+
│ ├── commnands
|
|
8
|
+
│ │ ├── commands.py # Command strings for the Robot Hand
|
|
9
|
+
│ ├── communication
|
|
10
|
+
│ │ ├── WiFi
|
|
11
|
+
│ │ │ ├── WiFi.py # WiFi communication class
|
|
12
|
+
│ │ ├── UART
|
|
13
|
+
│ │ │ ├── UART.py # UART communication class
|
|
14
|
+
│ │ ├── communication.py # Communication class for the API
|
|
15
|
+
│ ├── robot
|
|
16
|
+
│ │ ├── artus_3d
|
|
17
|
+
│ │ │ ├── artus_3d.py # Artus 3D Hand class
|
|
18
|
+
│ │ ├── artus_lite
|
|
19
|
+
│ │ │ ├── artus_lite.py # Artus Lite Hand class
|
|
20
|
+
│ │ ├── robot.py # Robot Hand class for the API
|
|
21
|
+
│ ├── artus_api.py # API Core
|
|
22
|
+
|
|
23
|
+
├── data
|
|
24
|
+
│ ├── grasp_poses
|
|
25
|
+
│ ├── images
|
|
26
|
+
|
|
27
|
+
├── examples
|
|
28
|
+
│ ├── example.py # Example usage of the API
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API Core
|
|
32
|
+
```python
|
|
33
|
+
class ArtusAPI()
|
|
34
|
+
```
|
ArtusAPI-0.1.0/setup.cfg
ADDED
ArtusAPI-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='ArtusAPI',
|
|
5
|
+
version='0.1.0',
|
|
6
|
+
description='API to control Artus Family of Robots',
|
|
7
|
+
package_dir={'': 'ArtusAPI'}, # tells setuptools that your packages are under src
|
|
8
|
+
packages=find_packages(where='ArtusAPI'),
|
|
9
|
+
# other setup configurations
|
|
10
|
+
)
|
|
File without changes
|