Human control of a bicycle.
Clone or download
Latest commit fabe403 Nov 7, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gains Removed some blip gains. Aug 18, 2012
parameters Fixed citation links. Jul 27, 2016
plots Moved all the files into the root of the repo. Sep 30, 2011
.gitignore a gitignore file Jun 1, 2011
LICENSE Create LICENSE Nov 7, 2017
README.md Fixed error in code in README. Nov 7, 2017
TODO.md Removed some completed items on the todo list. Oct 10, 2011
WhippleModel.mdl slight dimension differences in the model file Oct 10, 2011
benchmark_geometry_figure.m Moved all the files into the root of the repo. Sep 30, 2011
bicycle_state_space.m Added better descriptions for the states, inputs, and outputs. May 31, 2016
bmd2016.m Added the start of a script to plot HQM vs any speed. Jan 12, 2016
convert_variable.m Change the pitch angle 'theta' to 'thetaB' as in Meijaard2007. Apr 21, 2012
create_ieee_paper_plots.m Moved all the files into the root of the repo. Sep 30, 2011
fix_ps_linestyle.m Moved all the files into the root of the repo. Sep 30, 2011
generate_data.m Added gainGuess and crossover options to generate data so that you ca… Apr 27, 2012
handling_vs_speed.m Added the box around the hqm speed plot. Jan 13, 2016
heading_track_analytic.py Updated and added functions for generating the closed loop system dyn… Apr 21, 2012
ieee.m Moved all the files into the root of the repo. Sep 30, 2011
lane_change.m Moved all the files into the root of the repo. Sep 30, 2011
lateral_track_analytic.py Updated and added functions for generating the closed loop system dyn… Apr 21, 2012
load_bikes.m Moved all the files into the root of the repo. Sep 30, 2011
lookup_gains.m Added parameter and gain files for Jason, Luke and Charlie on the ins… Nov 20, 2011
overwrite_settings.m Moved all the files into the root of the repo. Sep 30, 2011
par_text_to_struct.m Moved all the files into the root of the repo. Sep 30, 2011
plot_gains.m Changed the plot_gains function some. Dec 29, 2011
system_state_space.m Added the option of returning the lateral deviation or heading tracki… Apr 23, 2012
test_system_state_space.m Added the option of returning the lateral deviation or heading tracki… Apr 23, 2012
varargin_to_structure.m Moved all the files into the root of the repo. Sep 30, 2011
whipple_pull_force_abcd.m Added ellipses in the cell array definitions so they would be row vec… Apr 23, 2012
write_gains.m Moved all the files into the root of the repo. Sep 30, 2011
zipforieee.py Moved all the files into the root of the repo. Sep 30, 2011

README.md

Description

This is a human operator control model for a person controlling a bicycle. The bicycle model is based on the Whipple bicycle dynamic model. The control portion is based on the crossover model and includes basic preview. The model is capable of tracking a path.

This software is the companion code to the publication:

Hess, R.; Moore, J.K.; Hubbard, M., "Modeling the Manually Controlled Bicycle," Systems, Man and Cybernetics, Part A: Systems and Humans, IEEE Transactions on, vol.42, no.3, pp.545,557, May 2012

http://dx.doi.org/10.1109/TSMCA.2011.2164244

File Descriptions

whipple_pull_force_abcd.m : Generates the linearized Whipple model about the upright constant velocity equilibrium point for various parameter sets. It includes an additional lateral pull force input.

par_text_to_struct.m : Loads in a parameter file to Matlab's structure data type.

WhippleModel.mdl : The simulink model which is used to calculate the gains, the various transfer function for the open and closed loops, and the handling qualities metric for both steer torque and roll torque inputs.

generate_data.m : Generates the data (transfer functions, simulation results, and handling quality metric) by simulating and perturbing the Simulink model.

create_ieee_paper_plots.m : Generates most of the plots for our first journal paper on the topic.

fix_ps_linstyle.m : A file from the Matlab file exchange for improving plot lines.

load_bikes.m : Loads the data from generate_data for multiple bicycles and speeds into one structure.

ieee.m : Loads the data needed for create_ieee_paper_plots and runs the function. This is not part of create_ieee_paper_plots to faciltate the separation of the data generation and the plotting mainly for debugging purposes.

lane_change.m : Generates path data for a single or double lane change manuever at a particular speed.

benchmark_geometry_figure.m : Generates a postscript drawing of the bicycle dimenions. Requires pshacker.

Requirements

  • Matlab 2010a (7.10.0)
  • Matlab Control Systems Toolbox
  • Simulink
  • pshacker (for the bicycle geometry plot)

Example Use

The core function in this package is generate_data.m. The simplest method of using it is to supply it with a bicycle name and a speed. It will then find the appropriate gains for a stable model, compute all of the loop transfer functions and simulate a double lane change manuever. The function outputs all of this data for easy plotting and analysis.

Generate data for the Benchmark bicyle at 4.8 m/s.

>> data = generate_data('Benchmark', 4.8);

You should see this basic output:

-------------------------------------------------------------------------------
Benchmark at 4.80 m/s.
-------------------------------------------------------------------------------
Parameters for the Benchmark bicycle and rider have been loaded.
Calculating the A, B, C, D matrices for 4.80 m/s
A, B, C, D calculated in 0.0291 seconds.
Finding the loop transfer function of the Delta loop with a start guess of 44.6406.
Delta loop gain set to 44.6406.
Finding the loop transfer function of the PhiDot loop with a start guess of -0.0529.
PhiDot loop gain set to -0.0529.
Finding the loop transfer function of the Phi loop with a start guess of 13.2253.
Phi loop gain set to 13.2253.
Finding the loop transfer function of the Psi loop with a start guess of 0.1720.
Psi loop gain set to 0.1720.
Finding the loop transfer function of the Y loop with a start guess of 0.1001.
Y loop gain set to 0.1001.
Gains are set to: kDelta = 44.641
                  kPhiDot = -0.053
                  kPhi = 13.225
                  kPsi = 0.172
                  kY = 0.100
Finding the Delta closed loop transfer function.
Finding the PhiDot closed loop transfer function.
Finding the Phi closed loop transfer function.
Finding the Psi closed loop transfer function.
Finding the Y closed loop transfer function.
Finding the Delta open loop transfer function.
Finding the PhiDot open loop transfer function.
Finding the Phi open loop transfer function.
Finding the Psi open loop transfer function.
Finding the Y open loop transfer function.
Finding the handling quality metric.
Gains written to gains/BenchmarkSteerGains.txt
Simulating the tracking task.
Simulation finished in 0.185 seconds.
Done.

data is now a structure that contains all of the output from the function.

>> data

data =

             speed: 4.8000
               par: [1x1 struct]
          modelPar: [1x1 struct]
       closedLoops: [1x1 struct]
         openLoops: [1x1 struct]
    handlingMetric: [1x1 struct]
              time: [209x1 double]
           command: [209x5 double]
            inputs: [209x3 double]
           outputs: [209x18 double]
        outputsDot: [209x18 double]
              path: [209x1 double]
          gainMuls: [1 1 1 1 1]

You can check the eigenvalues of the bicycle model:

>> eig(data.modelPar.A)

The loop transfer functions (open and closed) can be visualized with a Bode plot:

>> bode(tf(data.closedLoops.delta.num, data.closedLoops.delta.den))

The handling quality metric can be accessed by:

>> tf(data.handlingMetric.num, data.handlingMetric.den)

The inputs and outputs from the simulation can be be visualized with:

>> figure(1)
>> plot(data.time, data.inputs)
>> figure(2)
>> plot(data.time, data.outputs)

The model gains can be accessed with:

>> data.modelPar.kDelta
>> data.modelPar.kPhiDot
>> data.modelPar.kPhi
>> data.modelPar.kPsi
>> data.modelPar.kY

generate_data.m can also take many optional arguments.

% Generate the data set for the Benchmark bicycle at 5.0 m/s with roll as the
% input.
data = generate_data('Benchmark', 5.0, 'input', 'Roll');

% Generate the data set for the Fisher bicycle at 7.5 m/s with steer input
% and show the graphs.
data = generate_data('Fisher', 7.5, 'input', 'Steer', 'plot', 1);

% Generate the data set for the Browser bicycle at 2.5 m/s with steer as an
% input and multiply the five gains by various values and show the graphs.
data = generate_data('Browser', 2.5, 'plot', 1, 'gainMuls', [1.1, 1.1, 0.9, 1.0, 0.8])

% Generate the data set for the Bianchi Pista bicycle at 7.5 m/s with steer as the
% input and a single lane change as the manuever.
data = generate_data('Pista', 7.5, 'laneType', 'single');

We used generate_data.m to create the data and plots for the journal paper on the subject. Run ieee.m to generate all of the plots. This code has examples of how to extract and plot all of the data that is made available from generate_data.m

% Generate the plots for the paper on this model.
ieee