Skip to main content

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

freezeee3-1.8.6.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freezeee3-1.8.6-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file freezeee3-1.8.6.tar.gz.

File metadata

  • Download URL: freezeee3-1.8.6.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

Hashes for freezeee3-1.8.6.tar.gz
Algorithm Hash digest
SHA256 65d12c659153a73f938d7dfc72f04547795aeb119f7d91d3d8573d0a12c6425c
MD5 259d7ae5e192b32326b48e0b8f0d81d8
BLAKE2b-256 625bac190092b7ff7c0f2c865534ecf8e4d1d2e0aebfc015ac1a4cfdf6152f5b

See more details on using hashes here.

File details

Details for the file freezeee3-1.8.6-py3-none-any.whl.

File metadata

  • Download URL: freezeee3-1.8.6-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

Hashes for freezeee3-1.8.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a52a36fa6041596f40b7ba7b679a63af7f047aa63bdc72e43c84c52c7f57ebfd
MD5 f26e4325f9201415c42037b687ad67d7
BLAKE2b-256 a9c78ece42b39bd489f4ddfec7e0bcf1262279862fcc9aeb44b6f298e7a81744

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page