20240905-0002

This commit is contained in:
zjq
2024-09-05 08:19:52 +00:00
parent 66c88e4cd7
commit f8080123ed
8 changed files with 135 additions and 248 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+115 -222
View File
@@ -55,253 +55,146 @@ def dlog_select_action(dlog_text=""):
"""
pinyin_text=pinyin.get(dlog_text, format='strip', delimiter="-")
print(pinyin_text)
#关键词 打开
if pinyin_text.find("da-kai") != -1:
if pinyin_text.find("yun-tu") != -1:
try:
os.system("uengine launch --action=android.intent.action.MAIN --package=com.sunborn.neuralcloud.cn --component=com.sunborn.neuralcloud.cn.GameMainActivity &")
snowboydecoder.play_audio_file("resources/语音库/云图计划.wav")
except:
print("已尝试打开云图计划")
return True
if pinyin_text.find("fa-pei-ren") != -1:
try:
os.system("/opt/apps/com.postman.postman/files/Postman &")
snowboydecoder.play_audio_file(snowboydecoder.DETECT_SCD[3])
except:
print("已尝试打开postman")
return True
if pinyin_text.find("Q-Q") != -1:
try:
os.system("qq &")
snowboydecoder.play_audio_file(snowboydecoder.DETECT_SCD[3])
except:
print("已尝试打开QQ")
return True
#关键词 云母
if pinyin_text.find("yun-mu") != -1:
try:
os.system("microsoft-edge-stable www.ymfm.online &")
snowboydecoder.play_audio_file(snowboydecoder.DETECT_SCD[2])
except:
print("已尝试FM")
return True
#关键词 天气
if pinyin_text.find("tian-qi") != -1:
# 今天
if pinyin_text.find("jin-tian") != -1:
try:
update_weather.update_w("jin-tian")
print("正在打开 迈迈天气")
os.system("microsoft-edge-stable resources/天气模块/weather.html &")
snowboydecoder.play_audio_file(snowboydecoder.DETECT_SCD[1])
except:
print("已尝试 打开 迈迈天气")
return True
#关键词 亮度变亮、变暗
global light_source
if pinyin_text.find("liang-du") != -1:
# 提高亮度
if pinyin_text.find("ti-gao") != -1:
if light_source <100:
light_source += 10
if light_source > 100:
light_source = 100
global temperature
# 打开
if pinyin_text.find("da-kai") != -1:
#灯光
if pinyin_text.find("-deng") != -1:
try:
light_source=500
requests.get("http://192.168.60.100:12221/setpower?power=on")
requests.get(f"http://192.168.60.100:12221/setlight?light={light_source}")
print("正在打开灯光")
except Exception as e:
print("出错")
return True
#指示器
if pinyin_text.find("-zhi-") !=-1:
try:
requests.get("http://192.168.60.100:12224/setpower",params={"power":"on"})
print("正在打开激光")
except:
print("出错")
return True
if pinyin_text.find("-ti") !=-1:
try:
requests.get("http://192.168.60.100:12222/setpower", params={"power": "on"})
print("正在打开黑体")
except:
print("出错")
return True
# 关闭
if pinyin_text.find("guan-bi") != -1:
#灯光
if pinyin_text.find("-deng") != -1:
try:
light_source=0
requests.get("http://192.168.60.100:12221/setpower?power=off")
print("正在关闭灯光")
except Exception as e:
print("出错")
return True
#指示器
if pinyin_text.find("-zhi-") !=-1:
try:
requests.get("http://192.168.60.100:12224/setpower",params={"power":"off"})
print("正在关闭激光")
except:
print("出错")
return True
#黑体
if pinyin_text.find("-ti") !=-1:
try:
requests.get("http://192.168.60.100:12222/setpower", params={"power": "off"})
print("正在关闭黑体")
except:
print("出错")
return True
#提高
if pinyin_text.find("ti-gao") != -1:
#亮度
if pinyin_text.find("liang-") != -1:
if light_source <1000:
light_source += 100
if light_source > 1000:
light_source = 1000
print(light_source)
requests.get(f"http://192.168.110.3:12221/setlight?light={light_source}")
requests.get(f"http://192.168.60.100:12221/setlight?light={light_source}")
print("调高亮度")
return light_source
# 降低亮
elif pinyin_text.find("jiang-di") != -1:
#
if pinyin_text.find("wen-") != -1:
if temperature <4000:
temperature += 200
if temperature > 4000:
temperature = 4000
print(temperature)
requests.get(f"http://192.168.60.100:12222/settemp?temp={temperature}")
print("调高温度")
return temperature
# 降低
if pinyin_text.find("jiang-di") != -1:
if pinyin_text.find("liang-") != -1:
if light_source > 0:
light_source -= 10
light_source -= 100
if light_source <0:
light_source = 0
else:
print("出错")
print (light_source)
requests.get(f"http://192.168.110.3:12221/setlight?light={light_source}")
requests.get(f"http://192.168.60.100:12221/setlight?light={light_source}")
print("调低亮度")
return light_source
# 温度
elif pinyin_text.find("wen-") != -1:
if temperature >0:
temperature -= 200
if temperature<0:
temperature=0
print(temperature)
requests.get(f"http://192.168.60.100:12222/settemp?temp={temperature}")
print("调低温度")
return temperature
#关键词 光源
if pinyin_text.find("guang-yuan") != -1:
# 关闭光源
if pinyin_text.find("guan-bi") != -1:
try:
requests.get("http://192.168.110.3:12221/setpower", params={"power": "off"})
print("正在关闭光源")
except :
print("出错")
return True
# 打开光源
elif pinyin_text.find("da-kai") != -1:
try:
requests.get("http://192.168.110.3:12221/setpower", params={"power": "on"})
print("正在打开光源")
except Exception as e:
print("出错")
return True
#关键词 靶板
position_to_angle = {
0: 00000,
1: 45000,
2: 90000,
3: 135000,
4: 180000,
5: 225000,
6: 270000,
7: 315000
0: 85300,
1: 120300,
2: 149300,
3: 178300,
4: 207300,
5: 236300,
6: 265300,
7: 294300,
8: 323300,
9: 352300,
10: 381300,
11: 410300
}
global target_position
if pinyin_text.find("biao-ban") !=-1:
if pinyin_text.find("guan-bi") !=-1:
try:
requests.get("http://192.168.110.3:12231/setpower", params={"power": "off"})
print("正在关闭靶板")
except:
print("出错")
return True
#打开靶板
elif pinyin_text.find("da-kai") !=-1:
try:
requests.get("http://192.168.110.3:12231/setpower", params={"power": "on"})
print("正在打开靶板")
except:
print("出错")
return True
elif pinyin_text.find("huan") !=-1:
#切换
if pinyin_text.find("huan") !=-1:
if pinyin_text.find("ba") !=-1:
try:
target_position += 1
if target_position >7 :
target_position=0
angle = position_to_angle.get(target_position, 'Unknown')
print (target_position,angle)
requests.get(f"http://192.168.110.3:12231/setabsolute?angle={angle}")
print("换靶板")
requests.get(f"http://192.168.60.101:12231/setabsolute?angle={angle}")
return target_position
except:
print("出错")
'''elif pinyin_text.find("jiang-di") !=-1:
try:
#print ("下调靶板")
target_position += 1
if target_position > 5:
target_position=0
print(target_position)
else:
print(target_position)
return target_position
except:
print("出错")
return True'''
#关键词 黑体
#global black_body
if pinyin_text.find("hei-ti") !=-1:
if pinyin_text.find("da-kai") !=-1:
try:
requests.get("http://192.168.110.3:12222/setpower", params={"power": "on"})
print("正在打开黑体")
except:
print("出错")
return True
elif pinyin_text.find("guan-bi") !=-1:
try:
requests.get("http://192.168.110.3:12222/setpower", params={"power": "off"})
print("正在关闭黑体")
except:
print("出错")
return True
'''elif pinyin_text.find("geng-huan") !=-1:
if black_body <3:
black_body += 1
elif black_body >3:
black_body = 0
print(black_body)
return black_body'''
# 关键词 激光器
if pinyin_text.find("ji-guang") !=-1:
if pinyin_text.find("da-kai") !=-1:
try:
requests.get("http://192.168.110.3:12224/setpower",params={"power":"on"})
print("正在打开激光")
except:
print("出错")
return True
elif pinyin_text.find("guan-bi") !=-1:
try:
requests.get("http://192.168.110.3:12224/setpower",params={"power":"off"})
print("正在关闭激光器")
except:
print("出错")
return True
# 关键词 温度
global temperature
if pinyin_text.find("wen-du") !=-1:
# 提高温度
if pinyin_text.find("ti-gao") != -1:
if temperature <100:
temperature += 10
if temperature > 100:
temperature = 100
print(temperature)
requests.get(f"http://192.168.110.3:12222/settemp?temp={temperature}")
return temperature
# 降低 温度
elif pinyin_text.find("jiang-di") != -1:
if temperature >0:
temperature -= 10
if temperature<0:
temperature=0
print(temperature)
requests.get(f"http://192.168.110.3:12222/settemp?temp={temperature}")
return temperature
elif pinyin_text.find("da-kai") !=-1:
print("打开温度")
elif pinyin_text.find("guan-bi") !=-1:
print("关闭温度")
#关键词 关机
global shutdown_key
if pinyin_text.find("guan-ji") != -1:
# 关机
if pinyin_text.find("que-ren") != -1:
if shutdown_key == 1:
try:
print("正在关机")
os.system("poweroff &")
snowboydecoder.play_audio_file(snowboydecoder.DETECT_SCD[1])
except:
print("已尝试 关机")
return True
print("请再说一遍 “确认关机”")
shutdown_key = 1
return False
+19 -25
View File
@@ -1,31 +1,25 @@
《=================================================================》
----- ----- ------ ------
/ \ / \ / \ | |
/ \ / \ / /\ \ ------
/ /\ \/ /\ \ / / \ \ ------
/ / \ / \ \ / ------ \ | |
| | \ / | | / -------- \ | |
| | | | | | | | | | | |
| | | | | | | | | | | |
----- ----- ----- ----- ----- ------
《=================================================================》
陕西智远科峰光电语音助手 小峰
____________________________________________________________________
云图计划》 唯一真神 迈迈 智能助手
智远科峰》 小峰 智能助手
●交互(干活)关键词为 “你好迈迈” ●互动(喊着玩)关键词为 “迈迈”
唤醒词 "你好 小峰"
操作词语
"打开 卤素灯"
"关闭 卤素灯"
"调高 亮度"
"调低 亮度"
"切换 靶板"
"开打 激光"
"关闭 激光"
"启用 黑体"
"停用 黑体"
"调高 温度"
"降低 温度"
____________________________________________________________________
开发者:@不折不扣007
共风工作室 www.goforstudio.com
云母锋芒网 www.ymfm.online
二创作品仅供娱乐【还有我水毕业论文】,严禁用于商业用途
本项目采用 CC0 协议,作者放弃一切权利
CC0 协议 适用范围仅为本项目代码部分
资源部分(包含音频、模型、视频、美术素材等)权利所有权利归“上海散爆网络”所有
____________________________________________________________________
+1 -1
View File
@@ -12,7 +12,7 @@ from ctypes import *
from contextlib import contextmanager
logging.basicConfig()
logger = logging.getLogger("迈迈察觉到")
logger = logging.getLogger("小峰察觉到")
logger.setLevel(logging.INFO)
TOP_DIR = os.path.dirname(os.path.abspath(__file__))