smartpi 0.1.34__py3-none-any.whl → 0.1.36__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/servo.py CHANGED
@@ -9,6 +9,7 @@ def steer_angle(port:bytes,angle:bytes) -> Optional[bytes]:
9
9
  servo_str[0]=0XA0+port
10
10
  servo_str[4]=angle
11
11
  # response = base_driver.single_operate_sensor(servo_str,0)
12
+ time.sleep(0.005)
12
13
  base_driver.write_data(0X01, 0X02, servo_str)
13
14
  # if response == None:
14
15
  # return None
@@ -23,6 +24,7 @@ def steer_angle_delay(port:bytes,angle:bytes,second:bytes) -> Optional[bytes]:
23
24
  servo_str[5]=angle%256
24
25
  servo_str[7]=second
25
26
  # response = base_driver.single_operate_sensor(servo_str,0)
27
+ time.sleep(0.005)
26
28
  base_driver.write_data(0X01, 0X02, servo_str)
27
29
  # if response == None:
28
30
  # return None
@@ -35,6 +37,7 @@ def set_dir(port:bytes,dir:bytes) -> Optional[bytes]:
35
37
  servo_str[0]=0XA0+port
36
38
  servo_str[4]=dir
37
39
  # response = base_driver.single_operate_sensor(servo_str,0)
40
+ time.sleep(0.005)
38
41
  base_driver.write_data(0X01, 0X02, servo_str)
39
42
  # if response == None:
40
43
  # return None
@@ -65,6 +68,7 @@ def set_angle_ms(port:bytes,angle:bytes,ms:int) -> Optional[bytes]:
65
68
  servo_str[7]=ms//256
66
69
  servo_str[8]=ms%256
67
70
  # response = base_driver.single_operate_sensor(servo_str,0)
71
+ time.sleep(0.005)
68
72
  base_driver.write_data(0X01, 0X02, servo_str)
69
73
  # if response == None:
70
74
  # return None
@@ -76,6 +80,7 @@ def set_init(port:bytes) -> Optional[bytes]:
76
80
  servo_str=[0xA0, 0x12, 0x01, 0xBE]
77
81
  servo_str[0]=0XA0+port
78
82
  # response = base_driver.single_operate_sensor(servo_str,0)
83
+ time.sleep(0.005)
79
84
  base_driver.write_data(0X01, 0X02, servo_str)
80
85
  # if response == None:
81
86
  # return None
@@ -86,6 +91,7 @@ def set_init(port:bytes) -> Optional[bytes]:
86
91
  def get_angle(port:bytes) -> Optional[bytes]:
87
92
  servo_str=[0xA0, 0x13, 0x01, 0xBE]
88
93
  servo_str[0]=0XA0+port
94
+ time.sleep(0.005)
89
95
  response = base_driver.single_operate_sensor(servo_str,0)
90
96
  if response == None:
91
97
  return None
@@ -109,6 +115,7 @@ def set_speed(port:bytes,speed:int) -> Optional[bytes]:
109
115
 
110
116
  servo_str[4]=m_par
111
117
  # response = base_driver.single_operate_sensor(servo_str,0)
118
+ time.sleep(0.005)
112
119
  base_driver.write_data(0X01, 0X02, servo_str)
113
120
  # if response == None:
114
121
  # return None
@@ -134,6 +141,7 @@ def set_code_speed(port:bytes,code:int,speed:int) -> Optional[bytes]:
134
141
  servo_str[7]=m_par
135
142
 
136
143
  # response = base_driver.single_operate_sensor(servo_str,0)
144
+ time.sleep(0.005)
137
145
  base_driver.write_data(0X01, 0X02, servo_str)
138
146
  # if response == None:
139
147
  # return None
@@ -145,6 +153,7 @@ def reset_encode(port:bytes) -> Optional[bytes]:
145
153
  servo_str=[0xA0, 0x16, 0x01, 0xBE]
146
154
  servo_str[0]=0XA0+port
147
155
  # response = base_driver.single_operate_sensor(servo_str,0)
156
+ time.sleep(0.005)
148
157
  base_driver.write_data(0X01, 0X02, servo_str)
149
158
  # if response == None:
150
159
  # return None
@@ -155,6 +164,7 @@ def reset_encode(port:bytes) -> Optional[bytes]:
155
164
  def get_encoder(port:bytes) -> Optional[bytes]:
156
165
  servo_str=[0xA0, 0x17, 0x01, 0xBE]
157
166
  servo_str[0]=0XA0+port
167
+ time.sleep(0.005)
158
168
  response = base_driver.single_operate_sensor(servo_str,0)
159
169
  if response == None:
160
170
  return None
smartpi/temperature.py CHANGED
@@ -9,6 +9,7 @@ def get_value(port:bytes) -> Optional[bytes]:
9
9
  temp_str=[0XA0, 0X0C, 0X01, 0X71, 0X00, 0XBE]
10
10
  temp_str[0]=0XA0+port
11
11
  temp_str[4]=0
12
+ time.sleep(0.005)
12
13
  response = base_driver.single_operate_sensor(temp_str,0)
13
14
  if response == None:
14
15
  return None
smartpi/touch_sensor.py CHANGED
@@ -7,6 +7,7 @@ from smartpi import base_driver
7
7
  def get_value(port:bytes) -> Optional[bytes]:
8
8
  read_sw_str=[0xA0, 0x03, 0x01, 0xBE]
9
9
  read_sw_str[0]=0XA0+port
10
+ time.sleep(0.005)
10
11
  response = base_driver.single_operate_sensor(read_sw_str,0)
11
12
  if response == None:
12
13
  return None
smartpi/trace.py CHANGED
@@ -27,6 +27,7 @@ def get_chn_data(port:bytes, chn:bytes) -> Optional[bytes]:
27
27
  trace_str=[0xA0, 0x18, 0x01, 0x71, 0x00, 0xBE]
28
28
  trace_str[0]=0XA0+port
29
29
  trace_str[4]=chn
30
+ time.sleep(0.005)
30
31
  response = base_driver.single_operate_sensor(trace_str,0)
31
32
  if response == None:
32
33
  return None
@@ -44,28 +45,33 @@ def set_chn_color(port:bytes, color1:bytes, color2:bytes, color3:bytes, color4:b
44
45
  trace_str[12]=color5
45
46
  trace_str[14]=color6
46
47
  trace_str[16]=color7
47
- response = base_driver.single_operate_sensor(trace_str,0)
48
- if response == None:
49
- return None
50
- else:
51
- return response[4]
48
+ time.sleep(0.005)
49
+ base_driver.write_data(0X01, 0X02, trace_str)
50
+ # response = base_driver.single_operate_sensor(trace_str,0)
51
+ # if response == None:
52
+ # return None
53
+ # else:
54
+ return 0
52
55
 
53
56
  #循迹卡设置全部颜色 port:连接P端口;color:全部彩灯的颜色1~7(红、绿、蓝、黄、紫、青、白)
54
57
  def set_color(port:bytes, color:bytes) -> Optional[bytes]:
55
58
  trace_str=[0xA0, 0x20, 0x01, 0x71, 0x00, 0xBE]
56
59
  trace_str[0]=0XA0+port
57
60
  trace_str[4]=color
58
- response = base_driver.single_operate_sensor(trace_str,0)
59
- if response == None:
60
- return None
61
- else:
62
- return response[4]
61
+ time.sleep(0.005)
62
+ base_driver.write_data(0X01, 0X02, trace_str)
63
+ # response = base_driver.single_operate_sensor(trace_str,0)
64
+ # if response == None:
65
+ # return None
66
+ # else:
67
+ return 0
63
68
 
64
69
  #循迹卡单通道光值读取 port:连接P端口;chn:检测通道;正常返回:通道光值数据; 读取错误:None
65
70
  def get_analog(port:bytes, chn:bytes) -> Optional[bytes]:
66
71
  trace_str=[0xA0, 0x21, 0x01, 0x71, 0x00, 0xBE]
67
72
  trace_str[0]=0XA0+port
68
73
  trace_str[4]=20+chn
74
+ time.sleep(0.005)
69
75
  response = base_driver.single_operate_sensor(trace_str,0)
70
76
  if response == None:
71
77
  return None
@@ -78,6 +84,7 @@ def get_line_state(port:bytes, state:bytes) -> Optional[bytes]:
78
84
  trace_str=[0xA0, 0x22, 0x01, 0x71, 0x00, 0xBE]
79
85
  trace_str[0]=0XA0+port
80
86
  trace_str[4]=state
87
+ time.sleep(0.005)
81
88
  response = base_driver.single_operate_sensor(trace_str,0)
82
89
  if response == None:
83
90
  return None
@@ -90,7 +97,7 @@ def set_threshold(port:bytes, second:int) -> Optional[bytes]:
90
97
  trace_str[0]=0XA0+port
91
98
  trace_str[4]=second//256
92
99
  trace_str[5]=second%256
93
-
100
+ time.sleep(0.005)
94
101
  serial_lock.acquire() #获取线程锁
95
102
  fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
96
103
  base_driver.write_data(0X01, 0X02, trace_str)
smartpi/ultrasonic.py CHANGED
@@ -8,6 +8,7 @@ def get_value(port:bytes) -> Optional[bytes]:
8
8
  ultrasonic_str=[0xA0, 0x06, 0x00, 0xBE]
9
9
  ultrasonic_str[0]=0XA0+port
10
10
  ultrasonic_str[2]=1
11
+ time.sleep(0.005)
11
12
  response = base_driver.single_operate_sensor(ultrasonic_str,0)
12
13
 
13
14
  if response == None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpi
3
- Version: 0.1.34
3
+ Version: 0.1.36
4
4
  Summary: A library use for H2-RCU
5
5
  Author: ZMROBO
6
6
  Classifier: Programming Language :: Python :: 3
@@ -0,0 +1,32 @@
1
+ smartpi/__init__.py,sha256=0SmTGAk_hFkhC2_MwlEsEGFMvHJXjHqJTwP6Fin8cTI,356
2
+ smartpi/_gui.py,sha256=ij-6HZAEIwdy_hvU7f0NkyQjx_-eephijlKbGUhf8Uo,2177
3
+ smartpi/base_driver.py,sha256=difi-MhGoxvodSsQt1hYg-nx5fk4b-qU7D-5-A61LaY,20632
4
+ smartpi/camera.py,sha256=AVpZsMpW-24CP3BOfarjmRawMJdTOZY7Crq7FeLOqb4,3292
5
+ smartpi/color_sensor.py,sha256=ckIXD81YnqPo6nENAnipNp3gY12FJ235QKj0e8Cul9E,521
6
+ smartpi/cw2015.py,sha256=1lAF-pi_ye_ya1AZQS1sjbgsDf7MThO5IAskKsNGBzA,5695
7
+ smartpi/flash.py,sha256=-pUqg6FSVoBiLFKqrG9B4dFqn8lICnQsSPJr_MtZLIU,4132
8
+ smartpi/humidity.py,sha256=uoSFt5mAKr-dHz125uznHXAPeTN61ZR92_2nQmytQ5M,522
9
+ smartpi/led.py,sha256=6-y5MFGk0tN5N_WHclXbSRyP-anhCHhgXI3MdAQCKWM,617
10
+ smartpi/light_sensor.py,sha256=-ICMwQcWIZ6LGOz_A2WL5h5CL1v4opmlfacN35veMSE,2398
11
+ smartpi/motor.py,sha256=DvFzREEzyRafGmSCagU6ASeoE8fnAsKYI4oYMrkXXJc,5351
12
+ smartpi/move.py,sha256=s1ZnkFtp6SCBnxhBxp6qQjGbifdsY5hjVCwlarTsZto,6688
13
+ smartpi/onnx_hand_workflow.py,sha256=ZCoaWC6GygZSrhM6jhsuB6qmQ6GiAFFrso6rKAGmue8,8157
14
+ smartpi/onnx_image_workflow.py,sha256=-saM_NxR6yDz06xlWZOvHf6cq3zmtOCFhCyZTGqvuOk,6188
15
+ smartpi/onnx_pose_workflow.py,sha256=7hoZ31XfZRAbgmdQbgfK-xePniMa5mDEggV12F-Uq5c,20970
16
+ smartpi/onnx_text_workflow.py,sha256=6l9MTT2T1-rNye3_dSHLI2U749Z94aoRdkSe6CNXfHw,7191
17
+ smartpi/onnx_voice_workflow.py,sha256=jkMFzy3RUnLo8LZAuCUfsS3YCJWSZzZuiE4RFoQ2HZw,17440
18
+ smartpi/posenet_utils.py,sha256=o3scK41Eqvftav4y4vp6_6HinQWNCLeLpArXAzqQ-7s,8983
19
+ smartpi/rknn_hand_workflow.py,sha256=wsVN_PYP9M-1AFaN4yqrGksUBoamYfujW0nQq4nv3kU,10160
20
+ smartpi/rknn_image_workflow.py,sha256=4lTtcdmQ9KN5WiEnHayvqAd-dA0tiap5YXIqAMn5SoI,18444
21
+ smartpi/rknn_pose_workflow.py,sha256=LA6tXOI81R1IQhQvgBWLGV_I8Qa-ROUgXqj3kTEMfmc,27840
22
+ smartpi/rknn_text_workflow.py,sha256=KNBSetj3tmlLxdZOm0yzbiDnjH8S5191fuxh5Mi-uCY,9632
23
+ smartpi/rknn_voice_workflow.py,sha256=T8iRQWPtJYXqoHIZH2FiT1WLxwN3HQg4D-mg-5KvYdA,16326
24
+ smartpi/servo.py,sha256=0p09Jk-IVk5nLXz2AqFvytiYSSe4sMxdy1FaNMQijoY,5770
25
+ smartpi/temperature.py,sha256=xfM9V5dvJ9M-3rqnE2AjaYXEH9jP5s1_Myo4GEwH3NY,485
26
+ smartpi/touch_sensor.py,sha256=Zp7z0qnaZ99cuamakqDwI2tFd2a3CnjQ1rngdn_mZlM,463
27
+ smartpi/trace.py,sha256=HkoTleJnwseAue2J9wTFSXPgXaLx2Y-LE7Ip8UdoreE,4791
28
+ smartpi/ultrasonic.py,sha256=qrGge3G9_1s3ZdKYZRJ_FP8l_VhbpYEe-anlShooMwA,647
29
+ smartpi-0.1.36.dist-info/METADATA,sha256=mHZJnP9pZQCbO8IgC_Dit-jstmzpxq-nhFdbYHQCeC8,399
30
+ smartpi-0.1.36.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
31
+ smartpi-0.1.36.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
32
+ smartpi-0.1.36.dist-info/RECORD,,
@@ -1,20 +0,0 @@
1
- smartpi/__init__.py,sha256=ezLA647rfQ9QqjycJlgQhprLoRFWSnEO7MOlflsklaM,356
2
- smartpi/_gui.py,sha256=ij-6HZAEIwdy_hvU7f0NkyQjx_-eephijlKbGUhf8Uo,2177
3
- smartpi/base_driver.py,sha256=WtRBSkjcOHikU402lU1cBSVlRHhyWGZMll_zffg2F2U,20609
4
- smartpi/color_sensor.py,sha256=YXJjknYjp7teTZsHYZRAWgi73CH0MhBp1go9y0Inxyo,498
5
- smartpi/cw2015.py,sha256=1lAF-pi_ye_ya1AZQS1sjbgsDf7MThO5IAskKsNGBzA,5695
6
- smartpi/flash.py,sha256=-pUqg6FSVoBiLFKqrG9B4dFqn8lICnQsSPJr_MtZLIU,4132
7
- smartpi/humidity.py,sha256=nZwiBtMWKNipVM83ymajZACPHxkC2vUJjDMmCOPN9lw,499
8
- smartpi/led.py,sha256=HXebd7mRO6HUjO2Xc2LBgJlAew0-IAAKpvcmVRhdGcA,594
9
- smartpi/light_sensor.py,sha256=oG6hHr1Tb9Xcv-Y-OjhkED5DS1u82F-kduHKAiM3B5Q,2256
10
- smartpi/motor.py,sha256=HTH0JqZ0d8D2HRdQ6UT9wwqBkyqErq6QaMuS_ZsDq9A,5144
11
- smartpi/move.py,sha256=mYw5li1qQe97845cqclMksuaKOL9n_0E0n9652EIMcI,6046
12
- smartpi/servo.py,sha256=2KYMjjF72cTTq2RtPTDlVwIj7i5tMMGeXzKnk8SLdbE,5540
13
- smartpi/temperature.py,sha256=VT79CYA41q1d_4AM-Y0eIMeIw7AtCkSXjWVws6Yx5yE,462
14
- smartpi/touch_sensor.py,sha256=P57RRQlqY0KexpMi-ydqwF5albOKCBOGb0Rb6zeVTqk,440
15
- smartpi/trace.py,sha256=tut7BMbq87ShaR5eNuv7PZtAEz9DS5_BDf0_muIZ-tQ,4577
16
- smartpi/ultrasonic.py,sha256=kmVpUfvE1oHoqgv92ZU6Fi-sO6DSwm10ssKsImNeOkY,624
17
- smartpi-0.1.34.dist-info/METADATA,sha256=v0qlefo-v66aK6_3cxWr57MOAMlaEzWGajiEH5OcAzI,399
18
- smartpi-0.1.34.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
19
- smartpi-0.1.34.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
20
- smartpi-0.1.34.dist-info/RECORD,,