Exemplo n.º 1
0
def whipple_state_space(rider, speed):
    """ x' = Ax + Bu + Fv

    x = [phi,
         delta,
         phiDot,
         deltaDot]
    u = [Tphi,
         Tdel]
    v = [Fcl]

    """

    bicycleModel = LinearLateralForce()

    pathToData='/media/Data/Documents/School/UC Davis/Bicycle Mechanics/BicycleParameters/data/'
    if rider == 'Jason':
        bicycleName = 'Rigid'
    elif rider == 'Charlie' or rider == 'Luke':
        bicycleName = 'Rigidcl'
    bike = bp.Bicycle(bicycleName, pathToData)
    bike.add_rider(rider)

    # set the model parameters
    benchmarkPar = bp.io.remove_uncertainties(bike.parameters['Benchmark'])
    benchmarkPar['xcl'] = bike.parameters['Measured']['xcl']
    benchmarkPar['zcl'] = bike.parameters['Measured']['zcl']
    moorePar = bicycle.benchmark_to_moore(benchmarkPar)
    bicycleModel.set_parameters(moorePar)

    # set the default equilibrium point
    pitchAngle = bicycle.pitch_from_roll_and_steer(0., 0., moorePar['rf'],
            moorePar['rr'], moorePar['d1'], moorePar['d2'], moorePar['d3'])
    wheelAngSpeed = -speed / moorePar['rr']
    equilibrium = np.zeros(len(bicycleModel.stateNames))
    equilibrium[bicycleModel.stateNames.index('q5')] = pitchAngle
    equilibrium[bicycleModel.stateNames.index('u6')] = wheelAngSpeed
    bicycleModel.linear(equilibrium)

    states = ['q4', 'q7', 'u4', 'u7']
    inputs = ['Fcl', 'T4', 'T7']
    outputs = ['q4', 'q7', 'u4', 'u7']

    A, B, C, D = bicycleModel.reduce_system(states, inputs, outputs)

    F = B[:, 0]
    B = B[:, 1:]

    return A, B, F
Exemplo n.º 2
0
    u_ind=[u2, u4, u5],
    kd_eqs=kinematical,
    q_dependent=[q3],
    configuration_constraints=holonomic,
    u_dependent=[u1, u3, u6],
    velocity_constraints=nonholonomic,
)
# reminder: u1--yaw rate, u2--roll rate, u3--pitch rate, u4--steer rate, u5--rear wheel ang. vel., u6--front wheel ang. vel.

# kane.kindiffeq(kinematical)
(fr, frstar) = kane.kanes_equations(forceList, bodyList)
kdd = kane.kindiffdict()

bp = bi.benchmark_parameters()

mp = bi.benchmark_to_moore(bp)

rr = bp["rR"]
lam = bp["lam"]

basu_input = bi.basu_table_one_input()

mo_in = bi.basu_to_moore_input(basu_input, rr, lam)

# not include the l1, l2, mc and ic because of the rider
# which will be added into instrumented bicycle later.
para_dict = {
    l1: mp["l1"],
    l2: mp["l2"],
    l3: mp["l3"],
    l4: mp["l4"],
Exemplo n.º 3
0
    else:
        f.close()
        del f

    from GyroBike import GyroBike

    # create the Whipple model (with my parameters)
    gyroNonLinear = GyroBike()

    # load the benchmark parameters
    pathToData='/media/Data/Documents/School/UC Davis/Bicycle Mechanics/BicycleParameters/data/'
    gyro = bp.Bicycle('Gyro', pathToData, forceRawCalc=True)
    gyro.add_rider('Child', reCalc=True)
    benchmarkPar = bp.io.remove_uncertainties(gyro.parameters['Benchmark'])
    # convert to my parameter set
    moorePar = bicycle.benchmark_to_moore(benchmarkPar, oldMassCenter=False)
    moorePar['mg'] = benchmarkPar['mD']
    moorePar['ig11'] = benchmarkPar['IDxx']
    moorePar['ig22'] = benchmarkPar['IDyy']
    gyroNonLinear.set_parameters(moorePar)

    # set the initial conditions to match Meijaard2007
    speedNaught = 0.5
    rollRateNaught = 0.5
    pitchAngle = bicycle.pitch_from_roll_and_steer(0., 0., moorePar['rf'], moorePar['rr'],
            moorePar['d1'], moorePar['d2'], moorePar['d3'])
    wheelAngSpeed = -speedNaught / moorePar['rr']
    gyroNonLinear.initialConditions[gyroNonLinear.stateNames.index('q5')] = pitchAngle
    gyroNonLinear.initialConditions[gyroNonLinear.stateNames.index('u4')] = rollRateNaught
    gyroNonLinear.initialConditions[gyroNonLinear.stateNames.index('u6')] = wheelAngSpeed
    gyroNonLinear.initialConditions[gyroNonLinear.stateNames.index('u9')] = -5000. / 60. * 2 * pi
Exemplo n.º 4
0
    alparse.alparse('Whipple', 'Whipple', code='Python')
else:
    f.close()
    del f

from Whipple import LinearWhipple

# create the Whipple model (with my parameters)
whip = LinearWhipple()

# load the benchmark parameters
pathToData = '/media/Data/Documents/School/UC Davis/Bicycle Mechanics/BicycleParameters/data/'
benchmark = bp.Bicycle('Benchmark', pathToData)
benchmarkPar = bp.io.remove_uncertainties(benchmark.parameters['Benchmark'])
# convert to my parameter set
moorePar = bicycle.benchmark_to_moore(benchmarkPar, oldMassCenter=False)
whip.set_parameters(moorePar)

# set the initial conditions to match Meijaard2007
speedNaught = 4.6
u6Naught = -speedNaught / moorePar['rr']
rollRateNaught = 0.5
pitchAngle = bicycle.pitch_from_roll_and_steer(0., 0., moorePar['rf'],
                                               moorePar['rr'], moorePar['d1'],
                                               moorePar['d2'], moorePar['d3'])

# linearize about the nominal configuration
equilibrium = np.zeros(len(whip.stateNames))
equilibrium[whip.stateNames.index('q5')] = pitchAngle
equilibrium[whip.stateNames.index('u6')] = u6Naught
whip.linear(equilibrium)
Exemplo n.º 5
0
riderPar = {
    'IBxx': humanInertia[0, 0],
    'IByy': humanInertia[1, 1],
    'IBzz': humanInertia[2, 2],
    'IBxz': humanInertia[2, 0],
    'mB': humanMass,
    'xB': humanCoM[0][0],
    'yB': humanCoM[1][0],
    'zB': humanCoM[2][0]
}

rigid = bp.Bicycle(bikeName, forceRawCalc=True, pathToData=pathToParameters)
benchmark = bp.rider.combine_bike_rider(rigid.parameters['Benchmark'],
                                        riderPar)
benchmark = bp.io.remove_uncertainties(benchmark)
par = bicycle.benchmark_to_moore(benchmark)

# get the arm parameters
# note that the right and left arms have the same parameters due to symmetry, I
# should probably reduce the number of parameters in the analytical model to
# reflect this

# right upper arm, G
par['mg'] = h.B1.Mass
par['l5'] = h.B1.relCOM[2][0]
IG = h.B1.relInertia
par['ig11'] = IG[0, 0]
par['ig33'] = IG[2, 2]
par['d12'] = h.B1.length

# shoulders
else:
    f.close()
    del f

from GyroBike import LinearGyroBike

# create the linear gyrobike model
gyrobike = LinearGyroBike()

# create the gyro bike
pathToData = '/media/Data/Documents/School/UC Davis/Bicycle Mechanics/BicycleParameters/data/'
gyro = bp.Bicycle('Gyro', pathToData, forceRawCalc=True)

# set the model parameters
benchmarkPar = bp.io.remove_uncertainties(gyro.parameters['Benchmark'])
moorePar = bicycle.benchmark_to_moore(benchmarkPar)
moorePar['mg'] = benchmarkPar['mD']
moorePar['ig11'] = benchmarkPar['IDxx']
moorePar['ig22'] = benchmarkPar['IDyy']
gyrobike.set_parameters(moorePar)

# set the default equilibrium point
speedNaught = 0.5  # just over 1 mph, really slow walking
pitchAngle = bicycle.pitch_from_roll_and_steer(0., 0., moorePar['rf'],
                                               moorePar['rr'], moorePar['d1'],
                                               moorePar['d2'], moorePar['d3'])
wheelAngSpeed = -speedNaught / moorePar['rr']
equilibrium = np.zeros(len(gyrobike.stateNames))
equilibrium[gyrobike.stateNames.index('q5')] = pitchAngle
equilibrium[gyrobike.stateNames.index('u6')] = wheelAngSpeed
Exemplo n.º 7
0
    [u4, u6, u7],  # roll rate, rear wheel rate, steer rate
    kd_eqs=kinematical,
    q_dependent=[q5],  # pitch angle
    configuration_constraints=[holonomic],
    u_dependent=[u3, u5, u8],  # yaw rate, pitch rate, front wheel rate
    velocity_constraints=nonholonomic)
fr, frstar = kane.kanes_equations(forces, bodies)

# Validation of non-linear equations

print('Loading numerical input parameters.')

from dtk import bicycle

bp = bicycle.benchmark_parameters()
mp = bicycle.benchmark_to_moore(bp)

# load the input values specified in table one of Basu-Mandal2007
basu_input = bicycle.basu_table_one_input()

# convert the values to my coordinates and speeds
moore_input = bicycle.basu_to_moore_input(basu_input, bp['rR'], bp['lam'])

constant_substitutions = {}
for k, v in mp.items():
    try:
        exec('constant_substitutions[{}] = v'.format(k))
    except NameError:
        pass
dynamic_substitutions = {}
for k, v in moore_input.items():
Exemplo n.º 8
0
else:
    f.close()
    del f

from GyroBike import LinearGyroBike

# create the linear gyrobike model
gyrobike = LinearGyroBike()

# create the gyro bike
pathToData='/media/Data/Documents/School/UC Davis/Bicycle Mechanics/BicycleParameters/data/'
gyro = bp.Bicycle('Gyro', pathToData, forceRawCalc=True)

# set the model parameters
benchmarkPar = bp.io.remove_uncertainties(gyro.parameters['Benchmark'])
moorePar = bicycle.benchmark_to_moore(benchmarkPar)
moorePar['mg'] = benchmarkPar['mD']
moorePar['ig11'] = benchmarkPar['IDxx']
moorePar['ig22'] = benchmarkPar['IDyy']
gyrobike.set_parameters(moorePar)

# set the default equilibrium point
speedNaught = 0.5 # just over 1 mph, really slow walking
pitchAngle = bicycle.pitch_from_roll_and_steer(0., 0., moorePar['rf'],
        moorePar['rr'], moorePar['d1'], moorePar['d2'], moorePar['d3'])
wheelAngSpeed = -speedNaught / moorePar['rr']
equilibrium = np.zeros(len(gyrobike.stateNames))
equilibrium[gyrobike.stateNames.index('q5')] = pitchAngle
equilibrium[gyrobike.stateNames.index('u6')] = wheelAngSpeed

figDir = '../../../figures/extensions/'
Exemplo n.º 9
0
# find the inertia of the humans without arms, this is with respect to the
# benchmark coordinate system and about the CoM of the subset of parts
humanMass, humanCoM, humanInertia = h.combine_inertia(('P', 'T', 'C', 'K1', 'K2', 'J1', 'J2'))
riderPar = {'IBxx': humanInertia[0, 0],
            'IByy': humanInertia[1, 1],
            'IBzz': humanInertia[2, 2],
            'IBxz': humanInertia[2, 0],
            'mB': humanMass,
            'xB': humanCoM[0][0],
            'yB': humanCoM[1][0],
            'zB': humanCoM[2][0]}

rigid = bp.Bicycle(bikeName, forceRawCalc=True, pathToData=pathToParameters)
benchmark = bp.rider.combine_bike_rider(rigid.parameters['Benchmark'], riderPar)
benchmark = bp.io.remove_uncertainties(benchmark)
par = bicycle.benchmark_to_moore(benchmark)

# get the arm parameters
# note that the right and left arms have the same parameters due to symmetry, I
# should probably reduce the number of parameters in the analytical model to
# reflect this

# right upper arm, G
par['mg'] = h.B1.Mass
par['l5'] = h.B1.relCOM[2][0]
IG = h.B1.relInertia
par['ig11'] = IG[0, 0]
par['ig33'] = IG[2, 2]
par['d12'] = h.B1.length

# shoulders
Exemplo n.º 10
0
                       [u4, u6, u7], # roll rate, rear wheel rate, steer rate
                       kd_eqs=kinematical,
                       q_dependent=[q5], # pitch angle
                       configuration_constraints=[holonomic],
                       u_dependent=[u3, u5, u8], # yaw rate, pitch rate, front wheel rate
                       velocity_constraints=nonholonomic)
fr, frstar = kane.kanes_equations(forces, bodies)

# Validation of non-linear equations

print('Loading numerical input parameters.')

from dtk import bicycle

bp = bicycle.benchmark_parameters()
mp = bicycle.benchmark_to_moore(bp)

# load the input values specified in table one of Basu-Mandal2007
basu_input = bicycle.basu_table_one_input()

# convert the values to my coordinates and speeds
moore_input = bicycle.basu_to_moore_input(basu_input, bp['rR'],
        bp['lam'])

constant_substitutions = {}
for k, v in mp.items():
    try:
        exec('constant_substitutions[{}] = v'.format(k))
    except NameError:
        pass
dynamic_substitutions = {}