for a competetion
Project description
import time import creabot
def init(id, name): bot = creabot.Creabot(id) maplist = bot.list_map() targetmap = next((f for f in maplist if f["name"] == name), None) if targetmap: mapid = targetmap["id"] bot.set_map(mapid) pointlist = bot.list_map_point(mapid) print(pointlist) return bot, mapid, pointlist else: print("目标地图未找到") exit()
def anchor(): bot, mapid, pointlist=init("192.168.197.144","0109")
dss = next((f for f in pointlist if f["type"] == "anchor_point"), None)
if dss:
print("正在重定位")
bot.tts_sync("开始重定位,请稍候")
bot.relocate_sync(dss["x"], dss["y"], dss["theta"])
bot.tts_sync("重定位完成")
else:
print("没有找到定位点")
bot.tts_sync("没有找到定位点")
def nav_to(bot, pointlist, name):
bot, mapid,pointlist = init("192.168.197.144","0109")
anchor()
dst = next((f for f in pointlist if f["name"] == name), None)
if dst:
print(f"正在导航去{name}点")
bot.tts_sync(f"正在导航去{name}点,请稍候")
bot.start_navigation_sync(dst["x"], dst["y"], dst["theta"], 0.5)
bot.tts_sync(f"已到达{name}点")
else:
print("点位名称不存在")
bot.tts_sync("点位名称不存在,请确认指令")
def check_object_and_door(bot): bot.tts_sync("开始检测物体") while True: obj = bot.exist_object() if obj: bot.tts_sync('发现物体,正在关门') bot.door_ctrl(0) break else: bot.tts_sync('当前没有检测到物品')
def main(): bot , mapid, pointlist = init("192.168.197.144",'0109') while True: bot.tts_sync('黑子说话')
res = bot.asr_sync(3)
print("你说的内容:", res)
if res:
if '四五六' in res or '456' in res:
bot.tts_sync('我将去取货点,再去递货点')
nav_to(bot, pointlist, "03")
bot.tts_sync('放东西')
bot.door_ctrl(1)
bot.light_ctrl(1)
bot.tts_sync('三秒关门')
time.sleep(3)
check_object_and_door(bot)
bot.door_ctrl(0)
bot.light_ctrl(0)
bot.tts_sync('我要去递货点了')
nav_to(bot,pointlist,'01')
bot.door_ctrl(1)
while True:
result = bot.exist_object()
if result:
bot.tts_sync('赶紧拿走')
bot.light_ctrl(1)
else:
bot.tts_sync('拿走不谢')
bot.light_ctrl(0)
break
bot.tts_sync('两秒后关门')
time.sleep(2)
bot.door_ctrl(0)
break
else:
bot.tts_sync(f'我听到你说:{res},我不知道啥意思')
def charge(): bot,map,pointlist = init("192.168.197.144",'0109') while True: bot.tts_sync('请下达下一指令') res = bot.asr_sync(3) print('你说的内容',{res}) if res: if "充电" in res: bot.tts_sync('出发充电') charge_ctrl() break else: bot.tts_sync(f'我听到你说{res},我不理解')
def charge_ctrl(): bot,map,pointlist = init("192.168.197.144",'0109') dst =next((f for f in pointlist if f["type"] == "charge"), None) print(dst['x'],dst['y'],dst['theta']) print('开始上桩') nav_to(bot,pointlist,'06') step = bot.dock_charge_on_sync('0109',dst['x'],dst['y'],dst['theta']) if step: time.sleep(10) bot.tts_sync('充电下桩') bot.dock_charge_off_sync()
if name == "main": main() nav_to("192.168.197.144",'0109','00') charge() #charge_ctrl()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file freezeee3-1.8.5.tar.gz.
File metadata
- Download URL: freezeee3-1.8.5.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e83a6eb6771a83db85673714ee2419ca2b3eeb6885c2c0ba6b1b7e402509c90b
|
|
| MD5 |
27b51a0edfda8d400684f70863b045ed
|
|
| BLAKE2b-256 |
84436dbe222134bc6accc09b181556b9b925300afd5474343125407393d01c00
|
File details
Details for the file freezeee3-1.8.5-py3-none-any.whl.
File metadata
- Download URL: freezeee3-1.8.5-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a584bfe21bfb5d1aa55b770dec07b93507b3184179cb4bcab5f286145f03489f
|
|
| MD5 |
f1a9a36086641342dee698602fa13971
|
|
| BLAKE2b-256 |
86f1cfecf1b932771919ea78421bccdf9ffaf020e58b044888a60444e2bc3194
|