これは開発版のドキュメントである. 内容は次のリリースまでに変更される可能性がある. 最新のリリース版は 0.14.x を参照.
SetCpuConfig
SetCpuConfig は, CPU ファームウェアが内部で使う設定値 (failsafe・ウォッチドッグ・PTP 同期のパラメータなど) を変更するコマンド.
let config = CpuConfig { sync_guard, failsafe_timeout, ptp_unlock_failsafe_timeout, fpga_bus_wait, cpu_watchdog_timeout, ptp: PtpConfig { sync_interval, tx_timestamp_timeout, delay_resp_timeout, holdover, lock_samples, step_threshold, lock_threshold, kp_milli, ki_milli, max_freq_ppb, delay_req_syncs, path_delay_filter_shift, pause_quanta, pause_hold_syncs, pause_retry, },};SetCpuConfig::new(config);config = CpuConfig( sync_guard=sync_guard, failsafe_timeout=failsafe_timeout, ptp_unlock_failsafe_timeout=ptp_unlock_failsafe_timeout, fpga_bus_wait=fpga_bus_wait, cpu_watchdog_timeout=cpu_watchdog_timeout, ptp=PtpConfig( sync_interval=sync_interval, tx_timestamp_timeout=tx_timestamp_timeout, delay_resp_timeout=delay_resp_timeout, holdover=holdover, lock_samples=lock_samples, step_threshold=step_threshold, lock_threshold=lock_threshold, kp_milli=kp_milli, ki_milli=ki_milli, max_freq_ppb=max_freq_ppb, delay_req_syncs=delay_req_syncs, path_delay_filter_shift=path_delay_filter_shift, pause_quanta=pause_quanta, pause_hold_syncs=pause_hold_syncs, pause_retry=pause_retry, ),)SetCpuConfig(config)var config = new CpuConfig{ SyncGuard = syncGuard, FailsafeTimeout = failsafeTimeout, PtpUnlockFailsafeTimeout = ptpUnlockFailsafeTimeout, FpgaBusWait = fpgaBusWait, CpuWatchdogTimeout = cpuWatchdogTimeout, Ptp = new PtpConfig { SyncInterval = syncInterval, TxTimestampTimeout = txTimestampTimeout, DelayRespTimeout = delayRespTimeout, Holdover = holdover, LockSamples = lockSamples, StepThreshold = stepThreshold, LockThreshold = lockThreshold, KpMilli = kpMilli, KiMilli = kiMilli, MaxFreqPpb = maxFreqPpb, DelayReqSyncs = delayReqSyncs, PathDelayFilterShift = pathDelayFilterShift, PauseQuanta = pauseQuanta, PauseHoldSyncs = pauseHoldSyncs, PauseRetry = pauseRetry, },};new SetCpuConfig(config);CpuConfig
Section titled “CpuConfig”| フィールド | 型 | 既定値 | 説明 |
|---|---|---|---|
sync_guard |
Duration |
250 μs | 同期開始時刻の選択マージン |
failsafe_timeout |
Option<Duration> |
None |
ホストからの通信がこの時間途絶えるとデバイスが出力を止める (failsafe). None は failsafe 無効 |
ptp_unlock_failsafe_timeout |
Option<Duration> |
None |
PTP のロックを失ったままこの時間が経つと, そのデバイスが出力を止める. None は無効 |
fpga_bus_wait |
FpgaBusWait |
Cycles3 |
CPU が FPGA を読み書きするバスのウェイト周期数. Cycles2 または Cycles3 |
cpu_watchdog_timeout |
Option<Duration> |
1 s | CPU ファームウェアがこの時間止まると出力を止める. None は無効 |
ptp |
PtpConfig |
PTP 同期のパラメータ |
PtpConfig
Section titled “PtpConfig”| フィールド | 型 | 既定値 | 説明 |
|---|---|---|---|
sync_interval |
Duration |
8 ms | Sync メッセージの送出間隔 |
tx_timestamp_timeout |
Duration |
3 ms | Delay_Req の送信タイムスタンプの回収待ち上限 |
delay_resp_timeout |
Duration |
6 ms | Delay_Resp の待ち上限 |
holdover |
Duration |
1 s | ロック中に Sync を受けられないままロックを保つ時間 |
lock_samples |
NonZeroU16 |
64 | ロックに必要な連続標本数 |
step_threshold |
Duration |
10 μs | 時刻のずれがこれを超えたら時計を強制的に揃える |
lock_threshold |
Duration |
100 ns | 時刻のずれがこれ未満の標本をロックに数える |
kp_milli |
u32 |
50 | サーボの比例ゲイン × 1000 |
ki_milli |
u32 |
1 | サーボの積分ゲイン × 1000 |
max_freq_ppb |
u32 |
500,000 | 周波数補正の上限 [ppb]. 0 から 2,147,483,647 (超えるとデバイスが拒否する) |
delay_req_syncs |
NonZeroU16 |
32 | ロック後に経路遅延を測り直す間隔 (Sync の回数) |
path_delay_filter_shift |
u8 |
5 | 経路遅延の平滑化の係数 1 / 2^n. 0 から 16 (超えるとデバイスが拒否する). 0 で平滑化しない |
pause_quanta |
Option<NonZeroU16> |
48 | 回線が飽和したときにホストへ送られる PAUSE の長さ [512 ビット時間]. None で PAUSE を送らない |
pause_hold_syncs |
u16 |
64 | 一度詰まってから, 送信のたびに PAUSE を送り続ける Sync の回数 |
pause_retry |
Duration |
8 ms | Sync を送り出せない間, PAUSE を送り続ける時間 |
設定値は Clear と電源再投入で既定値に戻る. クライアントを開き直しても戻らない.
Example
Section titled “Example”use std::time::Duration;
use autd3_rs::commands::{Clear, CpuConfig, SetCpuConfig, Synchronize};use autd3_rs::geometry::{Autd3, Geometry};use autd3_rs::Client;use autd3_rs::udp::TransportOption;
let geometry = Geometry::new(vec![Autd3::default()]);let option = TransportOption::default();let mut client = Client::open(&geometry, &option).await?;client.send(Clear).await?;client.send(Synchronize).await?;
client.send(SetCpuConfig::new(CpuConfig { ptp_unlock_failsafe_timeout: Some(Duration::from_secs(2)), ..Default::default()})).await?;import asyncio
from autd3 import Client, Duration, TransportOptionfrom autd3.commands import Clear, CpuConfig, SetCpuConfig, Synchronizefrom autd3.geometry import Autd3, Geometry
async def main() -> None: geometry = Geometry([Autd3()]) with await Client.open(geometry, TransportOption()) as client: await client.send(Clear()) await client.send(Synchronize())
await client.send(SetCpuConfig(CpuConfig(ptp_unlock_failsafe_timeout=Duration.from_secs(2))))
asyncio.run(main())using System;using System.Threading.Tasks;using AUTD3;
var geometry = new Geometry(new[] { new Autd3() });using var client = await Client.OpenAsync(geometry, new TransportOption());await client.SendAsync(new Clear());await client.SendAsync(new Synchronize());
await client.SendAsync(new SetCpuConfig(new CpuConfig { PtpUnlockFailsafeTimeout = TimeSpan.FromSeconds(2) }));