larvaworld.lib.model.modules.crawler
Classes
Base crawler module for peristaltic locomotion. |
|
Stride-based oscillatory crawler with variable step length. |
|
Gaussian-windowed oscillatory crawler. |
|
Square-wave oscillatory crawler. |
|
Phase-modulated oscillatory crawler with realistic velocity profile. |
Module Contents
- class larvaworld.lib.model.modules.crawler.Crawler(**kwargs: Any)
Bases:
larvaworld.lib.model.modules.basic.StepEffectorBase crawler module for peristaltic locomotion.
Abstract base class for crawling behavior modules that generate forward locomotion through peristaltic waves. Extends StepEffector to provide stride-based movement with oscillatory patterns.
- Example:
>>> # Use concrete subclasses like StrideOscillator, GaussOscillator >>> crawler = GaussOscillator(freq=1.5, stride_dst_mean=0.25)
- class larvaworld.lib.model.modules.crawler.StrideOscillator(**kwargs: Any)
Bases:
Crawler,larvaworld.lib.model.modules.basic.StepOscillatorStride-based oscillatory crawler with variable step length.
Implements peristaltic crawling using frequency-based oscillation with stochastic stride lengths. Each stride distance is sampled from a normal distribution, providing realistic locomotion variability.
- Attributes:
freq: Oscillation frequency in Hz (0.5-3.0) stride_dst_mean: Mean stride distance (fraction of body length) stride_dst_std: Stride distance standard deviation step_to_length: Current stride distance (resampled each stride)
- Example:
>>> crawler = StrideOscillator(freq=1.42, stride_dst_mean=0.23, stride_dst_std=0.04) >>> velocity = crawler.step()
- freq
- stride_dst_mean
- stride_dst_std
- step_to_length
- property new_stride: float
- property Act: float
- act_on_complete_iteration() None
- suppresion_relief(phi_range: tuple[float, float]) bool
- class larvaworld.lib.model.modules.crawler.GaussOscillator(**kwargs: Any)
Bases:
StrideOscillatorGaussian-windowed oscillatory crawler.
Extends StrideOscillator with gaussian-shaped velocity modulation within each stride cycle. Provides smooth, biologically realistic acceleration/deceleration profiles during peristaltic crawling.
- Attributes:
std: Standard deviation of gaussian window (fraction of cycle, 0-1) gauss_w: Precomputed 360-point gaussian window for cycle modulation
- Example:
>>> crawler = GaussOscillator(freq=1.5, std=0.6, stride_dst_mean=0.25) >>> velocity = crawler.step()
- std
- gauss_w
- property Act_Phi: float
- class larvaworld.lib.model.modules.crawler.SquareOscillator(**kwargs: Any)
Bases:
StrideOscillatorSquare-wave oscillatory crawler.
Extends StrideOscillator with square-wave velocity modulation, creating distinct power/recovery phases in each stride cycle.
- Attributes:
- duty: Duty cycle fraction (0-1) for square wave modulation
Controls percentage of time at maximum velocity
- Example:
>>> crawler = SquareOscillator(freq=1.2, duty=0.6, stride_dst_mean=0.20) >>> velocity = crawler.step()
- duty
- property Act_Phi: float
- suppresion_relief(phi_range: tuple[float, float]) bool
- class larvaworld.lib.model.modules.crawler.PhaseOscillator(**kwargs: Any)
Bases:
StrideOscillatorPhase-modulated oscillatory crawler with realistic velocity profile.
Extends StrideOscillator with cosine-based phase modulation, producing the most biologically realistic peristaltic crawling patterns. Velocity peaks at a configurable phase within each stride cycle.
- Attributes:
max_vel_phase: Phase angle (radians) where velocity is maximum max_scaled_vel: Maximum scaled forward velocity coefficient
- Example:
>>> crawler = PhaseOscillator(freq=1.42, max_vel_phase=3.49, max_scaled_vel=0.51) >>> velocity = crawler.step()
- max_vel_phase
- max_scaled_vel
- property Act_Phi: float
- property Act_coef: float