parameter_sets
Module¶
- class Meijaard2007ParameterSet(parameters, includes_rider)¶
Bases:
ParameterSet
Represents the parameters of the benchmark bicycle presented in [Meijaard2007].
The four bodies are:
B: rear frame + rigid rider
F: front wheel
H: front frame (fork & handlebars)
R: rear wheel
- Parameters:
- parametersdictionary
A dictionary mapping variable names to values that contains the following keys:
IBxx
: x moment of inertia of the frame/rider [kg*m**2]IBxz
: xz product of inertia of the frame/rider [kg*m**2]IBzz
: z moment of inertia of the frame/rider [kg*m**2]IFxx
: x moment of inertia of the front wheel [kg*m**2]IFyy
: y moment of inertia of the front wheel [kg*m**2]IHxx
: x moment of inertia of the handlebar/fork [kg*m**2]IHxz
: xz product of inertia of the handlebar/fork [kg*m**2]IHzz
: z moment of inertia of the handlebar/fork [kg*m**2]IRxx
: x moment of inertia of the rear wheel [kg*m**2]IRyy
: y moment of inertia of the rear wheel [kg*m**2]c
: trail [m]g
: acceleration due to gravity [m/s**2]lam
: steer axis tilt [rad]mB
: frame/rider mass [kg]mF
: front wheel mass [kg]mH
: handlebar/fork assembly mass [kg]mR
: rear wheel mass [kg]rF
: front wheel radius [m]rR
: rear wheel radius [m]w
: wheelbase [m]xB
: x distance to the frame/rider center of mass [m]xH
: x distance to the frame/rider center of mass [m]zB
: z distance to the frame/rider center of mass [m]zH
: z distance to the frame/rider center of mass [m]
- includes_riderboolean
True if body B is the combined rear frame and rider in terms of mass and inertia values.
- Attributes:
- par_stringsdictionary
Maps ASCII strings to their LaTeX string.
- body_labelslist of strings
Single capital letters that correspond to the four rigid bodies in the model.
References
[Meijaard2007]Meijaard J.P, Papadopoulos Jim M, Ruina Andy and Schwab A.L, 2007, Linearized dynamics equations for the balance and steer of a bicycle: a benchmark and review, Proc. R. Soc. A., 463:1955–1982 http://doi.org/10.1098/rspa.2007.1857
- body_labels = ['B', 'F', 'H', 'R']¶
- form_inertia_tensor(body)¶
Returns the inertia tensor with respect to the global coordinate system and the body’s mass center.
- Parameters:
- bodystring
One of the
body_labels
.
- Returns:
- inertia_tensorndarray, shape(3, 3)
Inertia tensor of the body with respect to the body’s mass center and the model’s coordinate system.
Examples
>>> from bicycleparameters.parameter_dicts import meijaard2007_browser_jason >>> from bicycleparameters.parameter_sets import Meijaard2007ParameterSet >>> p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) >>> p.form_inertia_tensor('H') array([[ 0.25337959, 0. , -0.07204524], [ 0. , 0.24613881, 0. ], [-0.07204524, 0. , 0.09557708]])
- form_mass_center_vector(body)¶
Returns an array representing the 3D vector to the mass center of the body from the origin at the rear wheel contact point.
- Parameters:
- bodystring
One of ‘B’, ‘F’, ‘H’, ‘R’.
- Returns:
- ndarray, shape(3,)
A vector containing the X, Y, and X coordinates of the mass center of the body.
Examples
>>> from bicycleparameters.parameter_dicts import meijaard2007_browser_jason >>> from bicycleparameters.parameter_sets import Meijaard2007ParameterSet >>> p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) >>> p.form_mass_center_vector('B') array([ 0.28909943, 0. , -1.04029228])
- mass_center_of(*bodies)¶
Returns the vector locating the center of mass of the collection of bodies.
- Parameters:
- bodiesiterable of strings
One or more of the
body_labels
.
- Returns:
- comndarray, shape(3,)
Vector locating the center of mass of the bodies givien in
bodies
.
Examples
>>> from bicycleparameters.parameter_dicts import meijaard2007_browser_jason >>> from bicycleparameters.parameter_sets import Meijaard2007ParameterSet >>> p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) >>> p.mass_center_of('B', 'H') array([ 0.31096918, 0. , -1.02923892])
- par_strings = {'IBxx': 'I_{Bxx}', 'IBxz': 'I_{Bxz}', 'IByy': 'I_{Byy}', 'IBzz': 'I_{Bzz}', 'IFxx': 'I_{Fxx}', 'IFyy': 'I_{Fyy}', 'IHxx': 'I_{Hxx}', 'IHxz': 'I_{Hxz}', 'IHyy': 'I_{Hyy}', 'IHzz': 'I_{Hzz}', 'IRxx': 'I_{Rxx}', 'IRyy': 'I_{Ryy}', 'c': 'c', 'g': 'g', 'lam': '\\lambda', 'mB': 'm_B', 'mF': 'm_F', 'mH': 'm_H', 'mR': 'm_R', 'rF': 'r_F', 'rR': 'r_R', 'v': 'v', 'w': 'w', 'xB': 'x_B', 'xH': 'x_H', 'zB': 'z_B', 'zH': 'z_H'}¶
- plot_all(ax=None)¶
Returns matplotlib axes with the geometry and inertial representations of all bodies of the bicycle parameter set.
- Parameters:
- axAxesSubplot, optional
An axes to draw on, otherwise one is created.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_all()
(
Source code
,png
,hires.png
,pdf
)
- plot_body_mass_center(body, ax=None)¶
Returns a matplotlib axes with a mass center symbol for the specified body to the plot.
- Parameters:
- bodystring
The body string:
F
,H
,B
, orR
.- axSubplotAxes, optional
Axes to plot on.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_body_mass_center('B')
(
Source code
,png
,hires.png
,pdf
)
- plot_body_principal_inertia_ellipsoid(body, ax=None)¶
Returns a matplotlib axes with an ellipse that respresnts the XZ plane view of a constant density ellipsoid which has the same principal moments and axes of inertia as the body.
- Parameters:
- bodystring
One of the
body_labels
.- axSubplotAxes, optional
Axes to plot on.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_body_principal_inertia_ellipsoid('H')
(
Source code
,png
,hires.png
,pdf
)
- plot_body_principal_radii_of_gyration(body, ax=None)¶
Returns a matplotlib axes with lines and a circle that indicate the principal radii of gyration of the specified body.
- Parameters:
- bodystring
One of the
body_labels
.- axSubplotAxes, optional
Axes to plot on.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_body_principal_radii_of_gyration('B')
(
Source code
,png
,hires.png
,pdf
)
- plot_geometry(show_steer_axis=True, ax=None)¶
Returns a matplotlib axes with a simple drawing of the bicycle’s geometry.
- Parameters:
- show_steer_axisboolean
If true, a dotted line will be plotted along the steer axis from the front wheel center to the ground.
- axAxesSubplot, optional
An axes to draw on, otherwise one is created.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_geometry()
(
Source code
,png
,hires.png
,pdf
)
- plot_mass_centers(bodies=None, ax=None)¶
Returns a matplotlib axes with mass center indicators for each body.
- Parameters:
- bodies: list of strings, optional
A subset of the strings present in the class attribute
body_labels
.- ax: matplotlib Axes, optional
An axes to plot on.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_mass_centers()
(
Source code
,png
,hires.png
,pdf
)
- plot_principal_inertia_ellipsoids(bodies=None, ax=None)¶
Returns a Matplotlib axes with 2D representations of 3D solid uniform ellipsoids that have the same inertia as the body.
- Parameters:
- bodies: list of strings, optional
A subset of the strings present in the class attribute
body_labels
.- axAxesSubplot, optional
An axes to draw on, otherwise one is created.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_principal_inertia_ellipsoids()
(
Source code
,png
,hires.png
,pdf
)
- plot_principal_radii_of_gyration(bodies=None, ax=None)¶
Returns a matplotlib axis with principal radii of all bodies shown.
- Parameters:
- bodies: list of strings, optional
A subset of the strings present in the class attribute
body_labels
.- ax: matplotlib Axes, optional
An axes to plot on.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_principal_radii_of_gyration()
(
Source code
,png
,hires.png
,pdf
)
- to_ini(fname)¶
Writes parameters to file in the INI format. Metadata is not included.
- Parameters:
- fnamestring
Path to file.
- to_parameterization(name)¶
Returns a specific parameter set based on the provided parameterization name.
- Parameters:
- namestring
The name of the parameterization. These should correspond to a subclass of a
ParameterSet
and the name will be the string that precedes “ParameterSet”. For example, the parameterization name ofMeijaard2007ParameterSet
isMeijaard2007
.
- Returns:
- ParmeterSet
If a different parameterization is requested and this class can convert itself, it will return a new parameter set of the correct parameterization.
- to_yaml(fname)¶
Writes parameters to file in the YAML format.
- Parameters:
- fnamestring
Path to file.
- class Meijaard2007WithFeedbackParameterSet(parameters, includes_rider)¶
Bases:
Meijaard2007ParameterSet
Represents the parameters of the benchmark bicycle presented in [Meijaard2007] and with full state feedback control gains.
The four bodies are:
B: rear frame + rigid rider
F: front wheel
H: front frame (fork & handlebars)
R: rear wheel
- Parameters:
- parametersdictionary
A dictionary mapping variable names to values that contains the following keys:
IBxx
: x moment of inertia of the frame/rider [kg*m**2]IBxz
: xz product of inertia of the frame/rider [kg*m**2]IBzz
: z moment of inertia of the frame/rider [kg*m**2]IFxx
: x moment of inertia of the front wheel [kg*m**2]IFyy
: y moment of inertia of the front wheel [kg*m**2]IHxx
: x moment of inertia of the handlebar/fork [kg*m**2]IHxz
: xz product of inertia of the handlebar/fork [kg*m**2]IHzz
: z moment of inertia of the handlebar/fork [kg*m**2]IRxx
: x moment of inertia of the rear wheel [kg*m**2]IRyy
: y moment of inertia of the rear wheel [kg*m**2]c
: trail [m]g
: acceleration due to gravity [m/s**2]kTdel_del
: steer torque feedback gain from steer angle [N*m/rad]kTdel_deld
: steer torque feedback gain from steer rate [N*m*s/rad]kTdel_phi
: steer torque feedback gain from roll angle [N*m/rad]kTdel_phid
: steer torque feedback gain from roll rate [N*m*s/rad]kTphi_del
: roll torque feedback gain from steer angle [N*m/rad]kTphi_deld
: roll torque feedback gain from steer rate [N*m*s/rad]kTphi_phi
: roll torque feedback gain from roll angle [N*m/rad]kTphi_phid
: roll torque feedback gain from roll rate [N*m*s/rad]lam
: steer axis tilt [rad]mB
: frame/rider mass [kg]mF
: front wheel mass [kg]mH
: handlebar/fork assembly mass [kg]mR
: rear wheel mass [kg]rF
: front wheel radius [m]rR
: rear wheel radius [m]w
: wheelbase [m]xB
: x distance to the frame/rider center of mass [m]xH
: x distance to the frame/rider center of mass [m]zB
: z distance to the frame/rider center of mass [m]zH
: z distance to the frame/rider center of mass [m]
- includes_riderboolean
True if body B is the combined rear frame and rider in terms of mass and inertia values.
- Attributes:
- par_stringsdictionary
Maps ASCII strings to their LaTeX string.
- body_labelslist of strings
Single capital letters that correspond to the four rigid bodies in the model.
References
[Meijaard2007]Meijaard J.P, Papadopoulos Jim M, Ruina Andy and Schwab A.L, 2007, Linearized dynamics equations for the balance and steer of a bicycle: a benchmark and review, Proc. R. Soc. A., 463:1955–1982 http://doi.org/10.1098/rspa.2007.1857
- body_labels = ['B', 'F', 'H', 'R']¶
- form_inertia_tensor(body)¶
Returns the inertia tensor with respect to the global coordinate system and the body’s mass center.
- Parameters:
- bodystring
One of the
body_labels
.
- Returns:
- inertia_tensorndarray, shape(3, 3)
Inertia tensor of the body with respect to the body’s mass center and the model’s coordinate system.
Examples
>>> from bicycleparameters.parameter_dicts import meijaard2007_browser_jason >>> from bicycleparameters.parameter_sets import Meijaard2007ParameterSet >>> p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) >>> p.form_inertia_tensor('H') array([[ 0.25337959, 0. , -0.07204524], [ 0. , 0.24613881, 0. ], [-0.07204524, 0. , 0.09557708]])
- form_mass_center_vector(body)¶
Returns an array representing the 3D vector to the mass center of the body from the origin at the rear wheel contact point.
- Parameters:
- bodystring
One of ‘B’, ‘F’, ‘H’, ‘R’.
- Returns:
- ndarray, shape(3,)
A vector containing the X, Y, and X coordinates of the mass center of the body.
Examples
>>> from bicycleparameters.parameter_dicts import meijaard2007_browser_jason >>> from bicycleparameters.parameter_sets import Meijaard2007ParameterSet >>> p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) >>> p.form_mass_center_vector('B') array([ 0.28909943, 0. , -1.04029228])
- mass_center_of(*bodies)¶
Returns the vector locating the center of mass of the collection of bodies.
- Parameters:
- bodiesiterable of strings
One or more of the
body_labels
.
- Returns:
- comndarray, shape(3,)
Vector locating the center of mass of the bodies givien in
bodies
.
Examples
>>> from bicycleparameters.parameter_dicts import meijaard2007_browser_jason >>> from bicycleparameters.parameter_sets import Meijaard2007ParameterSet >>> p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) >>> p.mass_center_of('B', 'H') array([ 0.31096918, 0. , -1.02923892])
- par_strings = {'IBxx': 'I_{Bxx}', 'IBxz': 'I_{Bxz}', 'IByy': 'I_{Byy}', 'IBzz': 'I_{Bzz}', 'IFxx': 'I_{Fxx}', 'IFyy': 'I_{Fyy}', 'IHxx': 'I_{Hxx}', 'IHxz': 'I_{Hxz}', 'IHyy': 'I_{Hyy}', 'IHzz': 'I_{Hzz}', 'IRxx': 'I_{Rxx}', 'IRyy': 'I_{Ryy}', 'c': 'c', 'g': 'g', 'kTdel_del': 'k_{T_{\\delta}\\delta}', 'kTdel_deld': 'k_{T_{\\delta}\\dot{\\delta}}', 'kTdel_phi': 'k_{T_{\\delta}\\phi}', 'kTdel_phid': 'k_{T_{\\delta}\\dot{\\phi}}', 'kTphi_del': 'k_{T_{\\phi}\\delta}', 'kTphi_deld': 'k_{T_{\\phi}\\dot{\\delta}}', 'kTphi_phi': 'k_{T_{\\phi}\\phi}', 'kTphi_phid': 'k_{T_{\\phi}\\dot{\\phi}}', 'lam': '\\lambda', 'mB': 'm_B', 'mF': 'm_F', 'mH': 'm_H', 'mR': 'm_R', 'rF': 'r_F', 'rR': 'r_R', 'v': 'v', 'w': 'w', 'xB': 'x_B', 'xH': 'x_H', 'zB': 'z_B', 'zH': 'z_H'}¶
- plot_all(ax=None)¶
Returns matplotlib axes with the geometry and inertial representations of all bodies of the bicycle parameter set.
- Parameters:
- axAxesSubplot, optional
An axes to draw on, otherwise one is created.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_all()
(
Source code
,png
,hires.png
,pdf
)
- plot_body_mass_center(body, ax=None)¶
Returns a matplotlib axes with a mass center symbol for the specified body to the plot.
- Parameters:
- bodystring
The body string:
F
,H
,B
, orR
.- axSubplotAxes, optional
Axes to plot on.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_body_mass_center('B')
(
Source code
,png
,hires.png
,pdf
)
- plot_body_principal_inertia_ellipsoid(body, ax=None)¶
Returns a matplotlib axes with an ellipse that respresnts the XZ plane view of a constant density ellipsoid which has the same principal moments and axes of inertia as the body.
- Parameters:
- bodystring
One of the
body_labels
.- axSubplotAxes, optional
Axes to plot on.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_body_principal_inertia_ellipsoid('H')
(
Source code
,png
,hires.png
,pdf
)
- plot_body_principal_radii_of_gyration(body, ax=None)¶
Returns a matplotlib axes with lines and a circle that indicate the principal radii of gyration of the specified body.
- Parameters:
- bodystring
One of the
body_labels
.- axSubplotAxes, optional
Axes to plot on.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_body_principal_radii_of_gyration('B')
(
Source code
,png
,hires.png
,pdf
)
- plot_geometry(show_steer_axis=True, ax=None)¶
Returns a matplotlib axes with a simple drawing of the bicycle’s geometry.
- Parameters:
- show_steer_axisboolean
If true, a dotted line will be plotted along the steer axis from the front wheel center to the ground.
- axAxesSubplot, optional
An axes to draw on, otherwise one is created.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_geometry()
(
Source code
,png
,hires.png
,pdf
)
- plot_mass_centers(bodies=None, ax=None)¶
Returns a matplotlib axes with mass center indicators for each body.
- Parameters:
- bodies: list of strings, optional
A subset of the strings present in the class attribute
body_labels
.- ax: matplotlib Axes, optional
An axes to plot on.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_mass_centers()
(
Source code
,png
,hires.png
,pdf
)
- plot_principal_inertia_ellipsoids(bodies=None, ax=None)¶
Returns a Matplotlib axes with 2D representations of 3D solid uniform ellipsoids that have the same inertia as the body.
- Parameters:
- bodies: list of strings, optional
A subset of the strings present in the class attribute
body_labels
.- axAxesSubplot, optional
An axes to draw on, otherwise one is created.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_principal_inertia_ellipsoids()
(
Source code
,png
,hires.png
,pdf
)
- plot_principal_radii_of_gyration(bodies=None, ax=None)¶
Returns a matplotlib axis with principal radii of all bodies shown.
- Parameters:
- bodies: list of strings, optional
A subset of the strings present in the class attribute
body_labels
.- ax: matplotlib Axes, optional
An axes to plot on.
Examples
from bicycleparameters.parameter_dicts import meijaard2007_browser_jason from bicycleparameters.parameter_sets import Meijaard2007ParameterSet p = Meijaard2007ParameterSet(meijaard2007_browser_jason, True) p.plot_principal_radii_of_gyration()
(
Source code
,png
,hires.png
,pdf
)
- to_ini(fname)¶
Writes parameters to file in the INI format. Metadata is not included.
- Parameters:
- fnamestring
Path to file.
- to_parameterization(name)¶
Returns a specific parameter set based on the provided parameterization name.
- Parameters:
- namestring
The name of the parameterization. These should correspond to a subclass of a
ParameterSet
and the name will be the string that precedes “ParameterSet”. For example, the parameterization name ofMeijaard2007ParameterSet
isMeijaard2007
.
- Returns:
- ParmeterSet
If a different parameterization is requested and this class can convert itself, it will return a new parameter set of the correct parameterization.
- to_yaml(fname)¶
Writes parameters to file in the YAML format.
- Parameters:
- fnamestring
Path to file.
- class Moore2012ParameterSet(parameters, includes_rider)¶
Bases:
ParameterSet
Represents the parameters of the Carvallo-Whipple model presented in [Moore2012].
The four bodies are:
C: rear frame + rigid rider
D: rear wheel
E: front frame (fork & handlebars)
F: front wheel
- Parameters:
- parametersdictionary
A dictionary mapping variable names to values that contains the following keys:
‘d1’
‘d2’
‘d3’
‘g’
‘ic11’
‘ic22’
‘ic31’
‘ic33’
‘id11’
‘id22’
‘ie11’
‘ie22’
‘ie31’
‘ie33’
‘if11’
‘if22’
‘l1’
‘l2’
‘l3’
‘l4’
‘mc’
‘md’
‘me’
‘mf’
‘rf’
‘rr’
‘v’
- includes_riderboolean
True if body C is the combined rear frame and rider in terms of mass and inertia values.
- Attributes:
- par_stringsdictionary
Maps ASCII strings to their LaTeX string.
- body_labelslist of strings
Single letters that correspond to the four rigid bodies in the model.
- body_labels = ['C', 'D', 'E', 'F']¶
- par_strings = {'d1': 'd_1', 'd2': 'd_2', 'd3': 'd_3', 'g': 'g', 'ic11': 'I_{C11}', 'ic22': 'I_{C22}', 'ic31': 'I_{C31}', 'ic33': 'I_{C33}', 'id11': 'I_{D11}', 'id22': 'I_{D22}', 'ie11': 'I_{D11}', 'ie22': 'I_{E22}', 'ie31': 'I_{E31}', 'ie33': 'I_{E33}', 'if11': 'I_{F11}', 'if22': 'I_{F22}', 'l1': 'l_1', 'l2': 'l_2', 'l3': 'l_3', 'l4': 'l_4', 'mc': 'm_C', 'md': 'm_D', 'me': 'm_E', 'mf': 'm_F', 'rf': 'r_f', 'rr': 'r_r', 'v': 'v'}¶
- to_ini(fname)¶
Writes parameters to file in the INI format. Metadata is not included.
- Parameters:
- fnamestring
Path to file.
- to_parameterization(name)¶
Returns a specific parameter set based on the provided parameterization name.
- Parameters:
- namestring
The name of the parameterization. These should correspond to a subclass of a
ParameterSet
and the name will be the string that precedes “ParameterSet”. For example, the parameterization name ofMeijaard2007ParameterSet
isMeijaard2007
.
- Returns:
- ParmeterSet
If a different parameterization is requested and this class can convert itself, it will return a new parameter set of the correct parameterization.
- to_yaml(fname)¶
Writes parameters to file in the YAML format.
- Parameters:
- fnamestring
Path to file.
- class Moore2019ParameterSet(parameters)¶
Bases:
ParameterSet
Represents the parameters of the bicycle parameterization presented in [1].
The four bodies are:
D: rear frame
F: front wheel
H: front frame (fork & handlebars)
P: rigid rider
R: rear wheel
- Parameters:
- parametersdictionary
A dictionary mapping variable names to values.
- Attributes:
- par_stringsdictionary
Maps ASCII strings to their LaTeX string.
- body_labelslist of strings
Single capital letters that correspond to the five rigid bodies in the model.
References
[1]Moore, Jason K.; Hubbard, Mont (2019): Expanded Optimization for Discovering Optimal Lateral Handling Bicycles. Proceedings of Bicycle and Motorcycle Dynamics 2019: A Symposium on the Dynamics and Control of Single Track Vehicles https://doi.org/10.6084/m9.figshare.9942938.v1
- body_labels = ['D', 'F', 'H', 'P', 'R']¶
- form_mass_center_vector(body)¶
Returns an array representing the vector to the mass center of the body.
- Parameters:
- bodystring
One of ‘P’, ‘D’, ‘F’, ‘H’, ‘R’.
- Returns:
- ndarray, shape(3,)
A vector containing the X, Y, and X coordinates of the mass center of the body.
- mass_center_of(*bodies)¶
Returns the vector locating the center of mass of the collection of bodies.
- Parameters:
- bodiesiterable of strings
Subset from
body_labels
.
- Returns:
- comndarray, shape(3,)
Vector locating the center of mass of the bodies given in
bodies
.
- non_min_par_strings = {'alphaF': '\\alpha_F', 'alphaR': '\\alpha_R', 'kFbb': 'k_{Fbb}', 'kRbb': 'k_{Rbb}', 'xF': 'x_F', 'xR': 'x_R', 'yD': 'y_D', 'yF': 'y_F', 'yH': 'y-H', 'yP': 'y_P', 'yR': 'y_R', 'zF': 'z_F', 'zR': 'z_R'}¶
- par_strings = {'alphaD': '\\alpha_D', 'alphaH': '\\alpha_H', 'alphaP': '\\alpha_P', 'c': 'c', 'g': 'g', 'kDaa': 'k_{Daa}', 'kDbb': 'k_{Dbb}', 'kDyy': 'k_{Dyy}', 'kFaa': 'k_{Faa}', 'kFyy': 'k_{Fyy}', 'kHaa': 'k_{Haa}', 'kHbb': 'k_{Hbb}', 'kHyy': 'k_{Hyy}', 'kPaa': 'k_{Paa}', 'kPbb': 'k_{Pbb}', 'kPyy': 'k_{Pyy}', 'kRaa': 'k_{Raa}', 'kRyy': 'k_{Ryy}', 'lP': 'l_P', 'lam': '\\lambda', 'mD': 'm_D', 'mF': 'm_F', 'mH': 'm_H', 'mP': 'm_B', 'mR': 'm_R', 'rF': 'r_F', 'rR': 'r_R', 'v': 'v', 'w': 'w', 'wP': 'w_P', 'xD': 'x_D', 'xH': 'x_H', 'xP': 'x_P', 'zD': 'z_D', 'zH': 'z-H', 'zP': 'z_P'}¶
- plot_all(ax=None)¶
Returns matplotlib axes with the geometry and inertial representations of all bodies of the bicycle parameter set.
- Parameters:
- ax: matplotlib Axes, optional
An axes to plot on.
Examples
from bicycleparameters.parameter_dicts import moore2019_browser_jason from bicycleparameters.parameter_sets import Moore2019ParameterSet p = Moore2019ParameterSet(moore2019_browser_jason) p.plot_all()
(
Source code
,png
,hires.png
,pdf
)
- plot_body_mass_center(body, ax=None)¶
Returns a matplotlib axes with a mass center symbol for the specified body to the plot.
- Parameters:
- bodystring
The body string: D, F, H, P, or R
- axSubplotAxes, optional
Axes to plot on.
Examples
from bicycleparameters.parameter_dicts import moore2019_browser_jason from bicycleparameters.parameter_sets import Moore2019ParameterSet p = Moore2019ParameterSet(moore2019_browser_jason) p.plot_body_mass_center('D')
(
Source code
,png
,hires.png
,pdf
)
- plot_body_principal_inertia_ellipsoid(body, ax=None)¶
Returns a matplotlib axes with an ellipse that respresnts the XZ plane view of a constant density ellipsoid which has the same principal moments and axes of inertia as the body.
- Parameters:
- bodystring
The body string: D, F, H, P, or R
- axSubplotAxes, optional
Axes to plot on.
Examples
from bicycleparameters.parameter_dicts import moore2019_browser_jason from bicycleparameters.parameter_sets import Moore2019ParameterSet p = Moore2019ParameterSet(moore2019_browser_jason) p.plot_body_principal_inertia_ellipsoid('P')
(
Source code
,png
,hires.png
,pdf
)
- plot_body_principal_radii_of_gyration(body, ax=None)¶
Returns a matplotlib axes with lines and a circle that indicate the principal radii of gyration of the specified body.
- Parameters:
- bodystring
The body string: D, F, H, P, or R
- axSubplotAxes, optional
Axes to plot on.
Examples
from bicycleparameters.parameter_dicts import moore2019_browser_jason from bicycleparameters.parameter_sets import Moore2019ParameterSet p = Moore2019ParameterSet(moore2019_browser_jason) p.plot_body_principal_radii_of_gyration('P')
(
Source code
,png
,hires.png
,pdf
)
- plot_geometry(show_steer_axis=True, ax=None)¶
Returns a matplotlib axes with the simplest drawing of the bicycle’s geometry.
- Parameters:
- show_steer_axisboolean
If true, a dotted line will be plotted along the steer axis from the front wheel center to the ground.
- axAxesSubplot, optional
An axes to draw on, otherwise one is created.
Examples
from bicycleparameters.parameter_dicts import moore2019_browser_jason from bicycleparameters.parameter_sets import Moore2019ParameterSet p = Moore2019ParameterSet(moore2019_browser_jason) p.plot_geometry()
(
Source code
,png
,hires.png
,pdf
)
- plot_mass_centers(bodies=None, ax=None)¶
Returns a matplotlib axes with a mass center symbols for the specified bodies to the plot.
- Parameters:
- bodies: list of strings, optional
A subset of the strings present in the class attribute
body_labels
.- ax: matplotlib Axes, optional
An axes to plot on.
Examples
from bicycleparameters.parameter_dicts import moore2019_browser_jason from bicycleparameters.parameter_sets import Moore2019ParameterSet p = Moore2019ParameterSet(moore2019_browser_jason) p.plot_mass_centers()
(
Source code
,png
,hires.png
,pdf
)
- plot_person_diamond(show_cross=False, ax=None)¶
Plots a diamond that represents the approximate person’s physical extents.
- Parameters:
- show_crossboolean, optional
Plots a cross in the diamond that spans opposite vertices.
- axAxesSubplot, optional
An axes to draw on, otherwise one is created.
Examples
from bicycleparameters.parameter_dicts import moore2019_browser_jason from bicycleparameters.parameter_sets import Moore2019ParameterSet p = Moore2019ParameterSet(moore2019_browser_jason) p.plot_person_diamond()
(
Source code
,png
,hires.png
,pdf
)
- plot_principal_inertia_ellipsoids(bodies=None, ax=None)¶
Returns a Matplotlib axes with 2D representations of 3D solid uniform ellipsoids that have the same inertia as the body.
- Parameters:
- bodies: list of strings, optional
A subset of the strings present in the class attribute
body_labels
.- ax: matplotlib Axes, optional
An axes to plot on.
Examples
from bicycleparameters.parameter_dicts import moore2019_browser_jason from bicycleparameters.parameter_sets import Moore2019ParameterSet p = Moore2019ParameterSet(moore2019_browser_jason) p.plot_principal_inertia_ellipsoids()
(
Source code
,png
,hires.png
,pdf
)
- plot_principal_radii_of_gyration(bodies=None, ax=None)¶
Returns a matplotlib axes with lines and a circle that indicate the principal radii of gyration for all five bodies.
- Parameters:
- bodieslist of strings, optional
Either [‘D’, ‘F’, ‘H’, ‘P’, ‘R’] or a subset thereof.
- axAxesSubplot, optional
An axes to draw on, otherwise one is created.
Examples
from bicycleparameters.parameter_dicts import moore2019_browser_jason from bicycleparameters.parameter_sets import Moore2019ParameterSet p = Moore2019ParameterSet(moore2019_browser_jason) p.plot_principal_radii_of_gyration()
(
Source code
,png
,hires.png
,pdf
)
- to_ini(fname)¶
Writes parameters to file in the INI format. Metadata is not included.
- Parameters:
- fnamestring
Path to file.
- to_parameterization(name)¶
Returns a specific parameter set based on the provided parameterization name.
- Parameters:
- namestring
The name of the parameterization. These should correspond to a subclass of a
ParameterSet
and the name will be the string that precedes “ParameterSet”. For example, the parameterization name ofMeijaard2007ParameterSet
isMeijaard2007
.
- Returns:
- ParmeterSet
If a different parameterization is requested and this class can convert itself, it will return a new parameter set of the correct parameterization.
Examples
>>> from bicycleparameters.parameter_dicts import moore2019_browser_jason >>> from bicycleparameters.parameter_sets import Moore2019ParameterSet >>> moore_set = Moore2019ParameterSet(moore2019_browser_jason) >>> moore_set.mass_center_of('P', 'D') array([ 0.31156277, 0. , -1.03972442]) >>> meijaard_set = moore_set.to_parameterization('Meijaard2007') >>> meijaard_set.mass_center_of('B') array([ 0.31156277, 0. , -1.03972442])
- to_yaml(fname)¶
Writes parameters to file in the YAML format.
- Parameters:
- fnamestring
Path to file.
- class MooreRiderLean2012ParameterSet(parameters)¶
Bases:
ParameterSet
Represents the parameters of the Carvallo-Whipple model with a leaning rider presented in [Moore2012].
The four bodies are:
C: rear frame + rigid rider
D: rear wheel
E: front frame (fork & handlebars)
F: front wheel
- Parameters:
- parametersdictionary
A dictionary mapping variable names to values that contains the following keys:
‘c9’
‘d1’
‘d2’
‘d3’
‘d4’
‘g’
‘ic11’
‘ic22’
‘ic31’
‘ic33’
‘id11’
‘id22’
‘ie11’
‘ie22’
‘ie31’
‘ie33’
‘if11’
‘if22’
‘ig11’
‘ig22’
‘ig31’
‘ig33’
‘k9’
‘l1’
‘l2’
‘l3’
‘l4’
‘l5’
‘l6’
‘mc’
‘md’
‘me’
‘mf’
‘mg’
‘rf’
‘rr’
‘v’
- Attributes:
- par_stringsdictionary
Maps ASCII strings to their LaTeX string.
- body_labelslist of strings
Single letters that correspond to the four rigid bodies in the model.
- body_labels = ['C', 'D', 'E', 'F', 'G']¶
- par_strings = {'c9': 'c_9', 'd1': 'd_1', 'd2': 'd_2', 'd3': 'd_3', 'd4': 'd_4', 'g': 'g', 'ic11': 'I_{C11}', 'ic22': 'I_{C22}', 'ic31': 'I_{C31}', 'ic33': 'I_{C33}', 'id11': 'I_{D11}', 'id22': 'I_{D22}', 'ie11': 'I_{D11}', 'ie22': 'I_{E22}', 'ie31': 'I_{E31}', 'ie33': 'I_{E33}', 'if11': 'I_{F11}', 'if22': 'I_{F22}', 'ig11': 'I_{G11}', 'ig22': 'I_{G22}', 'ig31': 'I_{G31}', 'ig33': 'I_{G33}', 'k9': 'k_9', 'l1': 'l_1', 'l2': 'l_2', 'l3': 'l_3', 'l4': 'l_4', 'l5': 'l_5', 'l6': 'l_6', 'mc': 'm_C', 'md': 'm_D', 'me': 'm_E', 'mf': 'm_F', 'mg': 'm_G', 'rf': 'r_f', 'rr': 'r_r', 'v': 'v'}¶
- to_ini(fname)¶
Writes parameters to file in the INI format. Metadata is not included.
- Parameters:
- fnamestring
Path to file.
- to_parameterization(name)¶
Returns a specific parameter set based on the provided parameterization name.
- Parameters:
- namestring
The name of the parameterization. These should correspond to a subclass of a
ParameterSet
and the name will be the string that precedes “ParameterSet”. For example, the parameterization name ofMeijaard2007ParameterSet
isMeijaard2007
.
- Returns:
- ParmeterSet
If a different parameterization is requested and this class can convert itself, it will return a new parameter set of the correct parameterization.
- to_yaml(fname)¶
Writes parameters to file in the YAML format.
- Parameters:
- fnamestring
Path to file.
- class ParameterSet(par_dict)¶
Bases:
ABC
A parameter set is a collection of constants with associated floating point values that are present in a set of differential algebraic equations that represent a multibody bicycle model. These pairs are typically defined in a specific academic article, dissertation, book chapter, or section and subclasses should be named in a way that ties them to that written work. Parameter sets must be named with this pattern
NameOfMySetParameterSet
whereNameOfMySet
is a unique name other than something that includesParameterSet
.A parameter set, or a subset of the parameters, can be used with multiple different models. A parameter set is associated with a particular parameterization of one or more models. Parameter sets can be converted to equivalent parameter sets, but only by assuming a particular model configuration. The obvious configuration for a bicycle model is the upright, zero steer state. But if, for example, a rider configuration is included, then some nominal configuration would need to be defined for conversion consistency.
Each parameter set should have a unique set of ASCII strings that represent the constants in a model.
- Attributes:
- par_stringsdictionary
Maps ASCII strings to their LaTeX string.
- par_strings = {'aR': 'a_R', 'beta': '\\beta'}¶
- to_ini(fname)¶
Writes parameters to file in the INI format. Metadata is not included.
- Parameters:
- fnamestring
Path to file.
- to_parameterization(name)¶
Returns a specific parameter set based on the provided parameterization name.
- Parameters:
- namestring
The name of the parameterization. These should correspond to a subclass of a
ParameterSet
and the name will be the string that precedes “ParameterSet”. For example, the parameterization name ofMeijaard2007ParameterSet
isMeijaard2007
.
- Returns:
- ParmeterSet
If a different parameterization is requested and this class can convert itself, it will return a new parameter set of the correct parameterization.
- to_yaml(fname)¶
Writes parameters to file in the YAML format.
- Parameters:
- fnamestring
Path to file.