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 nav_to(bot, pointlist, name): bot, mapid, pointlist = init("192.168.192.11", "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("没有找到定位点")
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 main(): bot, mapid, pointlist = init("192.168.192.11", '0109') print('我将去取货点,再去递货点') nav_to(bot,pointlist,'2')
bot.tts_sync('请将需要递送的物品放入仓内')
bot.door_ctrl(1)
bot.light_ctrl(1)
while True:
result = bot.exist_object()
if result:
bot.tts_sync('已取得物品')
bot.light_ctrl(0)
bot.door_ctrl(0)
break
else:
print('没有物体')
nav_to(bot,pointlist,'四')
bot.tts_sync('您的物品已送达,请取走')
bot.door_ctrl(1)
bot.light_ctrl(1)
while True:
result = bot.exist_object()
if result:
print('没拿出来')
time.sleep(0.5)
else:
bot.tts_sync('物品已取出')
bot.light_ctrl(0)
bot.door_ctrl(0)
nav_to(bot,pointlist,'起点')
break
arrray = {'零','一','二','三','四','五','六'}
while True:
m,n=None,None
index = 0
bot.tts_sync('黑子说话')
res = bot.asr_sync(8)
print("你说的内容:", res)
for char in res:
if char in arrray:
index += 1
if index ==1:
m = char
elif index == 2:
n = char
bot.tts_sync(f'我要到{m}号点取货,到{n}号点送货')
break
if m and n:
break
print(res)
print('重新说')
nav_to(bot,pointlist,f'{m}')
bot.tts_sync('请将需要递送的物品放入仓内')
bot.door_ctrl(1)
bot.light_ctrl(1)
wed = bot.exist_object()
while True:
if wed:
bot.tts_sync('已取得物品')
bot.light_ctrl(0)
bot.door_ctrl(0)
break
else:
bot.tts_sync('没有物品')
nav_to(bot,pointlist,f'{n}')
bot.tts_sync('您的物品已送达,请取走')
bot.door_ctrl(1)
bot.light_ctrl(1)
while True:
result = bot.exist_object()
if result:
print('没拿出来')
else:
bot.tts_sync('物品已取出')
bot.light_ctrl(0)
bot.door_ctrl(0)
nav_to(bot,pointlist,'起点')
def charge(): bot, map, pointlist = init("192.168.192.11", '0109') while True: bot.tts_sync('请给我下达下一步指令') res = bot.asr_sync(3) print('你说的内容', {res}) if res: if "充电" in res: bot.tts_sync('好的我要去充电了,请不要拦住我') print('开始上桩') nav_to(bot, pointlist, '六') dst = next((f for f in pointlist if f["type"] == "charge"), None) print(dst['x'], dst['y'], dst['theta']) 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() break else: bot.tts_sync(f'我听到你说{res},再说一遍')
if name == "main":
main()
charge()
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.7.tar.gz.
File metadata
- Download URL: freezeee3-1.8.7.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3269c92c102ddf6d59ccfda11b5ba18e1a1c117d8756608de4d3d1221c3b75e9
|
|
| MD5 |
74a9a29297f485b2bfcdf388123d6bc5
|
|
| BLAKE2b-256 |
5fd6645fee84e9c8e47910d4e2e2b8e8a344c70499ef26db0a94fc84c32d2347
|
File details
Details for the file freezeee3-1.8.7-py3-none-any.whl.
File metadata
- Download URL: freezeee3-1.8.7-py3-none-any.whl
- Upload date:
- Size: 3.4 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 |
92812cd3be4bc012c2160975ba59fa61b2bef1d6b54aac9732420226b9ed894b
|
|
| MD5 |
ca31844972c0b3240162a20f52db4ff6
|
|
| BLAKE2b-256 |
b8dd6eba44d394a6666f70a1877c478360d1dfc6c7921099c5f2792627cf383c
|