Planar Crank-Rocker Designer

Python Design Tools for Simple and Folding Wings

PCR Designer is a Python tool for choosing the link geometry of flapping-wing mechanisms and inspecting the motion it produces. It covers a non-folding Simple Wing and a Folding Wing driven by the same inner crank-rocker mechanism.

The tool evaluates rigid-link geometry and motion; aerodynamic loads and structural flexibility are outside this model.

Both views below use the same scale and crank phase.

Simple and Folding Wing geometry at the same crank phase, with equal scales and enlarged drive linkages.

Simple and Folding Wings

A planar crank-rocker (PCR) is a four-link mechanism that converts continuous crank rotation into the back-and-forth rotation of a rocker. Here, that rocker drives the wing.

Simple Wing

The Simple Wing has no folding joint. Its full span follows the rocker as one segment, so the inner PCR sets the flapping amplitude and midrange wing angle.

Inputs specify the fixed-link length, target stroke and midrange angle. Outputs include the linkage, flapping-angle history, transmission angle and wing-tip trajectory. The transmission angle is the angle between the coupler and rocker.

Folding Wing

The Folding Wing adds an outer segment and a coupled linkage. Its inner wing follows the same PCR motion; the additional links set the outer-wing orientation and the relative folding angle between the two segments.

The design inputs add inner/outer wing lengths and folding targets. The output includes the added linkage, inner and outer flapping histories, relative folding history and wing-tip trajectory.

Linkage Optimization

The first stage searches the PCR installation angle and three moving-link lengths. Its objective combines transmission-angle deviation from 90.00 degrees and the selected phase measure, while constraints enforce target motion and geometric feasibility.

The second stage holds the chosen inner linkage fixed and searches two additional link lengths and an outer-wing angular offset for the folding mechanism. It maximizes the angular sweep of the shoulder-to-tip direction subject to the configured folding and clearance constraints. This sweep differs from the rotation range of the outer segment alone.

Both stages use constrained search and local refinement; the inner solution also uses bounded least-squares target restoration.

Example Results

Both examples use the same optimized inner linkage, a 64.00 mm fixed link and a 600.00 mm wing length. The Simple Wing keeps that length as one segment; the Folding Wing divides it into 215.00 mm and 385.00 mm segments. The reference flapping frequency is 6.5 Hz.

The flapping amplitude is the peak-to-peak angular range. The midrange angle is half the sum of the minimum and maximum angles, rather than a time average. Folding angle is the inner-wing angle minus the outer-wing angle. Geometry is shown in the Y-Z plane, with the shoulder at the origin. Wing angles increase from +Y toward +Z; lengths are in millimetres and angles in degrees.

QuantityTargetComputed resultAbsolute error
Simple / inner flapping amplitude45.00°45.00°<0.001°
Simple / inner midrange angle12.50°12.50°<0.001°
Folding amplitude60.00°60.00°<0.001°
Minimum folding angle−10.00°−10.00°<0.001°

The first two quantities apply to both the Simple Wing and the inner segment of the Folding Wing.

Computed flapping, transmission and folding angle histories over one cycle, compared at equal axis limits.

The inner solver uses a 0.001° target band, while verification requires actual angular errors to be strictly below 0.01°. All checked angular errors were below 0.001° at 115,200 crank positions; the final grid refinement changed each angle by less than 0.001°. Full values and sampling checks are available in the verification results.

The animation shows one cycle at 38.8× slower playback.

One computed cycle of Simple and Folding Wing motion shown together at 38.8 times slower playback.

Using PCR Designer

Use Python 3.12. The repository README includes platform-specific environment setup.

git clone --branch pcr-designer-v0.1.1 https://github.com/HHYang95/YANG_Resources.git
cd YANG_Resources/Planar_Crank_Rocker_Designer

After creating and activating the environment:

python -m pip install .
python -m pcr_designer check examples/reference_pair.result.json --samples 7200

To change targets, copy examples/reference_pair.json to my_pair.json, edit that copy, then run:

python -m pcr_designer example --config my_pair.json --output my_pair.result.json
python -m pcr_designer motion my_pair.result.json --output my_pair.motion.json

The check command evaluates the saved geometry. The example command runs a new optimization and writes a separate result file.

Source Code

PCR Designer is available in YANG_Resources. Version 0.1.1 contains the source and example used here. The project folder is licensed under Apache License 2.0.