Skip to content
This is the development version of the documentation. It may change before the next release. See 0.6.x for the latest release.

ConfigFociStm

ConfigFociStm is a low-level command that configures the playback parameters of the Foci STM bank.

ConfigFociStm {
bank,
config,
size,
num_foci,
sound_speed,
loop_behavior,
};
Field Type Description
bank PatternBank Target bank
config SamplingConfig Playback sampling frequency
size usize Number of STM samples (at least 2)
num_foci u8 Number of focal points per sample (the N of ControlPoints<N>)
sound_speed Velocity Sound speed used for focal point computation
loop_behavior LoopBehavior Playback loop count (Infinite / Finite)

The minimum size is 2. To emit a single focal point statically, use Pattern instead of an STM.

For the timing at which loop_behavior and the transition take effect see ChangePatternBank.

ConfigFociStm is used within the flow of writing the focal point sequence with WriteFociBuffer and then switching playback with ChangePatternBank.

use autd3_rs::commands::{ChangePatternBank, ConfigFociStm, StmConfig, WriteFociBuffer, circle};
use autd3_rs::geometry::{Autd3, Geometry, Vector3, offset};
use autd3_rs::units::{Hz, m, mm, s};
use autd3_rs::value::{Intensity, LoopBehavior, PatternBank, TransitionMode};
use autd3_rs::{Client, ClientConfig};
use autd3_rs_link_nop::Nop;
let geometry = Geometry::new(vec![Autd3::default()]);
let client = Client::open(&geometry, Nop, ClientConfig::default()).await?;
let center = geometry.center() + offset(0.0 * mm, 0.0 * mm, 150.0 * mm);
let mut points = Vec::new();
circle(
center,
30.0 * mm,
200,
Vector3::z_axis(),
Intensity::MAX,
&mut points,
);
let bank = PatternBank::B0;
let mut builder = client.datagram_builder();
builder.push(WriteFociBuffer {
bank,
index_offset: 0,
points: &points,
});
builder.push(ConfigFociStm {
bank,
config: StmConfig::new(1.0 * Hz).into_sampling_config(points.len()),
size: points.len(),
num_foci: 1,
sound_speed: 340.0 * m / s,
loop_behavior: LoopBehavior::Infinite,
});
builder.push(ChangePatternBank {
bank,
transition_mode: TransitionMode::Immediate,
});
let frames = builder.build()?;
for frame in &frames {
client.send_checked(frame).await?;
}
client.close().await?;