|
| 1 | +# instructions |
| 2 | + |
| 3 | +## 1.Connecting devices |
| 4 | + |
| 5 | +Connect the MyCobot and handle to the computer. |
| 6 | + |
| 7 | +## 2.Install required libraries |
| 8 | + |
| 9 | +Open the terminal, switch the path to this folder, and run the following command。 |
| 10 | + |
| 11 | +```bash |
| 12 | +pip3 install -r requirements.txt |
| 13 | +``` |
| 14 | + |
| 15 | +## 3.Modify port number |
| 16 | + |
| 17 | +Edit the handle_control.py file |
| 18 | + |
| 19 | +```python |
| 20 | +import pygame |
| 21 | +import time |
| 22 | +from pymycobot import MyCobot |
| 23 | +import threading |
| 24 | +# Change com7 to the port number detected by your computer |
| 25 | +mc = MyCobot("com7") |
| 26 | +... |
| 27 | +``` |
| 28 | + |
| 29 | +Finally. run the program. |
| 30 | + |
| 31 | +```bash |
| 32 | +python3 handle_control.py |
| 33 | +``` |
| 34 | + |
| 35 | +> Note: After running the program, first click the **14** button to check the machine connection status, the machine connection status is normal (if it is abnormal, you will not be able to perform other operations, please solve the abnormal connection problem first), and then click **Right 1** button, other operations can only be performed after the machine reaches the initial point. |
| 36 | +
|
| 37 | + |
| 38 | + |
| 39 | +The corresponding functions of the handle buttons are as follows: |
| 40 | + |
| 41 | +- **1**: RX direction coordinate value increases |
| 42 | +- **2**: RX direction coordinate value decreases |
| 43 | +- **3**: RY direction coordinate value decreases |
| 44 | +- **4**: RY direction coordinate value increases |
| 45 | +- **5**: X direction coordinate value increases |
| 46 | +- **6**: X direction coordinate value decreases |
| 47 | +- **7**: Y direction coordinate value decreases |
| 48 | +- **8**: Y direction coordinate value increases |
| 49 | +- **9**: Z direction coordinate value increases |
| 50 | +- **10**: Z direction coordinate value decreases |
| 51 | +- **11**: RZ direction coordinate value decreases |
| 52 | +- **12**: RZ direction coordinate value increases |
| 53 | +- **13**: Wake up the handle. After the handle is not used for a long time after connection, it will enter sleep mode. You need to press this button to wake up. |
| 54 | +- **14**: Check the connection status of the machine. The atom LED flashes green three times to indicate that the machine is normal; flashes red three times to indicate that the state is abnormal. |
| 55 | +- **X**: Press and hold the button, the jaws continue to open |
| 56 | +- **Y**: Press and hold the button, the jaws continue to close |
| 57 | +- **A**: open suction pump |
| 58 | +- **B**: Shut down the suction pump |
| 59 | +- **Left 1**: Press and hold for 2s to initialize the robot to the joint zero state. |
| 60 | +- **Left 2**: Press and hold for 2s, the robot stops torque output and relaxes all joints. |
| 61 | +- **Right 1**: Press and hold for 2s to initialize the robot to move to the initial point. |
| 62 | +- **Right 2**: Press and hold for 2s, the robot turns on the torque output, and all joints are locked |
| 63 | + |
| 64 | +# 使用说明 |
| 65 | + |
| 66 | +## 1.连接设备 |
| 67 | + |
| 68 | +将MyCobot和手柄连接到电脑。 |
| 69 | + |
| 70 | +## 2.安装所需的包 |
| 71 | + |
| 72 | +打开终端,切换路径到此文件夹,运行如下指令: |
| 73 | + |
| 74 | +```bash |
| 75 | +pip3 install -r requirements.txt |
| 76 | +``` |
| 77 | + |
| 78 | +## 3.修改端口号 |
| 79 | + |
| 80 | +编辑 handle_control.py 文件 |
| 81 | + |
| 82 | +```python |
| 83 | +import pygame |
| 84 | +import time |
| 85 | +from pymycobot import MyCobot |
| 86 | +import threading |
| 87 | +# 将com7修改为你的电脑检测到的实际端口号 |
| 88 | +mc = MyCobot("com7") |
| 89 | +... |
| 90 | +``` |
| 91 | + |
| 92 | +最后,运行程序即可。 |
| 93 | + |
| 94 | +```bash |
| 95 | +python3 handle_control.py |
| 96 | +``` |
| 97 | + |
| 98 | +> 注意:在运行程序以后,首先要先点击**14**按钮,检查机器连接状态,机器连接状态正常(若为异常,将无法进行其他的操作,请先解决连接异常问题),再点击**Right 1**按钮,机器到达初始点位以后,才可以进行其他的操作。 |
| 99 | +
|
| 100 | +手柄按钮对应功能如下: |
| 101 | + |
| 102 | +- **1**: RX方向坐标值增加 |
| 103 | +- **2**: RX方向坐标值减小 |
| 104 | +- **3**: RY方向坐标值减小 |
| 105 | +- **4**: RY方向坐标值增大 |
| 106 | +- **5**: X方向坐标值增加 |
| 107 | +- **6**: X方向坐标值减小 |
| 108 | +- **7**: Y方向坐标值减小 |
| 109 | +- **8**: Y方向坐标值增加 |
| 110 | +- **9**: Z方向坐标值增加 |
| 111 | +- **10**: Z方向坐标值减小 |
| 112 | +- **11**: RZ方向坐标值减小 |
| 113 | +- **12**: RZ方向坐标值增加 |
| 114 | +- **13**: 唤醒手柄,手柄连接以后长时间不使用会进入休眠,需要按下此键来唤醒 |
| 115 | +- **14**: 检测机器连接状态,atom LED闪烁绿灯三次表示机器正常,闪烁红灯三次表示状态异常。 |
| 116 | +- **X**: 夹爪累加张开 |
| 117 | +- **Y**: 夹爪累加关闭 |
| 118 | +- **X**: 打开吸泵 |
| 119 | +- **X**: 关闭吸泵 |
| 120 | +- **Left 1**: 长按2s,初始化机器人至关节零位状态。 |
| 121 | +- **Left 2**: 长按2s,机器人停止力矩输出,放松所有关节。 |
| 122 | +- **Right 1**: 长按2s,初始化机器人至移动初始点位。 |
| 123 | +- **Right 2**: 长按2s,机器人打开力矩输出,所有关节锁定。 |
0 commit comments