fix
这个提交包含在:
1
.gitignore
vendored
普通文件
1
.gitignore
vendored
普通文件
@ -0,0 +1 @@
|
|||||||
|
__pycache__
|
||||||
@ -1,17 +1,21 @@
|
|||||||
from lerobot.motors import MotorsBus
|
from lerobot.motors import MotorsBus
|
||||||
from lerobot.motors.motors_bus import Motor, MotorCalibration
|
from lerobot.motors.motors_bus import Motor, MotorCalibration
|
||||||
|
|
||||||
from PCA9685A import PCA9685A
|
from .PCA9685A import PCA9685A
|
||||||
|
|
||||||
class PWMMotorBus(MotorsBus):
|
class PWMMotorBus(MotorsBus):
|
||||||
"""`Lerobot`兼容的PWM舵机总线"""
|
"""`Lerobot`兼容的PWM舵机总线"""
|
||||||
def __init__(self, port: str, motors: dict[str, Motor], calibration: dict[str, MotorCalibration] | None = None):
|
def __init__(self, port: str, motors: dict[str, Motor], calibration: dict[str, MotorCalibration] | None = None):
|
||||||
|
|
||||||
self.PWMBus : PCA9685A
|
self.PWMBus : PCA9685A
|
||||||
|
self.model_number_table = {}
|
||||||
|
self.model_ctrl_table = {"PWM":{}}
|
||||||
super().__init__(port, motors, calibration)
|
super().__init__(port, motors, calibration)
|
||||||
if "/dev/i2c-" in port:
|
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:
|
else:
|
||||||
raise ConnectionError("No I2C device setted!")
|
raise ConnectionError("No I2C device setted!")
|
||||||
pass
|
pass
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户