コンテンツにスキップ
これは開発版のドキュメントである. 内容は次のリリースまでに変更される可能性がある. 最新のリリース版は 0.6.x を参照.

EtherCrab

EtherCrabLink は Rust 製の EtherCAT マスタ EtherCrab を用いた Link 実装.

Ethernet の raw socket を扱うため, Linux/macOS では実行に root 権限 (または CAP_NET_RAW) が必要. Windows では, npcap を「WinPcap API-compatible mode」でインストールする必要がある.

EtherCrabLinkOption {
iface,
sync0_period,
sync0_shift,
sync_tolerance,
sync_timeout,
};
フィールド 説明
iface Interface 使用するネットワークインターフェース. Interface::Auto で自動選択, Interface::Name(..) で名前指定
sync0_period Duration SYNC0 信号の周期
sync0_shift Duration SYNC0 信号のシフト量
sync_tolerance Duration 同期完了とみなす許容誤差
sync_timeout Duration 同期完了を待つタイムアウト

C# の EtherCrabLinkOption は, 上記に加えて次のフィールドも持つ. Rust / Python では下記 EtherCrabLinkOptionFull 側にあるものである.

new EtherCrabLinkOption(
iface,
sync0Period,
sync0Shift,
syncTolerance,
syncTimeout,
pduTimeout,
stateTransitionTimeout,
txRxPriority: 90,
disableTxRxPriority: false,
txRxPolicy: RtSchedulePolicy.Fifo,
txRxAffinity: txRxAffinity
);
フィールド 説明
PduTimeout TimeSpan? PDU の応答待ちタイムアウト
StateTransitionTimeout TimeSpan? EtherCAT の状態遷移待ちタイムアウト
TxRxPriority byte? 送受信 (tx/rx) 専用スレッドの RT 優先度. 未指定なら既定値 (Windows 以外で 90)
DisableTxRxPriority bool true で RT 優先度を設定しない (OS 既定のまま). TxRxPriority とは排他
TxRxPolicy RtSchedulePolicy? TxRxPriority 指定時のスケジューリングポリシー (Normal / Fifo / RoundRobin)
TxRxAffinity ulong? tx/rx スレッドの CPU affinity (未指定なら OS 既定)

EtherCrabの設定をフルに行う EtherCrabLinkOptionFull も用意されている (Rustのみ).

EtherCrabLinkOptionFull {
iface,
timeouts,
main_device_config,
dc_configuration,
sync_tolerance,
sync_timeout,
tx_rx_priority,
tx_rx_policy,
tx_rx_affinity,
};
フィールド 説明
iface Interface 使用するネットワークインターフェース. Interface::Auto で自動選択, Interface::Name(..) で名前指定
timeouts ethercrab::Timeouts EtherCrab のドキュメントを参照
main_device_config ethercrab::MainDeviceConfig EtherCrab のドキュメントを参照
dc_configuration ethercrab::subdevice_group::DcConfiguration EtherCrab のドキュメントを参照
sync_tolerance Duration 同期完了とみなす許容誤差
sync_timeout Duration 同期完了を待つタイムアウト
tx_rx_priority Option<ThreadPriority> 送受信 (tx/rx) 専用スレッドの RT 優先度. 既定は Windows 以外で 90. ClientConfig.rt_priority (既定 80) より高くする必要がある (低いとスループットが落ちる)
tx_rx_policy RtSchedulePolicy tx_rx_priority 指定時のスケジューリングポリシー (Normal / Fifo / RoundRobin)
tx_rx_affinity Option<CoreId> tx/rx スレッドの CPU affinity (未指定なら OS 既定)