##### Sections
> Bicycle Software Brainstorm

# Bicycle Software Brainstorm

Early design ideas from Jason, Gilbert, and Luke on a bicycle dynamics software package.

# Bicycle Dynamics, Control and Handling Software

### Some rules of brainstorming

• Defer judgement: Don’t dismiss any ideas. Nothing can kill the spirit of a brainstorm quicker. You can even delete negative feedback.
• Encourage wild ideas: The whole point of brainstorming is to come up with new and creative ideas
• Combine and improve ideas: No “buts”, only “ands.”
• Go for quantity: Aim for as many new ideas as possible.

# Sort the ideas into priority levels (Must have it, Should have it, Extra icing)

## Must Have It!

### Usability

• runs on the platforms that we use (Luke/Jason: Linux, Mont: Mac, Ron: Windows)
• all four of us (the researchers) should be able to use it

### Bike models

• the whipple model (verified to the benchmark)
• whipple model extensions (torodial tires)
• rider biomechanics (lean, twist, crotch) (DoF and control inputs)
• includes lots of model outputs (energy, states, config variables, etc)

### Parameters

• model is at its core based on our parameters (the D's, inertias)
• conversion from benchmark parameters or Sharps reduced parameters to our parameters
• input accurate bicycle and human measurements to get our parameters (following the experimental protocol we've made)

### Linear analysis

• calculate A and B matrices (inputs: Steer torque, roll torque, yaw torque, fw torque, rw torque, rider lean torque, more?) Symbolic generation of A and B matrices, able to be evaluated at any state
• calculate the canonical matrices (mass spring damper form)
• calculate eigenvalues about equilibrium points for stability analysis
• calculate various transfer functions, defining a C matrix
• controlability and observability

### Control

• lqr type controller, vary weightings
• manual controller (various topologies)
• steer into lean
• vary gains for each controller

### Handling Qualities

• Calculate handling quality rating independent of manuever

### Simulation

• simulate all configuration variables
• uncontrolled dynamics
• steady turning -- specify lean & steer, calculate speed and steer torque, contact forces
• reference tracking (lane change maneuver simulation, step/ramp responses, disturbances)

### Plotting

• eigenvalue vs speed plots
• steady turning plots
• stable speed range vs parameter changes plots (for the Whipple model...may not be relevant for other models)
• Bode plots of selected transfer functions
• simulation plots (states, energy, forces, torques, ...)
• visualization of eigenvectors vs speed

### Visualization

• basic 3D visualization (at least output a movie, but could be more)

### Other

• should do everything jBike6 does and more (input benchmark parameters, plot eigenvalues vs speed, plot pictorial of bike, save bikes, load bikes, ...)
• compare one bike to the other (input is a set of bikes instead of a single bike)
• future GUI extensibility

## Should Have It!

### Usability

• a graphical user interface for easy data inputs, plotting and simulation
• all four of us should be able to modify it without loads of time investment (i.e. requiring some kind of common language)
• written in a language that we all know, but we can combine languages and make use of more tools
• a bicycle designer should be able to use it (i.e. simple interface)
• open source, as more people may add to it and make it better
• free as in beer and free as in freedom (more people will use it/modify it)

### Bike Models

• tire dynamics
• more rider motions (rider knee motion)

### Control

• extra controllers: have controlled dynamics (maybe a few different models: pid, steer into lean, no-hands, full state feedback, lqr, manual control, etc)

### Bicycle and Human Parameters

• estimate the idealized bike parameters from standard bicycle frame geometry, tube material, bike type, etc (probably only for diamond frame bikes)
• Human parameter estimation from measurments that a bicycle designer would take

## Extra Icing!

### Usability

• runs on any platform
• run it as a web app

### Simulation

• realtime simulation

### Visualization

• could output animation to blender (or other animation suite) for more beautiful scenes

### Parameters

• exploring dimensionless parameters as a way to reduce number of independent parameters to vary
• accurate human parameters (maybe do yeadon's model)

### Control

• option of adding your own controller design

### Other

• Should do what BikeSim does
• latex/pdf output of results, Publication quality plots

## Group brainstorming session on Wednesday June 23

• Go through everything in this document: add, delete and reorganize for priority levels (tame the scope down)
• Make a list of what software we already have including what it does, what language it is written in and maybe quality level
• With the two previous things in mind draw some bubble diagrams on the board to map out core functionality and components of the software. Only do this for the top priority needs. Write down what the component does, how it solves one of the top priority needs, how it connects with the other parts of the software.
• Then review the software general plan/bubble chart to make sure it in fact meets the priority needs.
• Then see if the "should have it"s can be fit into the model without major changes

## Sample Script

#!/usr/bin/env python
# initialize an instance of the Whipple model with benchmark numerical values (default)
benchmarkbike = Whipple()
benchmarkbike.plot('evals', 0, 10)  # make an eigenvalue plot from 0-10 m/s
benchmarkbike.savefig('evals', 'benchmark_evals.pdf')   # save the figure to a pdf
benchmarkbike.params['rf'] = 0.4    # change the front wheel radius
benchmarkbike.plot('evals', 0, 10)  # make a new eigenvalue plot

# Numerical simulation example
# Set initial conditions
benchmarkbike.set_roll(0.1)
benchmarkbike.set_steer(-.1)
benchmarkbike.set_roll_rate(-0.5)
benchmarkbike.set_steer_rate(0.1)
benchmarkbike.set_rw_rate(-3.5 / benchmarkbike.params[rf])
# 10 second simulation, plot states, show a 3-D animation of simulation
benchmarkbike.sim(10, showstateplot=True, animate=True)
# Load a set of bike parameters from file, do some analysis
yellowbike = Whipple('yellowbike.txt')

>>linearyellowbike = yellowbike.lin((0.0, 0.0., 0.0, 0.0), 3.0) # linearize about upright steady at 3.0 m/s

>>print linearyellowbike.A # prints the full A matrix of the linear model (including ignorable coordinates)

A =
[1.2 3.455 5.66 7.39
3.5 4.555 4.3  4.55
4.5 6.885 4.5  6.77
9.42 5.43 4.32 3.33]

>>print linearyellowbike.eig()

w = ...

eignvalues

v = ...

eigenvectors

>>ybBode = linearyellowbike.plot('bode', input='steer', output='roll') # make bode plot of the steer to roll transfer function

>>ybBode.save('.png') # save the plot as a png

>>pista = Whipple('2007 Bianchi Pista') # loads the bianchi pista parameter data into a nonlinear Whipple model

>>print pista.statedesc # prints the descriptions of the states

['steer', 'roll', 'steer rate', 'roll rate']

>>print pista.outputdesc # prints the descriptions of the outputs

['potential energy', 'rear wheel contact', 'pitch', ...]

>>print pista.f([1, 2, 3, 4], t=5) # evaulates the x dots

[2.344 5.6667 6.77 8.443]

>>linpista = pista.lin(v = 5.0) # linearizes about zero @ 5.0 meters per second

>>linpist.contrl() # checks if the system is controlable

True

>>linpist.sim(ti= 0, tf = 10, input = ('step', 'steer torque', 1.0)) # simulates the linear model with a step input of 1.0 to the steer torque

>>print linpist.M # prints the mass matrix

M =

...

>>vw, vc, = linpist.critical_speeds() # find the stable speed range
>>print vw, vc

vw = 4.12

vc = 6.35

>>linpist.plot('stable speed range', 'trail', 0., 10.) # plots the stable speed range as a function of parameter change

>>compare_eigs('linpist', 'linearyellowbike', 0., 10.) # plots the eigenvalues of two bicycles on the same graph
# example of inputting measured bicycle data

browser = Whipple('measuredbikes/BatavusBrowser', 'measured') # loads a directory called BatavusBrowser with the appropriate raw data files

browser.set_human_params('Adult Male') # adds the physical parameters for a person to the browser

browser.save_params('browser.txt') # saves this parameter set for future use

browser.animate(10) # animation window pops up simulating the bicycle with rigid rider