Multiple Devices
AUTD3 can compose several devices into one large array by daisy-chaining them. The SDK is designed so that multiple devices can be handled transparently.
When using multiple devices, pass Autd3 to the Geometry::new argument in the order the devices are connected.
The following shows the procedure for connecting two devices.
Translation only
Section titled “Translation only”For example, suppose the first device is placed on the left and the second on the right, and the global coordinates are taken to be the same as the first device’s local coordinates. The code then looks as follows.
Geometry::new(vec![ Autd3::new(Point3::origin(), UnitQuaternion::identity()), Autd3::new( Point3::new(Autd3::DEVICE_WIDTH, 0.0, 0.0), UnitQuaternion::identity(), ),]);Geometry( [ Autd3([0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]), Autd3( origin=(Autd3.DEVICE_WIDTH, 0.0, 0.0), rotation=(1.0, 0.0, 0.0, 0.0), ), ])new Geometry(new[]{ new Autd3(Vector3.Zero, Quaternion.Identity), new Autd3( new Vector3(Autd3.DeviceWidth, 0.0f, 0.0f), Quaternion.Identity ),});Here the first argument represents the device position in global coordinates, and the second argument represents the device rotation.
Note that Autd3::DEVICE_WIDTH is the width of the device (including the board outline).
Configuring the global coordinates
Section titled “Configuring the global coordinates”The origin and orientation of the global coordinates used by the SDK can be set freely by the user. For example, if the global coordinates are taken to be the same as the second device’s local coordinates, the code offsets the first device in the -x direction as follows.
Geometry::new(vec![ Autd3::new( Point3::new(-Autd3::DEVICE_WIDTH, 0.0, 0.0), UnitQuaternion::identity(), ), Autd3::new(Point3::origin(), UnitQuaternion::identity()),]);Geometry( [ Autd3( origin=(-Autd3.DEVICE_WIDTH, 0.0, 0.0), rotation=(1.0, 0.0, 0.0, 0.0), ), Autd3([0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]), ])new Geometry(new[]{ new Autd3( new Vector3(-Autd3.DeviceWidth, 0.0f, 0.0f), Quaternion.Identity ), new Autd3(Vector3.Zero, Quaternion.Identity),});Translation and rotation
Section titled “Translation and rotation”The device rotation is specified with the second argument (UnitQuaternion) of Autd3::new.
For example, placing the second device in the +z direction and rotating it 90° about the y axis gives the following.
Geometry::new(vec![ Autd3::new(Point3::origin(), UnitQuaternion::identity()), Autd3::new( Point3::new(0.0, 0.0, Autd3::DEVICE_WIDTH), UnitQuaternion::from_axis_angle(&Vector3::y_axis(), FRAC_PI_2), ),]);Geometry( [ Autd3([0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]), Autd3( origin=(0.0, 0.0, Autd3.DEVICE_WIDTH), rotation=Rotation.from_euler("y", 90.0, degrees=True), ), ])new Geometry(new[]{ new Autd3(Vector3.Zero, Quaternion.Identity), new Autd3( new Vector3(0.0f, 0.0f, Autd3.DeviceWidth), Quaternion.CreateFromAxisAngle(Vector3.UnitY, MathF.PI / 2.0f) ),});