smartpi 0.1.9__py3-none-any.whl → 0.1.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
smartpi/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  __all__ = ["base_driver"]
2
2
 
3
- __version__ = "0.1.9"
3
+ __version__ = "0.1.10"
4
4
 
smartpi/base_driver.py CHANGED
@@ -55,7 +55,7 @@ MIN_FRAME_LEN = 9 # 最小帧长度
55
55
 
56
56
  # 串口配置参数
57
57
  SERIAL_PORT = "/dev/ttyS3" # 串口设备路径
58
- BAUD_RATE = 115200 # 波特率
58
+ BAUD_RATE = 921600 # 波特率
59
59
  TIMEOUT = 0.1 # 读取超时时间(秒)
60
60
 
61
61
  ser = serial.Serial(
@@ -75,7 +75,7 @@ def uart3_init() -> Optional[serial.Serial]:
75
75
  """初始化串口"""
76
76
  try:
77
77
  if ser.is_open:
78
- print("UART3初始化成功")
78
+ # print("UART3初始化成功")
79
79
  return ser
80
80
  else:
81
81
  print("Error opening UART3")
smartpi/move.py CHANGED
@@ -4,7 +4,7 @@ from typing import List, Optional
4
4
  from smartpi import base_driver
5
5
 
6
6
 
7
- #以速度移动xdir:方向forward、backward、turnright、turnleft ; speed:0~100; second:x秒
7
+ #以速度移动x秒:dir:方向forward、backward、turnright、turnleftspeed:0~100;second:x秒
8
8
  def run_second(dir:bytes,speed:bytes,second:bytes) -> Optional[bytes]:
9
9
  move_str=[0xA0, 0x01, 0x11, 0x71, 0x00, 0x71, 0x00, 0x71, 0x00, 0xBE]
10
10
 
@@ -26,7 +26,7 @@ def run_second(dir:bytes,speed:bytes,second:bytes) -> Optional[bytes]:
26
26
  else:
27
27
  return 0
28
28
 
29
- #以速度移动x度(编码) dir:方向forward、backward、turnright、turnleftspeed:0~100angle:x角度
29
+ #以速度移动x度:dir:方向forward、backward、turnright、turnleftspeed:0~100angle:65535
30
30
  def run_angle(dir:bytes,speed:bytes,angle:int) -> Optional[bytes]:
31
31
  move_str=[0xA0, 0x01, 0x12, 0x71, 0x00, 0x71, 0x00, 0x81, 0x00, 0x00, 0xBE]
32
32
 
@@ -49,8 +49,8 @@ def run_angle(dir:bytes,speed:bytes,angle:int) -> Optional[bytes]:
49
49
  else:
50
50
  return 0
51
51
 
52
- #以速度移动 dir:方向forward、backward、turnright、turnleft ; speed:0~100;
53
- def run(dir:bytes,speed:int) -> Optional[bytes]:
52
+ #以速度移动:dir:方向forward、backward、turnright、turnleftspeed:0~100;
53
+ def run(dir:bytes,speed:bytes) -> Optional[bytes]:
54
54
  move_str=[0xA0, 0x01, 0x13, 0x71, 0x00, 0x71, 0x00, 0xBE]
55
55
 
56
56
  if dir=="forward":
@@ -61,17 +61,8 @@ def run(dir:bytes,speed:int) -> Optional[bytes]:
61
61
  move_str[4]=0x03
62
62
  elif dir=="turnleft":
63
63
  move_str[4]=0x04
64
-
65
- if speed>100:
66
- m_par=100
67
- elif speed>=0 and speed<=100:
68
- m_par=speed
69
- elif speed<-100:
70
- m_par=156
71
- elif speed<=0 and speed>=-100:
72
- m_par=256+speed
73
64
 
74
- move_str[6]=m_par
65
+ move_str[6]=speed
75
66
 
76
67
  response = base_driver.single_operate_sensor(move_str)
77
68
  if response == -1:
@@ -79,7 +70,7 @@ def run(dir:bytes,speed:int) -> Optional[bytes]:
79
70
  else:
80
71
  return 0
81
72
 
82
- #设置左右轮速度移动xLspeed:-100~100; Rspeed:-100~100; second:x秒
73
+ #设置左右轮速度移动x秒:Lspeed:-100~100;Rspeed:-100~100;second:1~255
83
74
  def run_speed_second(Lspeed:int,Rspeed:int,second:bytes) -> Optional[bytes]:
84
75
  move_str=[0xA0, 0x01, 0x14, 0x71, 0x00, 0x71, 0x00, 0x71, 0x00, 0xBE]
85
76
 
@@ -113,7 +104,7 @@ def run_speed_second(Lspeed:int,Rspeed:int,second:bytes) -> Optional[bytes]:
113
104
  else:
114
105
  return 0
115
106
 
116
- #设置左右轮速度移动 Lspeed:-100~100; Rspeed:-100~100;
107
+ #设置左右轮速度移动:Lspeed:-100~100;Rspeed:-100~100;
117
108
  def run_speed(Lspeed:int,Rspeed:int) -> Optional[bytes]:
118
109
  move_str=[0xA0, 0x01, 0x15, 0x71, 0x00, 0x71, 0x00, 0xBE]
119
110
 
@@ -145,7 +136,7 @@ def run_speed(Lspeed:int,Rspeed:int) -> Optional[bytes]:
145
136
  else:
146
137
  return 0
147
138
 
148
- #设置左右轮功率移动 Lpower:0~100; Rpower:0~100;
139
+ #设置左右轮功率移动:Lpower:0~100;Rpower:0~100;
149
140
  def run_power(Lpower:bytes,Rpower:bytes) -> Optional[bytes]:
150
141
  move_str=[0xA0, 0x01, 0x17, 0x71, 0x00, 0x71, 0x00, 0xBE]
151
142
 
@@ -158,7 +149,7 @@ def run_power(Lpower:bytes,Rpower:bytes) -> Optional[bytes]:
158
149
  else:
159
150
  return 0
160
151
 
161
- #设置最大功率
152
+ #设置最大功率:M1:0~100;M2:0~100;M3:0~100;M4:0~100;M5:0~100;M6:0~100;
162
153
  def set_maxpower(M1:bytes,M2:bytes,M3:bytes,M4:bytes,M5:bytes,M6:bytes) -> Optional[bytes]:
163
154
  move_str=[0xA0, 0x01, 0x18, 0x71, 0x00, 0x71, 0x00, 0x71, 0x00, 0x71, 0x00, 0x71, 0x00, 0x71, 0x00, 0xBE]
164
155
 
@@ -185,7 +176,7 @@ def stop() -> Optional[bytes]:
185
176
  else:
186
177
  return 0
187
178
 
188
- #设置左右轮方向 Lmotor:1~6; Rmotor:1~6; state: no_reversal、all_reversal、left_reversal、right_reversal
179
+ #设置左右轮方向:Lmotor:1~6;Rmotor:1~6;state: no_reversal、all_reversal、left_reversal、right_reversal
189
180
  def set_move_init(Lmotor:bytes,Rmotor:bytes,state:bytes) -> Optional[bytes]:
190
181
  move_str=[0xA0, 0x01, 0x19, 0x71, 0x00, 0x71, 0x00, 0x71, 0x00, 0xBE]
191
182
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpi
3
- Version: 0.1.9
3
+ Version: 0.1.10
4
4
  Summary: A library use for H2-RCU
5
5
  Author: ZMROBO
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,5 +1,5 @@
1
- smartpi/__init__.py,sha256=1GIYn_KvjJ8KECZ8TW56CcZUERF5WVdQ-QM6gyofxlw,54
2
- smartpi/base_driver.py,sha256=nfvzjcVZGrRldtAeAtL4MDlEMh4qbF28gbrf1-71N0c,17994
1
+ smartpi/__init__.py,sha256=1D37WANsd4B0qjha8w25OFIvYG7gPmSKmAcbsLRRtvo,55
2
+ smartpi/base_driver.py,sha256=85buq4rHErH16lYjLPeQi6r4RDIXWztysjPbL7Upm1M,17995
3
3
  smartpi/color_sensor.py,sha256=IubJb8zd87oWf3qTn07wTHM2vjUADwgSdXUChGgovHw,492
4
4
  smartpi/cw2015.py,sha256=1lAF-pi_ye_ya1AZQS1sjbgsDf7MThO5IAskKsNGBzA,5695
5
5
  smartpi/gui.py,sha256=E98_soyWbEf_dwYhXZgMSXrgY5QuYoDTuFCPK63flIQ,2102
@@ -7,12 +7,12 @@ smartpi/humidity.py,sha256=-awlSiy7ea6iwtirUMdDAMmmdIgVQZ3D7cDzgXmy314,493
7
7
  smartpi/led.py,sha256=92SBKjQbg1HN6rtKRH1NNWvAFRBP2-5OUGM9muOvhyQ,526
8
8
  smartpi/light_sensor.py,sha256=wsW0_ZnKeHN6IWRH3CIybKLdHPVK2I8jSTCqXlUECVk,565
9
9
  smartpi/motor.py,sha256=vdtLjHSwCodFkqhYh0y3l8RSl7IUlMwdNuktgQ3FdkQ,4449
10
- smartpi/move.py,sha256=MUu1Hnu77gebTJLjnYq27mLYrjvBvDh9a6TWJ-GXgLk,6155
10
+ smartpi/move.py,sha256=51yj4sd3Yllk0jprMKyUtNThP82I8E4HGqpD1eyta3k,5992
11
11
  smartpi/servo.py,sha256=_eM3ZAcBA543iVyFi8agOAXt0K3LEauxwyq7SFCpygM,4537
12
12
  smartpi/temperature.py,sha256=JeuiwsV6AUjnFQsQxgvjM3AuBrVvK5DuSE-BbX1Di2s,456
13
13
  smartpi/touch_sensor.py,sha256=jlKqvcoSmfZzH9zJeafBeVEQhxIYkkzXe4_fifX0COI,434
14
14
  smartpi/ultrasonic.py,sha256=5MS0EdQNirAl8iZbdwZ63fnjp6axHRZHw6dJwcwuXnQ,618
15
- smartpi-0.1.9.dist-info/METADATA,sha256=7JJLk0Uol-2FcoiVBjYyqYhCIuKfilRYAxSuwEv4fKc,310
16
- smartpi-0.1.9.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
17
- smartpi-0.1.9.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
18
- smartpi-0.1.9.dist-info/RECORD,,
15
+ smartpi-0.1.10.dist-info/METADATA,sha256=VaNgj97czc_Uy1YTmZtVm05z7-bYm7zGr3kG26FN0qI,311
16
+ smartpi-0.1.10.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
17
+ smartpi-0.1.10.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
18
+ smartpi-0.1.10.dist-info/RECORD,,