这个提交包含在:
2025-09-10 22:32:07 +08:00
父节点 3619ac91f2
当前提交 e40a49c4c4
共有 2 个文件被更改,包括 8 次插入 和 3 次删除

1
.gitignore vendored 普通文件
查看文件

@ -0,0 +1 @@
__pycache__

查看文件

@ -1,17 +1,21 @@
from lerobot.motors import MotorsBus
from lerobot.motors.motors_bus import Motor, MotorCalibration
from PCA9685A import PCA9685A
from .PCA9685A import PCA9685A
class PWMMotorBus(MotorsBus):
"""`Lerobot`兼容的PWM舵机总线"""
def __init__(self, port: str, motors: dict[str, Motor], calibration: dict[str, MotorCalibration] | None = None):
self.PWMBus : PCA9685A
self.model_number_table = {}
self.model_ctrl_table = {"PWM":{}}
super().__init__(port, motors, calibration)
if "/dev/i2c-" in port:
self.PWMBus = PCA9685A(int(port.replace("/dev/i2c-","")))
try:
self.PWMBus = PCA9685A(int(port.replace("/dev/i2c-","")))
except Exception as e:
raise e
else:
raise ConnectionError("No I2C device setted!")
pass