2024-6-10 21:47:29 [显示全部楼层]
660浏览
查看: 660|回复: 3

[求助问答] 运行报错,ImportError: bad magic number in 'helloFly': b'U\r\r\n'

[复制链接]
Traceback (most recent call last):
  File "C:\Users\admin\Documents\mindplus-py\user\2024-06-10-21-15-27\.cache-file.py", line 5, in <module>
    from helloFly import fly
ImportError: bad magic number in 'helloFly': b'U\r\r\n'
>>>
报错后要重新编写。

报错

报错

报错

报错

chenxi1128  学徒
 楼主|

发表于 2024-6-12 21:28:44

解决了

这个错误是mind+的版本和扩展的版本不一致

1.72版本mind+  需要导入的扩展是hellofly3.6才行

用最新版本的mind+ V1.80RC3.1  搭配hellofly3.8


解决了
回复

使用道具 举报

chenxi1128  学徒
 楼主|

发表于 2024-6-10 21:48:31

#  -*- coding: UTF-8 -*-

# MindPlus
# Python
from helloFly import fly


fh = fly()
fh.setLocation(0,[70,45])
fh.zSpeed(0,30)
fh.takeOff(0,50)
fh.flyCtrl(0,4)
fh.goTo(0,[70,45,50])
fh.sleep(0.1)
fh.servoCtrl(0,70)
fh.sleep(0.1)
fh.xySpeed(0,30)
fh.moveCtrl(0,1,78)
fh.sleep(0.1)
fh.moveCtrl(0,3,13)
fh.sleep(0.1)
fh.mvCheckTag(0,406)
fh.sleep(0.1)
fh.flyCtrl(0,4)
fh.sleep(0.1)
fh.zSpeed(0,30)
fh.flyCtrl(0,0)
fh.sleep(2)
fh.servoCtrl(0,20)
fh.sleep(0.1)
fh.takeOff(0,50)
fh.sleep(0.1)
fh.moveCtrl(0,1,45)
fh.mvCheckTag(0,230)
fh.sleep(0.1)
fh.moveCtrl(0,4,62)
fh.mvCheckTag(0,184)
fh.flyCtrl(0,4)
fh.sleep(0.1)
fh.moveCtrl(0,1,56)
fh.mvCheckTag(0,66)
fh.flyCtrl(0,4)
fh.sleep(0.1)
fh.moveCtrl(0,3,65)
fh.mvCheckTag(0,12)
fh.flyCtrl(0,4)
fh.sleep(0.1)
fh.moveCtrl(0,1,85)
fh.mvCheckTag(0,108)
fh.flyCtrl(0,4)
fh.sleep(0.1)
fh.moveCtrl(0,4,65)
fh.mvCheckTag(0,188)
fh.flyCtrl(0,4)
fh.sleep(0.1)
fh.moveCtrl(0,1,75)
fh.sleep(0.1)
fh.mvCheckTag(0,150)
fh.flyCtrl(0,4)
fh.sleep(0.1)
fh.moveCtrl(0,3,60)
fh.sleep(0.1)
fh.mvCheckTag(0,112)
fh.sleep(0.1)
fh.flyCtrl(0,4)
fh.sleep(0.1)
fh.flyHigh(0,130)
fh.sleep(0.1)
fh.goTo(0,[60,385,130])
fh.sleep(0.1)
fh.tofSwitch(0,0)
fh.sleep(0.1)
fh.moveCtrl(0,1,80)
fh.sleep(0.1)
fh.mvCheckTag(0,146)
fh.sleep(0.1)
fh.flyCtrl(0,4)
fh.sleep(0.1)
fh.flyHigh(0,120)
fh.sleep(0.1)
fh.goTo(0,[60,463,120])
fh.sleep(0.1)
fh.moveCtrl(0,1,75)
fh.sleep(0.1)
fh.tofSwitch(0,1)
fh.sleep(0.1)
fh.flyHigh(0,50)
fh.sleep(0.1)
fh.mvCheckTag(0,128)
fh.sleep(0.1)
fh.goTo(0,[60,540,30])
fh.sleep(0.1)
fh.flyCtrl(0,4)
fh.sleep(0.1)
fh.zSpeed(0,50)
fh.flyCtrl(0,0)
fh.sleep(2)
fh.servoCtrl(0,70)
fh.sleep(0.1)
fh.servoCtrl(0,20)
fh.sleep(-1)
回复

使用道具 举报

chenxi1128  学徒
 楼主|

发表于 2024-6-10 21:51:18

同样的报错
#  -*- coding: UTF-8 -*-

# MindPlus
# Python
from helloFly import fly
import time

# 自定义函数
def CanShuChuShiHuaBingQiFeiQiFeiGaoDu(fly_height, speed):
    global JiXieZhaoDaKaiJiaoDu
    global JiXieZhaoGuanBiJiaoDu
    global WeiZhi1BiaoQianHao
    global WeiZhi2BiaoQianHao
    global WeiZhi3BiaoQianHao
    global WeiZhi4BiaoQianHao
    global WeiZhi5BiaoQianHao
    global JiDiABiaoQian
    global JiDiBBiaoQian
    global JiangLuoDianBiaoQian
    JiDiABiaoQian = 400
    WeiZhi1BiaoQianHao = 401
    WeiZhi2BiaoQianHao = 402
    WeiZhi3BiaoQianHao = 403
    WeiZhi4BiaoQianHao = 404
    WeiZhi5BiaoQianHao = 405
    JiDiBBiaoQian = 406
    JiangLuoDianBiaoQian = 407
    JiXieZhaoDaKaiJiaoDu = 50
    JiXieZhaoGuanBiJiaoDu = 90
    time.sleep(0.2)
    fh.flyCtrl(0,4)
    fh.xySpeed(0,speed)
    time.sleep(0.2)
    fh.setTagDistance(0,40)
    time.sleep(0.2)
    fh.flyMode(0,1)
    time.sleep(0.2)
    fh.takeOff(0,fly_height)
    time.sleep(1)
def AJiDiWuZiShiQuFeiXingGaoDu(fly_height):
    global JiXieZhaoGuanBiJiaoDu
    global JiXieZhaoDaKaiJiaoDu
    global JiDiABiaoQian
    fh.moveSearchTag(0,1,100,JiDiABiaoQian)
    fh.goToTag(0,JiDiABiaoQian,fly_height)
    time.sleep(2)
    fh.servoCtrl(0,JiXieZhaoDaKaiJiaoDu)
    time.sleep(0.3)
    fh.zSpeed(0,20)
    DangQianGaoDu = fh.getFlySensor(0,"loc_z")
    JiangLuoGaoDu = 20
    while not ((DangQianGaoDu <= JiangLuoGaoDu)):
        fh.flyHigh(0,DangQianGaoDu)
        DangQianGaoDu = (DangQianGaoDu - 10)
        time.sleep(0.1)
    fh.zSpeed(0,50)
    fh.flyCtrl(0,0)
    time.sleep(1)
    fh.servoCtrl(0,JiXieZhaoGuanBiJiaoDu)
    time.sleep(1)
    fh.takeOff(0,60)
    time.sleep(1)
    fh.mvCheckTag(0,JiDiABiaoQian)
    time.sleep(1)
def RenWuWeiZhi1ZhangAiWeiRaoGan1ChuanHuan0(mission_choice, fly_height, speed):
    global WeiZhi1BiaoQianHao
    global WeiZhi2BiaoQianHao
    fh.goToTag(0,WeiZhi1BiaoQianHao,fly_height)
    time.sleep(2)
    if (mission_choice == 0):
        fh.WangDegYiDong(0,0,70,speed)
        time.sleep(1)
    if (mission_choice == 1):
        fh.goToTag(0,20,fly_height)
        fh.goToTag(0,40,fly_height)
def RenWuWeiZhi2ZhangAiWeiRaoGan1ChuanHuan0(mission_choice, fly_height, speed):
    global WeiZhi2BiaoQianHao
    global WeiZhi3BiaoQianHao
    fh.goToTag(0,WeiZhi2BiaoQianHao,fly_height)
    time.sleep(2)
    if (mission_choice == 0):
        fh.WangDegYiDong(0,0,70,speed)
        time.sleep(1)
    if (mission_choice == 1):
        fh.goToTag(0,62,fly_height)
        fh.goToTag(0,82,fly_height)
def RenWuWeiZhi3ZhangAiWeiRaoGan1ChuanHuan0(mission_choice, fly_height, speed):
    global WeiZhi3BiaoQianHao
    global WeiZhi4BiaoQianHao
    fh.goToTag(0,WeiZhi3BiaoQianHao,fly_height)
    time.sleep(2)
    if (mission_choice == 0):
        fh.WangDegYiDong(0,0,70,speed)
        time.sleep(1)
    if (mission_choice == 1):
        fh.goToTag(0,100,fly_height)
        fh.goToTag(0,120,fly_height)
def RenWuWeiZhi4ZhangAiWeiRaoGan1ChuanHuan0(mission_choice, fly_height, speed):
    global WeiZhi4BiaoQianHao
    global WeiZhi5BiaoQianHao
    fh.goToTag(0,WeiZhi4BiaoQianHao,fly_height)
    time.sleep(2)
    if (mission_choice == 0):
        fh.WangDegYiDong(0,0,70,speed)
        time.sleep(1)
    if (mission_choice == 1):
        fh.goToTag(0,142,fly_height)
        fh.goToTag(0,162,fly_height)
def RenWuWeiZhi5ZhangAiWeiRaoGan1ChuanHuan0(mission_choice, fly_height, speed):
    global WeiZhi5BiaoQianHao
    global JiDiBBiaoQian
    fh.goToTag(0,WeiZhi5BiaoQianHao,fly_height)
    time.sleep(2)
    if (mission_choice == 0):
        fh.WangDegYiDong(0,0,70,speed)
    if (mission_choice == 1):
        fh.goToTag(0,180,fly_height)
        fh.goToTag(0,200,fly_height)
def BJiDiJiangLuoTouFangFeiXingGaoDu(fly_height):
    global JiDiBBiaoQian
    global JiXieZhaoDaKaiJiaoDu
    global JiXieZhaoGuanBiJiaoDu
    fh.goToTag(0,JiDiBBiaoQian,fly_height)
    fh.zSpeed(0,20)
    DangQianGaoDu = fh.getFlySensor(0,"loc_z")
    JiangLuoGaoDu = 25
    while not ((DangQianGaoDu <= JiangLuoGaoDu)):
        fh.flyHigh(0,DangQianGaoDu)
        DangQianGaoDu = (DangQianGaoDu - 5)
        time.sleep(0.3)
    fh.zSpeed(0,50)
    fh.flyCtrl(0,0)
    time.sleep(1)
    fh.servoCtrl(0,JiXieZhaoDaKaiJiaoDu)
    time.sleep(1)
    fh.takeOff(0,60)
    time.sleep(1)
    fh.mvCheckTag(0,JiDiBBiaoQian)
def BJiDiQiFeiHouXunXianAXianLu1BXianLu2(choice, fly_height, speed):
    global JiDiBBiaoQian
    global JiangLuoDianBiaoQian
    fh.xySpeed(0,speed)
    fh.moveSearchTag(0,1,10,JiDiBBiaoQian)
    time.sleep(2)
    fh.goTo(0,[205,466,fly_height])
    fh.goTo(0,[206,396,fly_height])
    fh.goTo(0,[270,391,fly_height])
    fh.goTo(0,[290,321,fly_height])
    fh.goTo(0,[285,287,fly_height])
    fh.goTo(0,[263,237,fly_height])
    if (choice == 1):
        fh.goTo(0,[220,220,fly_height])
        fh.flyMode(0,0)
        time.sleep(0.3)
        fh.rotation(0,-90)
        time.sleep(2)
        fh.xySpeed(0,20)
        fh.flyMode(0,2)
        fh.moveCtrl(0,1,200)
        fh.moveCtrl(0,4,80)
        fh.moveSearchTag(0,4,30,JiangLuoDianBiaoQian)
        time.sleep(2)
    if (choice == 2):
        fh.goTo(0,[280,220,fly_height])
        fh.flyMode(0,0)
        time.sleep(0.3)
        fh.rotation(0,90)
        time.sleep(2)
        fh.xySpeed(0,20)
        fh.flyMode(0,2)
        fh.moveCtrl(0,1,200)
        fh.moveCtrl(0,3,80)
        fh.moveSearchTag(0,3,30,JiangLuoDianBiaoQian)
        time.sleep(2)


fh = fly()
CanShuChuShiHuaBingQiFeiQiFeiGaoDu(50, 30)
AJiDiWuZiShiQuFeiXingGaoDu(50)
RenWuWeiZhi1ZhangAiWeiRaoGan1ChuanHuan0(1, 80, 30)
RenWuWeiZhi2ZhangAiWeiRaoGan1ChuanHuan0(0, 96, 30)
RenWuWeiZhi3ZhangAiWeiRaoGan1ChuanHuan0(1, 80, 30)
RenWuWeiZhi4ZhangAiWeiRaoGan1ChuanHuan0(0, 38, 30)
RenWuWeiZhi5ZhangAiWeiRaoGan1ChuanHuan0(1, 80, 30)
BJiDiJiangLuoTouFangFeiXingGaoDu(50)
BJiDiQiFeiHouXunXianAXianLu1BXianLu2(1, 60, 30)
fh.flyCtrl(0,0)
fh.sleep(-1)
MonJune-202406102098..png
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail