Skip to content

Commit d0d08cd

Browse files
committed
save code
1 parent 8ced525 commit d0d08cd

File tree

8 files changed

+282
-27
lines changed

8 files changed

+282
-27
lines changed

docs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ We support Python2, Python3.5 or later.
9595
- [get\_plan\_acceleration](#get_plan_acceleration)
9696
- [set\_plan\_speed](#set_plan_speed)
9797
- [set\_plan\_acceleration](#set_plan_acceleration)
98-
- [set\_gservo\_round](#move_round)
98+
- [move\_round](#move_round)
9999
- [get\_basic\_version](#get_basic_version)
100-
- [set\_communicate\_mode](#set_transponder_mode)
100+
- [set\_transponder\_mode](#set_transponder_mode)
101101
- [get\_servo\_speeds](#get_servo_speeds)
102102
- [get\_servo\_currents](#get_servo_currents)
103103
- [get\_servo\_voltages](#get_servo_voltages)
@@ -112,7 +112,7 @@ We support Python2, Python3.5 or later.
112112
- [set\_solution\_angles](#set_solution_angles)
113113
- [joint\_brake](#joint_brake)
114114
- [get\_transponder\_mode](#get_transponder_mode)
115-
- [set\_transponder\_mode](#set_transponder_mode)
115+
- [set\_transponder\_mode](#set_transponder_mode-1)
116116
- [Raspberry pi -- GPIO](#raspberry-pi----gpio)
117117
- [gpio\_init](#gpio_init)
118118
- [gpio\_output](#gpio_output)

docs/myAGV.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/myAGV_en.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# myAgv
2+
3+
<details>
4+
<summary>Catalogue:</summary>
5+
6+
- [myAgv](#myagv)
7+
- [set\_led(mode, R, G, B)](#set_ledmode-r-g-b)
8+
- [get\_firmware\_version](#get_firmware_version)
9+
- [get\_motors\_current](#get_motors_current)
10+
- [get\_battery\_info](#get_battery_info)
11+
- [move\_control(direction\_1, direction\_2, direction\_3)](#move_controldirection_1-direction_2-direction_3)
12+
- [go\_ahead(go\_speed)](#go_aheadgo_speed)
13+
- [retreat(back\_speed)](#retreatback_speed)
14+
- [pan\_left(pan\_left\_speed)](#pan_leftpan_left_speed)
15+
- [pan\_right(pan\_right\_speed)](#pan_rightpan_right_speed)
16+
- [clockwise\_rotation(rotate\_right\_speed)](#clockwise_rotationrotate_right_speed)
17+
- [counterclockwise\_rotation(rotate\_left\_speed)](#counterclockwise_rotationrotate_left_speed)
18+
- [stop()](#stop)
19+
- [restore()](#restore)
20+
21+
</details>
22+
23+
## set_led(mode, R, G, B)
24+
25+
Set up LED lights
26+
27+
- **Parameters**
28+
29+
- **mode** – 1 - Set LED light color. 2 - Set the LED light to blink.
30+
31+
- **R** – (int) 0 ~ 255
32+
33+
- **G** – (int) 0 ~ 255
34+
35+
- **B** – (int) 0 ~ 255
36+
37+
## get_firmware_version
38+
39+
Get firmware version number
40+
41+
## get_motors_current
42+
43+
Get the total current of the motor
44+
45+
## get_battery_info
46+
47+
Read battery information
48+
49+
- **Return**
50+
list : [battery_data, battery_1_voltage, battery_2_voltage].
51+
`battery_data`:A string of length 6, represented from left to right: bit5, bit4, bit3, bit2, bit1, bit0.
52+
bit5 : Battery 2 is inserted into the interface 1 means inserted, 0 is not inserted.
53+
bit4 : Battery 1 is inserted into the interface, 1 means inserted, 0 is not inserted.
54+
bit3 : The adapter is plugged into the interface 1 means plugged in, 0 not plugged in.
55+
bit2 : The charging pile is inserted into the interface, 1 means plugged in, 0 is not plugged in.
56+
bit1 : Battery 2 charging light 0 means off, 1 means on.
57+
bit0 : Battery 1 charging light, 0 means off, 1 means on.
58+
`battery_1_voltage` : Battery 1 voltage in volts.
59+
`battery_2_voltage` : Battery 2 voltage in volts.
60+
61+
## move_control(direction_1, direction_2, direction_3)
62+
63+
Control the car to rotate forward, backward, left, right and forward/counterclockwise.
64+
65+
- **Parameters**
66+
67+
- **direction_1** – (int) Control forward or backward: 0 ~ 127 is backward, 129 ~ 255 is forward, 128 is stop.
68+
69+
- **direction_2** – (int) control left and right movement: 0 ~ 127 is right, 129 ~ 255 is left, 128 is stop.
70+
71+
- **direction_3** – (int) control rotation: 0 ~ 127 is clockwise, 129 ~ 255 is counterclockwise, 128 is stop.
72+
73+
## go_ahead(go_speed)
74+
75+
Control the car to move forward
76+
77+
- **Parameters**
78+
79+
- **go_speed** – (int) 1 ~ 127 is forward.The smaller the value, the smaller the speed
80+
81+
## retreat(back_speed)
82+
83+
Control the car back
84+
85+
- **Parameters**
86+
87+
- **back_speed** – (int) 1 ~ 127 is backward.The smaller the value, the smaller the speed
88+
89+
## pan_left(pan_left_speed)
90+
91+
Control the car to pan to the left
92+
93+
- **Parameters**
94+
95+
- **pan_left_speed** – (int) 1 ~ 127.The smaller the value, the smaller the speed
96+
97+
## pan_right(pan_right_speed)
98+
99+
Control the car to pan to the right
100+
101+
- **Parameters**
102+
103+
- **pan_right_speed** – (int) 1 ~ 127.The smaller the value, the smaller the speed
104+
105+
## clockwise_rotation(rotate_right_speed)
106+
107+
Control the car to rotate clockwise
108+
109+
- **Parameters**
110+
111+
- **rotate_right_speed** – (int) 1 ~ 127.The smaller the value, the smaller the speed
112+
113+
## counterclockwise_rotation(rotate_left_speed)
114+
115+
Control the car to rotate counterclockwise
116+
117+
- **Parameters**
118+
119+
- **rotate_left_speed** – (int) 1 ~ 127.The smaller the value, the smaller the speed
120+
121+
## stop()
122+
123+
stop motion.
124+
125+
## restore()
126+
127+
Motor stall recovery

docs/myAGV_zh.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# myAgv
2+
3+
<details>
4+
<summary>API目录:</summary>
5+
6+
- [myAgv](#myagv)
7+
- [set\_led(mode, R, G, B)](#set_ledmode-r-g-b)
8+
- [get\_firmware\_version](#get_firmware_version)
9+
- [get\_motors\_current](#get_motors_current)
10+
- [get\_battery\_info](#get_battery_info)
11+
- [move\_control(direction\_1, direction\_2, direction\_3)](#move_controldirection_1-direction_2-direction_3)
12+
- [go\_ahead(go\_speed)](#go_aheadgo_speed)
13+
- [retreat(back\_speed)](#retreatback_speed)
14+
- [pan\_left(pan\_left\_speed)](#pan_leftpan_left_speed)
15+
- [pan\_right(pan\_right\_speed)](#pan_rightpan_right_speed)
16+
- [clockwise\_rotation(rotate\_right\_speed)](#clockwise_rotationrotate_right_speed)
17+
- [counterclockwise\_rotation(rotate\_left\_speed)](#counterclockwise_rotationrotate_left_speed)
18+
- [stop()](#stop)
19+
- [restore()](#restore)
20+
21+
</details>
22+
23+
## set_led(mode, R, G, B)
24+
25+
设置led灯颜色
26+
27+
- **参数**
28+
29+
- **mode** – 1 - 常亮. 2 - 闪烁.
30+
31+
- **R** – (int) 0 ~ 255
32+
33+
- **G** – (int) 0 ~ 255
34+
35+
- **B** – (int) 0 ~ 255
36+
37+
## get_firmware_version
38+
39+
获取固件版本号
40+
41+
## get_motors_current
42+
43+
获取电机电流信息
44+
45+
## get_battery_info
46+
47+
获取电池信息
48+
49+
- **Return**
50+
list : [battery_data, battery_1_voltage, battery_2_voltage].
51+
`battery_data`: 长度为6的字符串, 从左到右依次对应: bit5, bit4, bit3, bit2, bit1, bit0.
52+
bit5 : 电池2插入接口,1表示插入,0未插入.
53+
bit4 : 电池1插入接口,1表示插入,0未插入.
54+
bit3 : 适配器插入接口,1表示插入,0未插入.
55+
bit2 : 充电桩插入接口,1表示插入,0未插入.
56+
bit1 : 电池2充电灯,0表示没亮,1表示亮.
57+
bit0 : 电池1充电灯,0表示没亮,1表示亮.
58+
`battery_1_voltage` : 电池1电压.
59+
`battery_2_voltage` : 电池2电压.
60+
61+
## move_control(direction_1, direction_2, direction_3)
62+
63+
运动控制接口,控制小车前进、后退、平移、旋转.
64+
65+
- **参数**
66+
67+
- **direction_1** – (int) 控制前进或者后退: 0 ~ 127 表示后退, 129 ~ 255 表示前进, 128 表示停止.
68+
69+
- **direction_2** – (int) 控制左右平移: 0 ~ 127 表示向右平移, 129 ~ 255 表示向左平移, 128 表示停止.
70+
71+
- **direction_3** – (int) 控制旋转: 0 ~ 127 表示顺时针旋转, 129 ~ 255 表示逆时针旋转, 128 表示停止.
72+
73+
## go_ahead(go_speed)
74+
75+
控制前进
76+
77+
- **参数**
78+
79+
- **go_speed** – (int) 1 ~ 127 数值越小,速度越慢
80+
81+
## retreat(back_speed)
82+
83+
控制后退
84+
85+
- **参数**
86+
87+
- **back_speed** – (int) 1 ~ 127 数值越小,速度越慢
88+
89+
## pan_left(pan_left_speed)
90+
91+
控制左平移
92+
93+
- **参数**
94+
95+
- **pan_left_speed** – (int) 1 ~ 127 数值越小,速度越慢
96+
97+
## pan_right(pan_right_speed)
98+
99+
控制右平移
100+
101+
- **参数**
102+
103+
- **pan_right_speed** – (int) 1 ~ 127 数值越小,速度越慢
104+
105+
## clockwise_rotation(rotate_right_speed)
106+
107+
控制顺时针旋转
108+
109+
- **参数**
110+
111+
- **rotate_right_speed** – (int) 1 ~ 127 数值越小,速度越慢
112+
113+
## counterclockwise_rotation(rotate_left_speed)
114+
115+
控制逆时针旋转
116+
117+
- **参数**
118+
119+
- **rotate_left_speed** – (int) 1 ~ 127 数值越小,速度越慢
120+
121+
## stop()
122+
123+
停止运动
124+
125+
## restore()
126+
127+
堵转恢复

pymycobot/mecharm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
from pymycobot import MyCobot
33

44
class MechArm(MyCobot):
5-
def __init__(self, port, baudrate="115200", timeout=0.1, debug=False):
6-
super(MechArm, self).__init__(port, baudrate, timeout, debug)
5+
def __init__(self, port, baudrate="115200", timeout=0.1, debug=False, thread_lock=False):
6+
super(MechArm, self).__init__(port, baudrate, timeout, debug, thread_lock)

pymycobot/myagv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,6 @@ def get_muc_info(self):
274274
return res
275275

276276
def restore(self):
277-
""""""
277+
"""Motor stall recovery"""
278278
self._mesg(ProtocolCode.RESTORE.value, 1)
279279

pymycobot/mybuddy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ def sync_send_angles(self, id, degrees, speed, timeout=15):
407407
"""
408408
t = time.time()
409409
self.send_angles(id, degrees, speed)
410+
time.sleep(0.5)
410411
while time.time() - t < timeout:
411412
f = self.is_in_position(id, degrees, 0)
412413
if f == 1:
@@ -425,6 +426,7 @@ def sync_send_coords(self, id, coords, speed, mode=0, timeout=15):
425426
"""
426427
t = time.time()
427428
self.send_coords(id, coords, speed, mode)
429+
time.sleep(0.5)
428430
while time.time() - t < timeout:
429431
if self.is_in_position(id, coords, 1) == 1:
430432
break

tests/rasp_mypall_test_gui.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -330,48 +330,48 @@ def _aging_test(self):
330330
self.stop_test = False
331331
while True and time.time() - start < 60*30 and self.stop_test == False:
332332
self.mycobot.set_color(255, 0, 0)
333-
self.mycobot.wait(5).send_angles([0, 0, 0, 0, 0], 95)
333+
self.mycobot.wait(5).send_angles([0, 0, 0, 0], 95)
334334
self.mycobot.wait(3).send_angles([-160, 0, 0, 0], 95)
335335
self.mycobot.wait(3).send_angles([160, 0, 0, 0], 95)
336336
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 95)
337337
self.mycobot.wait(3).send_angles([0, 80, 0, 0], 95)
338338
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 95)
339-
self.mycobot.wait(3).send_angles([0, 0, -90, 0], 95)
340-
self.mycobot.wait(3).send_angles([0, 0, -60, 0], 95)
339+
self.mycobot.wait(3).send_angles([0, 0, 20, 0], 95)
340+
self.mycobot.wait(3).send_angles([0, 0, 40, 0], 95)
341341
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 95)
342342
self.mycobot.wait(3).send_angles([0, 0, 0, 180], 95)
343343
self.mycobot.wait(3).send_angles([0, 0, 0, -180], 95)
344344
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 95)
345345

346346
# middle
347347
self.mycobot.set_color(0, 255, 0)
348-
self.mycobot.wait(5).send_angles([0, 0, 0, 0, 0], 55)
349-
self.mycobot.wait(3).send_angles([-160, 0, 0, 0], 55)
350-
self.mycobot.wait(3).send_angles([160, 0, 0, 0], 55)
348+
self.mycobot.wait(5).send_angles([0, 0, 0, 0], 55)
349+
self.mycobot.wait(5).send_angles([-160, 0, 0, 0], 55)
350+
self.mycobot.wait(5).send_angles([160, 0, 0, 0], 55)
351351
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 55)
352352
self.mycobot.wait(3).send_angles([0, 80, 0, 0], 55)
353353
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 55)
354-
self.mycobot.wait(3).send_angles([0, 0, -90, 0], 55)
355-
self.mycobot.wait(3).send_angles([0, 0, -60, 0], 55)
356-
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 55)
357-
self.mycobot.wait(3).send_angles([0, 0, 0, 180], 55)
358-
self.mycobot.wait(3).send_angles([0, 0, 0, -180], 55)
354+
self.mycobot.wait(3).send_angles([0, 0, 20, 0], 55)
355+
self.mycobot.wait(3).send_angles([0, 0, 40, 0], 55)
359356
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 55)
357+
self.mycobot.wait(6).send_angles([0, 0, 0, 180], 55)
358+
self.mycobot.wait(6).send_angles([0, 0, 0, -180], 55)
359+
self.mycobot.wait(6).send_angles([0, 0, 0, 0], 55)
360360

361361
# slow
362362
self.mycobot.set_color(0, 0, 255)
363-
self.mycobot.wait(5).send_angles([0, 0, 0, 0, 0], 15)
364-
self.mycobot.wait(3).send_angles([-160, 0, 0, 0], 15)
365-
self.mycobot.wait(3).send_angles([160, 0, 0, 0], 15)
366-
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 15)
363+
self.mycobot.wait(5).send_angles([0, 0, 0, 0], 15)
364+
self.mycobot.wait(8).send_angles([-160, 0, 0, 0], 15)
365+
self.mycobot.wait(8).send_angles([160, 0, 0, 0], 15)
366+
self.mycobot.wait(5).send_angles([0, 0, 0, 0], 15)
367367
self.mycobot.wait(3).send_angles([0, 80, 0, 0], 15)
368368
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 15)
369-
self.mycobot.wait(3).send_angles([0, 0, -90, 0], 15)
370-
self.mycobot.wait(3).send_angles([0, 0, -60, 0], 15)
371-
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 15)
372-
self.mycobot.wait(3).send_angles([0, 0, 0, 180], 15)
373-
self.mycobot.wait(3).send_angles([0, 0, 0, -180], 15)
369+
self.mycobot.wait(3).send_angles([0, 0, 20, 0], 15)
370+
self.mycobot.wait(3).send_angles([0, 0, 40, 0], 15)
374371
self.mycobot.wait(3).send_angles([0, 0, 0, 0], 15)
372+
self.mycobot.wait(8).send_angles([0, 0, 0, 180], 15)
373+
self.mycobot.wait(8).send_angles([0, 0, 0, -180], 15)
374+
self.mycobot.wait(5).send_angles([0, 0, 0, 0], 15)
375375
self.mycobot.send_angles([0, 0, 0, 0], 35)
376376
self.write_log_to_Text("老化测试结束。")
377377
# aging_test_content_py = textwrap.dedent(

0 commit comments

Comments
 (0)