3

Has anyone ever tried connecting to an EtherCAT device via SOEM in WSL linux?

While TwinCAT successfully connects to my Maxon EPOS4 and moves a DC motor on my laptop under Windows 10 using RT-Ethernet Intermediate Driver, SOEM slaveinfo returns no slaves found on eth0 under WSL.

Ps. I use an ethernet to usb-c LAN adaptor with my laptop, automatic IP address, Ubuntu 18.04 on WSL 2 with Hyper-V installed, and tested turning off my windows firewall too. I have not used SOEM under windows yet due to compile issues. Initially, I had no socket found on eth0 issue, but it solved after installing hyper-V and upgrading my WSL current installation of Ubuntu-18.04 to WSL 2.

I have the same issue under WSL Ubuntu 20, when the firewall is deactivated, if I disable all TwinCAT services and uninstall the TwinCAT items from the Ethernet Properties window!

Here is what I do and the outputs:

$ sudo setcap cap_net_raw+ep /opt/ros/melodic/bin/slaveinfo

$ sudo /opt/ros/melodic/bin/slaveinfo

SOEM (Simple Open EtherCAT Master)
Slaveinfo
Usage: slaveinfo ifname [options]
ifname = eth0 for example
Options :
 -sdo : print SDO info
 -map : print mapping
Available adapters
Description : lo, Device to use for wpcap: lo
Description : bond0, Device to use for wpcap: bond0
Description : dummy0, Device to use for wpcap: dummy0
Description : eth0, Device to use for wpcap: eth0
Description : sit0, Device to use for wpcap: sit0
End program

$ sudo /opt/ros/melodic/bin/slaveinfo eth0

SOEM (Simple Open EtherCAT Master)
Slaveinfo
Starting slaveinfo
ec_init on eth0 succeeded.
No slaves found!
End slaveinfo, close socket
End program
Hadi
  • 31
  • 3

2 Answers2

0

Can you elaborate on your Ethernet controllers? Do you have the one USB-C adapter setup with TwinCAT and the RT-Ethernet driver? If so, I would expect that SOEM running in Ubuntu under WSL does not have access to this controller.

I would test on a system without TwinCAT installed, or rollback the TwinCAT RT-Ethernet driver installation so that the Ethernet controller is available to Windows and presumably WSL. Or can you have an additional adapter that isn't available to TwinCAT?

Jon
  • 39
  • 2
  • Thanks for the answer. I have the same issue if I disable all TwinCAT services and uninstall the TwinCAT items from the Ethernet Properties window: there were two items! Unfortunately, I do not have access to another PC. Further information is provided above! – Hadi Jan 19 '21 at 14:07
0

For me on windows eth0 would not work for epos4. I had to write getmac in a console and copy the line

\Device\Tcpip_{------- copy this part ------}.

Then in my code i would write

init_comm("\\Device\\NPF_{--- your copied part ---}");
Barton Chittenden
  • 4,238
  • 2
  • 27
  • 46
Vinz
  • 1