Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 无序类型int()_Python 3.x_Simulator - Fatal编程技术网

Python 3.x 无序类型int()

Python 3.x 无序类型int(),python-3.x,simulator,Python 3.x,Simulator,我是一个编程新手,我在这里尝试做的是一个无人机飞行模拟器。但我遇到的问题是,函数的类型是无序的,而对我来说,t不是函数。我尝试并寻找其他解决方案,但没有任何效果。。。提前谢谢! 哦,我是法国人,所以我用法语写函数对不起。。 以下是我的完整计划: charge = float(input("Masse de la charge (0-0.150kg)?: ")) masse = 0.850+charge #kg h_max = 2.5 #m v_montée = 0.25 #m/s v_d

我是一个编程新手,我在这里尝试做的是一个无人机飞行模拟器。但我遇到的问题是,函数的类型是无序的,而对我来说,t不是函数。我尝试并寻找其他解决方案,但没有任何效果。。。提前谢谢! 哦,我是法国人,所以我用法语写函数对不起。。 以下是我的完整计划:

charge = float(input("Masse de la charge (0-0.150kg)?: "))  
masse = 0.850+charge  #kg
h_max = 2.5 #m
v_montée = 0.25 #m/s 
v_descente = 0.75 #m/s
t_montée = h_max/v_montée #m/s
t_stationnement = 15 #s
t_descente = h_max/v_descente #s
t_total = t_montée + t_descente + t_stationnement #s
dti = 0.05 #s
nbre_intervalles = int((t_total)/dti)+1

def v_désirée(t):
    global vd
    vd = 0
    if 0 <= t < t_montée:
        vd = v_montée
    elif t_montée <= t < t_montée + t_stationnement:
        vd = 0
    elif t_montée + t_stationnement <= t < t_total:
        vd = v_descente
    return (vd)

def h_désirée(t): 
    global hd
    hd = 0
    hd = v_désirée(t) * t
    return (hd)

Ff = 1                                             
Poids = 9.81*masse                                   

def acc(t):                                            
    global a
    a = 0
    a = poussée(t) - masse*9.81 - 1
    return (a)

def h(t):
    global h
    h = 0
    if v_désirée(t) == v_montée:
        h = acc(poussée)/2 * t**2
    elif v_désirée(t) == 0:
        h = acc(poussée)/2 * (t-t_montée)**2 + v_montée*(t-t_montée) + h_max
    elif v_désirée(t) == v_descente:
        h = acc(poussée)/2 * (t-t_montée-t_stationnement)**2 + h_max
    return (h)

Kd = 10
Kp = 10

def erreur(t):
    global e
    e = 0
    e = h_désirée(t) - h(t)
    return (e)

def de(t):
    global de
    de = 0
    de = erreur(t+dti) - erreur(t)
    return (de)

def poussée(t):
    global p
    p = 0
    p = Kp * erreur(t) + Kd*de(t)
    return (p)

for i in range(0,nbre_intervalles+1):

    t = i*dti

    print("hdésirée=", h_désirée(t))
    print("h=", h(t))
    print("poussée=", poussée(t))
这就是我得到的错误:


似乎在第0行,我会试试的,谢谢!