bnjmnp / pysoem

Cython wrapper for the Simple Open EtherCAT Master Library
MIT License
95 stars 36 forks source link

Cannot read device object dictionary #104

Open jakezimmer opened 1 year ago

jakezimmer commented 1 year ago

Hello,

I'm trying to read the object dictionary of a slave.

master = pysoem.Master()

master.open(adapter)

if master.config_init() > 0:
    for slave in master.slaves:
        print(slave.name)
        print(slave.state)
        print(slave.sdo_read(0x1008, 0).decode('utf-8'))
        print(slave.od)
else:
    print('no device found')

master.close()

Unfortunately, while I can connect to the slave and read some basic information, I am unable to get the object dictionary.

EPOS4
1
EPOS4
---------------------------------------------------------------------------
SdoInfoError                              Traceback (most recent call last)
Cell In[14], line 12
     10         print(slave.state)
     11         print(slave.sdo_read(0x1008, 0).decode('utf-8'))
---> 12         print(slave.od)
     13 else:
     14     print('no device found')

File pysoem\pysoem.pyx:1012, in pysoem.pysoem.CdefSlave._get_od()

SdoInfoError: Sdo List Info read failed

Is there anything I'm doing wrong here or other steps needed before reading the object dictionary to get the list of objects?

Additional information:

  • OS: Windows 10
  • Slave Device: Maxon EPOS4 EtherCAT Motor Position Controller
  • Can successfully view the object dictionary through a GUI supplied by Maxon
tdemierr commented 1 year ago

Hello, I am relatively new to ethercat in with pysoem. However, object dictionary does not seem to be accessible in https://pysoem.readthedocs.io/en/latest/cdef_slave.html# .

If you want to get values of sdo, you can try to use the https://github.com/bnjmnp/pysoem/blob/master/examples/read_sdo_info.py and adapt it with sdo_read to get the values you are looking for. Best regards Tim