示例#1
0
def configuration(lean, steer, mooreParameters):
    """Returns the configuration of steady turning in lean, steer and pitch 
    angle in radians and degrees by giving front twos values and bicycle
    parameters in Jason's set.

    Parameter
    ---------
    lean: float
        A given lean angle.
    steer: float
        A given steer angle.
    mooreParameters: dictionary
        Bicycle parameters in Moore's set, but keys are string.

    Return
    ------
    q_dict: dictionary
        The dictionary of steady turning configuration.
    q_dict_d: dictionary
        The degrees units of q_dict.

    """

    mp = mooreParameters

    pitch = bi.pitch_from_roll_and_steer(lean, steer, mp['rf'], mp['rr'], 
            mp['d1'], mp['d2'], mp['d3'])

    lean_d, pitch_d, steer_d = [value*180/pi for value in [lean, pitch, steer]]

    q_dict = {q2: lean, q3:pitch, q4:steer}
    q_dict_d = {q2: lean_d, q3: pitch_d, q4: steer_d}
    
    return q_dict, q_dict_d
示例#2
0
# Built quick functions for mm and forcing
# Built a function of derivs for q_dot and u_dot
# * here is to convert variables of array (maybe or list) to a tuple for input
# into the lambdify
mm = lambdify(dummy_symbols, MM)
fo = lambdify(dummy_symbols, For)
def derivs(y, t):
    return array(solve(mm(*y), fo(*y))).T[0]

# Initial conditions and time vector defining
# initial condition:
#                  [q1,   q2,   q4,   q3,   u2,   u4,   u5,   u1,   u3,   u6]
#   reference      [0.,   0.,   0.,   lam,  0.,   0.,   v/rr, 0.,   0.,   v/rf]
q1 = 0.; q2 = 0.; q4 = 0.
q3 = pitch_from_roll_and_steer(q2, q4, mp['rf'], mp['rr'], mp['d1'], mp['d2'],
                                mp['d3'])
q_ini = [q1, q2, q4, q3]

v = 5.0 # m/s
u2 = 0.; u4 = 0.; u5 = v/mp['rr']
u1 = 0.; u3 = 0.; u6 = v/mp['rf']
u_ini = [u2, u4, u5, u1, u3, u6]

y0 = array(q_ini + u_ini)
t = linspace(0, 10, 1000)

# Intgration
y = odeint(derivs, y0, t)
y_re = hstack((y[:, :2], y[:,3:4], y[:,2:3], 
               y[:,5:6], y[:,7:9], y[:,4:5], y[:,6:7], y[:,9:]))
示例#3
0
                    basu_table_one_input, basu_to_stefen_input,
                    basu_table_one_output, basu_to_stefen_output
                    )

from numpy import pi
#from dtk import bicycle as bicycle


# Parameters test
bp = benchmark_parameters() #assertation bicycle.benchmark_parameters
mp = benchmark_to_moore(bp) #assertation bicycle.benchmark_to_moore

# Pitch test
# Assertation bicycle.lambda_from_abc
# Assertation bicycle.pitch_from_roll_and_steer(lean, steer, mp['rf'], mp['rr'], 
#                                               mp['d1'], mp['d2'], mp['d3'])
lam = lambda_from_132(mp['rf'], mp['rr'], mp['d1'], mp['d3'], mp['d2'])

lean = 0.0; steer = 0.0
pitch = pitch_from_roll_and_steer(lean, steer, mp['rf'], mp['rr'], 
                                mp['d1'], mp['d2'], mp['d3'])


# Basu test
# Assertation bicycle.basu_to_moore_input
basu_input = basu_table_one_input()
stefen_input = basu_to_stefen_input(basu_input, mp['rr'], bp['lambda'])

basu_output = basu_table_one_output()
stefen_output = basu_to_stefen_output(basu_output)