Fixed python compatibility. Added requirements.txt

This commit is contained in:
MikiTwenty 2024-05-24 14:47:09 +02:00
parent d58398819a
commit b997ee185f
4 changed files with 26 additions and 18 deletions

View File

@ -3,7 +3,7 @@ unitree_sdk2 python 接口
# 安装 # 安装
## 依赖 ## 依赖
- python>=3.8 - python>=3.8,<3.11
- cyclonedds==0.10.2 - cyclonedds==0.10.2
- numpy - numpy
- opencv-python - opencv-python
@ -25,7 +25,7 @@ Could not locate cyclonedds. Try to set CYCLONEDDS_HOME or CMAKE_PREFIX_PATH
该错误提示找不到 cyclonedds 路径。首先编译安装cyclonedds 该错误提示找不到 cyclonedds 路径。首先编译安装cyclonedds
```bash ```bash
cd ~ cd ~
git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x
cd cyclonedds && mkdir build install && cd build cd cyclonedds && mkdir build install && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install cmake .. -DCMAKE_INSTALL_PREFIX=../install
cmake --build . --target install cmake --build . --target install
@ -102,7 +102,7 @@ python3 ./example/wireless_controller/wireless_controller.py enp2s0
终端将输出每一个按键的状态。对于遥控器按键的定义和数据结构可见: https://support.unitree.com/home/zh/developer/Get_remote_control_status 终端将输出每一个按键的状态。对于遥控器按键的定义和数据结构可见: https://support.unitree.com/home/zh/developer/Get_remote_control_status
## 前置摄像头 ## 前置摄像头
使用opencv获取前置摄像头(确保在有图形界面的系统下运行, 按 ESC 退出程序): 使用opencv获取前置摄像头(确保在有图形界面的系统下运行, 按 ESC 退出程序):
```bash ```bash
python3 ./example/front_camera/camera_opencv.py enp2s0 python3 ./example/front_camera/camera_opencv.py enp2s0
``` ```

View File

@ -3,7 +3,7 @@ Python interface for unitree sdk2
# Installation # Installation
## Dependencies ## Dependencies
- Python >= 3.8 - Python >= 3.8, < 3.11
- cyclonedds == 0.10.2 - cyclonedds == 0.10.2
- numpy - numpy
- opencv-python - opencv-python

4
requirements.txt Normal file
View File

@ -0,0 +1,4 @@
numpy
typeguard
opencv-python
cyclonedds==0.10.2

View File

@ -1,16 +1,20 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
setup(name='unitree_sdk2py',
version='1.0.0', def load_requirements(filename:str='requirements.txt') -> None:
author='Unitree', with open(filename, 'r') as file:
author_email='unitree@unitree.com', return [line.strip() for line in file if line and not line.startswith("#")]
license="BSD-3-Clause",
packages=find_packages(), requirements = load_requirements()
description='Unitree robot sdk version 2 for python',
python_requires='>=3.8', setup(
install_requires=[ name='unitree_sdk2py',
"cyclonedds==0.10.2", version='1.0.0',
"numpy", author='Unitree',
"opencv-python", author_email='unitree@unitree.com',
], license="BSD-3-Clause",
) packages=find_packages(),
description='Unitree robot sdk version 2 for python',
python_requires='>=3.8,<3.11',
install_requires=requirements
)