  Two-dimensional, resonant scanners have been utilized in a large variety of
imaging modules due to their compact form, low power consumption, large angular
range, and high speed. However, resonant scanners have problems with
non-optimal and inflexible scanning patterns and inherent phase uncertainty,
which limit practical applications. Here we propose methods for optimized
design and control of the scanning trajectory of two-dimensional resonant
scanners under various physical constraints, including high frame-rate and
limited actuation amplitude. First, we propose an analytical design rule for
uniform spatial sampling. We demonstrate theoretically and experimentally that
by including non-repeating scanning patterns, the proposed designs outperform
previous designs in terms of scanning range and fill factor. Second, we show
that we can create flexible scanning patterns that allow focusing on
user-defined Regions-of-Interest (RoI) by modulation of the scanning
parameters. The scanning parameters are found by an optimization algorithm. In
simulations, we demonstrate the benefits of these designs with standard metrics
and higher-level computer vision tasks (LiDAR odometry and 3D object
detection). Finally, we experimentally implement and verify both unmodulated
and modulated scanning modes using a two-dimensional, resonant MEMS scanner.
Central to the implementations is high bandwidth monitoring of the phase of the
angular scans in both dimensions. This task is carried out with a
position-sensitive photodetector combined with high-bandwidth electronics,
enabling fast spatial sampling at ~ 100Hz frame-rate.
