Skip to content

Remote

RemoteLink is a Link implementation that connects over TCP to a separate host connected to the AUTD3 devices for sending and receiving.

Used to connect to the Appliance or the Simulator.

RemoteLinkOption { addr, timeout };
Field Type Description
addr SocketAddr address of the server to connect to
timeout Option<Duration> how long to wait on the connect and on every frame. None leaves the OS defaults.

The server (an Appliance or the Simulator) can be found over mDNS.

RemoteLinkOption::discover()?;

The servers found are picked in this order.

  1. a Simulator running on the local host
  2. an Appliance
  3. a Simulator running on another host

Finding no server, and finding more than one at the highest priority, are both errors. The error for the latter lists what was found, so one of them can be picked with discover_with.

RemoteLinkOption::discover_with(&DiscoveryOption {
timeout,
instance: Some("autd3-0a1b2c3d".to_string()),
..Default::default()
})?;
Field Type Description
timeout Duration how long to wait for answers. 2 seconds by default.
instance Option<String> name of the server to look for. None means every server
kind Option<ServerKind> kind of server to look for (Appliance / Simulator). None means both. Rust only

Use discover_all when only the list is wanted.

for server in autd3_rs_link_remote::discover_all(&DiscoveryOption::default())? {
println!("{} ({}) at {}", server.instance, server.kind, server.addr);
}

RemoteServer lets you run the server that RemoteLink connects to yourself.

On the server-side host, also add the package of the Link that drives the real hardware (such as Echocat).

Pass the listening settings and a closure that opens the real-hardware link to RemoteServer::new, then call serve to start relaying.

The device count of the client’s Geometry has to match the device count of the bus on the server.

Setting rt_priority may require privileges (CAP_SYS_NICE on Linux). Without them the server warns and runs with plain scheduling, which may make the bus unstable under load.

For a real example, see the appliance documentation and the appliance implementation.

let bus = BusOption {
pacing,
rt_priority,
rt_policy,
rt_affinity,
stack_prefault_bytes,
..Default::default()
};
let option = RemoteServerOption {
bind,
bus,
idle_timeout,
..Default::default()
};
RemoteServer::new(option, |_: &[DeviceLayout]| {
EchocatLink::open(&EchocatLinkOption::default())
.map_err(|e| RemoteLinkError::Link(e.to_string()))
})?
.serve()?;
Parameter Type Description
option RemoteServerOption listening address and bus thread settings
factory FnMut(&[DeviceLayout]) -> Result<impl Link> closure that opens the real-hardware link
Field Type Description
bind SocketAddr TCP address on which the server listens
bus BusOption bus thread settings
idle_timeout Duration how long a session may go without traffic before it is dropped. 10 seconds by default
Field Type Description
pacing BusPacing EtherCAT bus cycle period. Leave the pacing to the link with LinkPaced for a real-hardware link
rt_priority Option<RtPriority> priority of the bus thread. A real-time priority by default
rt_policy RtSchedulePolicy scheduling policy of the bus thread
rt_affinity Option<CoreId> CPU core to pin the bus thread to
stack_prefault_bytes usize bytes of the bus thread stack to page in at start-up. 0 by default