1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use anyhow::Result;
use autd3_driver::{Drive, TxDatagram};
use super::Vector3;
pub trait Transducer: Sized {
fn new(
id: usize,
pos: Vector3,
x_direction: Vector3,
y_direction: Vector3,
z_direction: Vector3,
) -> Self;
fn align_phase_at(&self, dist: f64, sound_speed: f64) -> f64;
fn position(&self) -> &Vector3;
fn id(&self) -> usize;
fn x_direction(&self) -> &Vector3;
fn y_direction(&self) -> &Vector3;
fn z_direction(&self) -> &Vector3;
fn cycle(&self) -> u16;
fn frequency(&self) -> f64;
fn mod_delay(&self) -> u16;
fn set_mod_delay(&mut self, delay: u16);
fn wavelength(&self, sound_speed: f64) -> f64;
fn wavenumber(&self, sound_speed: f64) -> f64;
fn pack_head(tx: &mut TxDatagram);
fn pack_body(
phase_sent: &mut bool,
duty_sent: &mut bool,
drives: &[Drive],
tx: &mut TxDatagram,
) -> Result<()>;
fn gain_stm_max() -> usize;
}