geometry Module

Solves a simple case of the two-link revolute joint inverse kinematics problem. Both output angles are positive. The simple case is that the end of the second link lies on the x-axis.

Parameters:
L1float

Length of the first link.

L2float

Length of the second link.

Dfloat

Distance from the base of first link to the end of the second link.

Returns:
theta1float

(radians) Angle between x-axis and first link; always positive.

theta2float

(radians) Angle between first link and second link; always positive.

calculate_abc_geometry(h, d)

Returns the perpendicular distance geometry for the bicycle from the raw measurements.

Parameters:
htuple

Tuple containing the measured parameters h1-h5. (h1, h2, h3, h4, h5)

dtuple

Tuple containing the measured parameters d1-d4 and d. (d1, d2, d3, d4, d)

Returns:
aufloat or float

The rear frame offset.

bufloat or float

The fork offset.

cufloat or float

The steer axis distance.

calculate_benchmark_geometry(mp, par)

Returns the wheelbase, steer axis tilt and the trail.

Parameters:
mpdictionary

Dictionary with the measured parameters.

pardictionary

Dictionary with the benchmark parameters.

Returns:
pardictionary

par with the benchmark geometry added.

calculate_l1_l2(h6, h7, d5, d6, l)

Returns the distance along (l2) and perpendicular (l1) to the steer axis from the front wheel center to the handlebar reference point.

Parameters:
h6float

Distance from the table to the top of the front axle.

h7float

Distance from the table to the top of the handlebar reference circle.

d5float

Diameter of the front axle.

d6float

Diameter of the handlebar reference circle.

lfloat

Outer distance from the front axle to the handlebar reference circle.

Returns:
l1float

The distance from the front wheel center to the handlebar reference center perpendicular to the steer axis. The positive sense is if the handlebar reference point is more forward than the front wheel center relative to the steer axis normal.

l2float

The distance from the front wheel center to the handlebar reference center parallel to the steer axis. The positive sense is if the handlebar reference point is above the front wheel center with reference to the steer axis.

distance_to_steer_axis(w, c, lam, point)

Returns the minimal distance from the steer axis to the given point when the bicycle is in the nominal configuration.

Parameters:
wfloat or ufloat

Wheelbase.

cfloat or ufloat

Trail.

lamfloat or ufloat

Steer axis tilt in radians.

pointnarray, shape(3,)

A point that lies in the symmetry plane of the bicycle.

Returns:
dfloat or ufloat

The minimal distance from the given point to the steer axis.

fundamental_geometry_plot_data(par)

Returns the coordinates for line end points of the bicycle fundamental geometry.

Parameters:
pardictionary

Benchmark bicycle parameters.

Returns:
xndarray
zndarray
fwheel_to_handlebar_ref(lam, l1, l2)

Returns the distance along the benchmark coordinates from the front wheel center to the handlebar reference center.

Parameters:
lamfloat

Steer axis tilt.

l1, l2float

The distance from the front wheel center to the handlebar refernce center perpendicular to and along the steer axis.

Returns:
u1, u2float
point_to_line_distance(point, pointsOnLine)

Returns the minimal distance from a point to a line in three dimensional space.

Parameters:
pointndarray, shape(3,)

The x, y, and z coordinates of a point.

pointsOnLinendarray, shape(3,2)

The x, y, and z coordinates of two points on a line. Rows are coordinates and columns are points.

Returns:
distancefloat

The minimal distance from the line to the point.

project_point_on_line(line, point)

Returns point of projection.

Parameters:
linetuple

Slope and intercept of the line.

pointtuple

Location of the point.

Returns:
newPointtuple

The location of the projected point.

vec_angle(v1, v2)

Returns the interior angle between two vectors using the dot product. Inputs do not need to be unit vectors.

Parameters:
v1np.array (3,1)

input vector.

v2np.array (3,1)

input vector.

Returns:
anglefloat

(radians) interior angle between v1 and v2.

vec_project(vec, direction)

Vector projection into a plane, where the plane is defined by a normal vector.

Parameters:
vecnp.array(3,1)

vector to be projected into a plane

directionint or np.array, shape(3,)

If int, it is one of the three orthogonal directions, (0,1 or 2) of the input vector (essentially, that component of vec is set to zero). If np.array, can be in any direction (not necessarily a coordinate direction).

Returns:
vec_outnp.array(3,1)

Projected vector.