登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
登录
注册
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
2
Star
4
Fork
4
FTServo
/
FTServo_Python
代码
Issues
1
Pull Requests
0
Wiki
统计
流水线
服务
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
GroupSyncRead with 6 servo limit?
待办的
#IC3GVQ
taweili
创建于
2025-04-23 19:38
Strange problem. I can only get 6 servo to work. The system is 7 STS3215 connecting with Waveshare Bus Servo adaptor. ```bash (lerobot) david@WUJIE14-PRO:~/Works/lerobot$ python my-notes/group-sync-read.py --n 7 Succeeded to open the port /dev/ttyACM0 Succeeded to change the baudrate Press any key to read position! (or press ESC to quit) Failed to sync read: [TxRxResult] Incorrect status packet! Press any key to read position! (or press ESC to quit) (lerobot) david@WUJIE14-PRO:~/Works/lerobot$ python my-notes/group-sync-read.py --n 6 Succeeded to open the port /dev/ttyACM0 Succeeded to change the baudrate Press any key to read position! (or press ESC to quit) Servo Positions: ----------------- Servo ID: 1 | Position: 2013 | Speed: 0 | Torque: OFF Servo ID: 2 | Position: 3113 | Speed: 0 | Torque: OFF Servo ID: 3 | Position: 1035 | Speed: 0 | Torque: OFF Servo ID: 4 | Position: 1451 | Speed: 0 | Torque: OFF Servo ID: 5 | Position: 2120 | Speed: 0 | Torque: OFF Servo ID: 6 | Position: 2102 | Speed: 0 | Torque: OFF ----------------- Press any key to read position! (or press ESC to quit) ``` # System Info ```bash (lerobot) david@WUJIE14-PRO:~/Works/lerobot$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.5 LTS Release: 22.04 Codename: jammy (lerobot) david@WUJIE14-PRO:~/Works/lerobot$ hostnamectl Static hostname: WUJIE14-PRO Icon name: computer-laptop Chassis: laptop Machine ID: 9b32efb5a41f43b591390fd01f62884a Boot ID: 287d931495df40de9e376cff6b053047 Operating System: Ubuntu 22.04.5 LTS Kernel: Linux 6.8.0-57-generic Architecture: x86-64 Hardware Vendor: MECHREVO Hardware Model: WUJIE14 PRO ``` ```python # https://www.genspark.ai/agents?id=992db78d-0889-4f1e-9c39-a0c8fa13ffd4 import os import argparse if os.name == 'nt': import msvcrt def getch(): return msvcrt.getch().decode() else: import sys, tty, termios fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) def getch(): try: tty.setraw(sys.stdin.fileno()) ch = sys.stdin.read(1) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) return ch from scservo_sdk import * # Uses SCServo SDK library # Control table addresses for the servo ADDR_STS_PRESENT_POSITION = 56 # Address for Present Position ADDR_STS_TORQUE_ENABLE = 64 # Address for Torque Enable status PRESENT_POSITION_SIZE = 4 # Data size is 4 bytes (position + speed) TORQUE_ENABLE_SIZE = 1 # Data size is 1 byte for torque status # Set up command line arguments parser = argparse.ArgumentParser(description='SCServo group sync read utility') parser.add_argument('--port', type=str, default='/dev/ttyACM0', help='Port name (e.g. /dev/ttyACM0 or COM1)') parser.add_argument('--n', type=int, default=7, help='Number of servos to check (1-n)') args = parser.parse_args() # Protocol settings BAUDRATE = 1000000 # Default Baudrate of SCServo PROTOCOL_END = 0 # SCServo bit end(STS/SMS=0, SCS=1) # Set the port path portHandler = PortHandler(args.port) # Initialize PacketHandler instance packetHandler = PacketHandler(PROTOCOL_END) # Initialize GroupSyncRead instances groupSyncRead = GroupSyncRead(portHandler, packetHandler, ADDR_STS_PRESENT_POSITION, PRESENT_POSITION_SIZE) groupSyncReadTorque = GroupSyncRead(portHandler, packetHandler, ADDR_STS_TORQUE_ENABLE, TORQUE_ENABLE_SIZE) # Open port if portHandler.openPort(): print(f"Succeeded to open the port {args.port}") else: print(f"Failed to open the port {args.port}") print("Press any key to terminate...") getch() quit() # Set port baudrate if portHandler.setBaudRate(BAUDRATE): print("Succeeded to change the baudrate") else: print("Failed to change the baudrate") print("Press any key to terminate...") getch() quit() # Add parameter storage for servo IDs 1-n for servoId in range(1, args.n + 1): servo_addparam_result = groupSyncRead.addParam(servoId) torque_addparam_result = groupSyncReadTorque.addParam(servoId) if servo_addparam_result != True or torque_addparam_result != True: print(f"[ID:{servoId:03d}] groupSyncRead addparam failed") quit() while True: print("Press any key to read position! (or press ESC to quit)") if getch() == chr(0x1b): break # Syncread present position and torque status servo_comm_result = groupSyncRead.txRxPacket() torque_comm_result = groupSyncReadTorque.txRxPacket() if servo_comm_result != COMM_SUCCESS or torque_comm_result != COMM_SUCCESS: print(f"Failed to sync read: {packetHandler.getTxRxResult(servo_comm_result)}") continue # Display position for each servo print("\nServo Positions:") print("-----------------") for servoId in range(1, args.n + 1): # Check if data from the servo is available if groupSyncRead.isAvailable(servoId, ADDR_STS_PRESENT_POSITION, PRESENT_POSITION_SIZE): # Get the position value (4 bytes data: Position + Speed) position_speed_data = groupSyncRead.getData(servoId, ADDR_STS_PRESENT_POSITION, PRESENT_POSITION_SIZE) # Extract actual position (lower 2 bytes) position = SCS_LOWORD(position_speed_data) # Extract speed (higher 2 bytes) speed = SCS_HIWORD(position_speed_data) # Get torque status torque_status = groupSyncReadTorque.getData(servoId, ADDR_STS_TORQUE_ENABLE, TORQUE_ENABLE_SIZE) torque_enabled = "ON" if torque_status else "OFF" print(f"Servo ID: {servoId} | Position: {position} | Speed: {SCS_TOHOST(speed, 15)} | Torque: {torque_enabled}") else: print(f"Servo ID: {servoId} | Failed to get data") print("-----------------\n") # Clear parameter storage before exit groupSyncRead.clearParam() # Close port portHandler.closePort() ```
Strange problem. I can only get 6 servo to work. The system is 7 STS3215 connecting with Waveshare Bus Servo adaptor. ```bash (lerobot) david@WUJIE14-PRO:~/Works/lerobot$ python my-notes/group-sync-read.py --n 7 Succeeded to open the port /dev/ttyACM0 Succeeded to change the baudrate Press any key to read position! (or press ESC to quit) Failed to sync read: [TxRxResult] Incorrect status packet! Press any key to read position! (or press ESC to quit) (lerobot) david@WUJIE14-PRO:~/Works/lerobot$ python my-notes/group-sync-read.py --n 6 Succeeded to open the port /dev/ttyACM0 Succeeded to change the baudrate Press any key to read position! (or press ESC to quit) Servo Positions: ----------------- Servo ID: 1 | Position: 2013 | Speed: 0 | Torque: OFF Servo ID: 2 | Position: 3113 | Speed: 0 | Torque: OFF Servo ID: 3 | Position: 1035 | Speed: 0 | Torque: OFF Servo ID: 4 | Position: 1451 | Speed: 0 | Torque: OFF Servo ID: 5 | Position: 2120 | Speed: 0 | Torque: OFF Servo ID: 6 | Position: 2102 | Speed: 0 | Torque: OFF ----------------- Press any key to read position! (or press ESC to quit) ``` # System Info ```bash (lerobot) david@WUJIE14-PRO:~/Works/lerobot$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.5 LTS Release: 22.04 Codename: jammy (lerobot) david@WUJIE14-PRO:~/Works/lerobot$ hostnamectl Static hostname: WUJIE14-PRO Icon name: computer-laptop Chassis: laptop Machine ID: 9b32efb5a41f43b591390fd01f62884a Boot ID: 287d931495df40de9e376cff6b053047 Operating System: Ubuntu 22.04.5 LTS Kernel: Linux 6.8.0-57-generic Architecture: x86-64 Hardware Vendor: MECHREVO Hardware Model: WUJIE14 PRO ``` ```python # https://www.genspark.ai/agents?id=992db78d-0889-4f1e-9c39-a0c8fa13ffd4 import os import argparse if os.name == 'nt': import msvcrt def getch(): return msvcrt.getch().decode() else: import sys, tty, termios fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) def getch(): try: tty.setraw(sys.stdin.fileno()) ch = sys.stdin.read(1) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) return ch from scservo_sdk import * # Uses SCServo SDK library # Control table addresses for the servo ADDR_STS_PRESENT_POSITION = 56 # Address for Present Position ADDR_STS_TORQUE_ENABLE = 64 # Address for Torque Enable status PRESENT_POSITION_SIZE = 4 # Data size is 4 bytes (position + speed) TORQUE_ENABLE_SIZE = 1 # Data size is 1 byte for torque status # Set up command line arguments parser = argparse.ArgumentParser(description='SCServo group sync read utility') parser.add_argument('--port', type=str, default='/dev/ttyACM0', help='Port name (e.g. /dev/ttyACM0 or COM1)') parser.add_argument('--n', type=int, default=7, help='Number of servos to check (1-n)') args = parser.parse_args() # Protocol settings BAUDRATE = 1000000 # Default Baudrate of SCServo PROTOCOL_END = 0 # SCServo bit end(STS/SMS=0, SCS=1) # Set the port path portHandler = PortHandler(args.port) # Initialize PacketHandler instance packetHandler = PacketHandler(PROTOCOL_END) # Initialize GroupSyncRead instances groupSyncRead = GroupSyncRead(portHandler, packetHandler, ADDR_STS_PRESENT_POSITION, PRESENT_POSITION_SIZE) groupSyncReadTorque = GroupSyncRead(portHandler, packetHandler, ADDR_STS_TORQUE_ENABLE, TORQUE_ENABLE_SIZE) # Open port if portHandler.openPort(): print(f"Succeeded to open the port {args.port}") else: print(f"Failed to open the port {args.port}") print("Press any key to terminate...") getch() quit() # Set port baudrate if portHandler.setBaudRate(BAUDRATE): print("Succeeded to change the baudrate") else: print("Failed to change the baudrate") print("Press any key to terminate...") getch() quit() # Add parameter storage for servo IDs 1-n for servoId in range(1, args.n + 1): servo_addparam_result = groupSyncRead.addParam(servoId) torque_addparam_result = groupSyncReadTorque.addParam(servoId) if servo_addparam_result != True or torque_addparam_result != True: print(f"[ID:{servoId:03d}] groupSyncRead addparam failed") quit() while True: print("Press any key to read position! (or press ESC to quit)") if getch() == chr(0x1b): break # Syncread present position and torque status servo_comm_result = groupSyncRead.txRxPacket() torque_comm_result = groupSyncReadTorque.txRxPacket() if servo_comm_result != COMM_SUCCESS or torque_comm_result != COMM_SUCCESS: print(f"Failed to sync read: {packetHandler.getTxRxResult(servo_comm_result)}") continue # Display position for each servo print("\nServo Positions:") print("-----------------") for servoId in range(1, args.n + 1): # Check if data from the servo is available if groupSyncRead.isAvailable(servoId, ADDR_STS_PRESENT_POSITION, PRESENT_POSITION_SIZE): # Get the position value (4 bytes data: Position + Speed) position_speed_data = groupSyncRead.getData(servoId, ADDR_STS_PRESENT_POSITION, PRESENT_POSITION_SIZE) # Extract actual position (lower 2 bytes) position = SCS_LOWORD(position_speed_data) # Extract speed (higher 2 bytes) speed = SCS_HIWORD(position_speed_data) # Get torque status torque_status = groupSyncReadTorque.getData(servoId, ADDR_STS_TORQUE_ENABLE, TORQUE_ENABLE_SIZE) torque_enabled = "ON" if torque_status else "OFF" print(f"Servo ID: {servoId} | Position: {position} | Speed: {SCS_TOHOST(speed, 15)} | Torque: {torque_enabled}") else: print(f"Servo ID: {servoId} | Failed to get data") print("-----------------\n") # Clear parameter storage before exit groupSyncRead.clearParam() # Close port portHandler.closePort() ```
评论 (
0
)
登录
后才可以发表评论
状态
待办的
待办的
进行中
已完成
已关闭
负责人
未设置
标签
未设置
标签管理
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
未关联
main
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
参与者(1)
Python
1
https://gitee.com/ftservo/FTServo_Python.git
git@gitee.com:ftservo/FTServo_Python.git
ftservo
FTServo_Python
FTServo_Python
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册