RL-PowerTracking/docs/modules/robot_control.md

46 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

# 机械臂控制模块 (`src/robot_control`)
## 模块概述
本模块实现了机械手臂的控制接口,支持笛卡尔空间运动规划和基本操作。
## 类说明
### `RoboticArmController`
机械手臂控制接口类,提供以下功能:
#### 方法
- `__init__(port='COM3', baud_rate=115200)`
初始化机械手臂控制器
- `connect()`
建立与机械手臂的连接
- `disconnect()`
断开机械手臂连接
- `move_to_position(position)`
移动到指定位置x, y, z
- `move_along_path(path_points, speed=0.1)`
沿指定路径移动机械臂,支持路径点列表和速度参数
- `perform_pick_and_place(start_pos, end_pos)`
执行抓取和放置操作,从起始位置移动到目标位置
## 使用示例
```python
from src.robot_control.arm_controller import RoboticArmController
# 创建控制器实例
arm = RoboticArmController()
# 连接机械臂
arm.connect()
# 移动到指定位置
arm.move_to_position([0.3, 0.2, 0.1])
# 执行抓取和放置操作
arm.perform_pick_and_place([0.3, 0.2, 0.0], [0.1, 0.4, 0.0])
# 断开连接
arm.disconnect()