Code Monkey home page Code Monkey logo

Comments (9)

bnjmnp avatar bnjmnp commented on August 16, 2024

I can't really tell. For now I can't even think on how to do this nateivly with the SOEM API itself. Maybe you could find something about this in the SOEM issue list.

from pysoem.

tanakarei256 avatar tanakarei256 commented on August 16, 2024

Thank you for your reply.

To solve the problem fundamentally, I would like to add a process in my program that performs a PDO update cycle.

I referred to this issue: OpenEtherCATsociety/SOEM/issues/405.
According to this discussion, SOEM is designed to be thread-safe except for PDO.
Therefore, I think this issue can be resolved by adding a process for the PDO update cycle.
Locking other functions will prevent the PDO update cycle from being interrupted.
However, I find it difficult to implement the PDO update cycle process myself.
This is because pysoem.Master is not picklable and cannot be shared by functions in python's multiprocessing module.
Therefore, I think the process of PDO update cycle should be implemented inside pysoem.

If that is not possible, simply making the timeout arguments for sdo_read and sdo_write adjustable may alleviate this problem.
It is currently given an immutable value, EC_TIMEOUTRXM = 700,000 us = 700 ms, which is too long to run at the same time as the PDO update cycle.

from pysoem.

bnjmnp avatar bnjmnp commented on August 16, 2024

Putting PDO update cycle in a process inside pysoem, sounds good to me. But to figure out how to implement this, I need to take a closer look at things. You still need a way to update the PDO data, synchronized with the PDO process.
Making the SDO timeouts adjustable is much more a short term issue, and is already on my todo list. Here I think of a Master.sdo_timeout property that is applied to the SOEM SDO read and write. But maybe this only possible on a per device basis.

from pysoem.

zopcuk avatar zopcuk commented on August 16, 2024

Hi @tanakarei256 ,
I have same problem right now.
I read your comments and this issue OpenEtherCATsociety/SOEM/issues/405
And mostly understand problem but ı dont know how to do it really. Can i solve problem with pysoem ? And can you explain me little bit more ?
Thank you.

from pysoem.

tanakarei256 avatar tanakarei256 commented on August 16, 2024

I'm not familiar with SOEM or EtherCAT, so I don't know how to implement it.
For my purposes, I think it's enough to have a function that waits for the next PDO update for synchronization.
However, more features may be needed for other uses.

from pysoem.

bnjmnp avatar bnjmnp commented on August 16, 2024

Hi @tanakarei256,
at least the SDO timeouts are now configurable. Check out pysoem.Master.sdo_read_timeout and pysoem.Master.sdo_write_timeout. This will be availabel in the latest version of pysoem (1.0.2) installed via pip from PyPI.

from pysoem.

tanakarei256 avatar tanakarei256 commented on August 16, 2024

Thanks for the improvement.
I think that shortening the timeout for SDO communication has reduced the problem.

from pysoem.

jinkumak avatar jinkumak commented on August 16, 2024

Can I control motor drive ?
Can I move motor ?
please give me a sample code

from pysoem.

bnjmnp avatar bnjmnp commented on August 16, 2024

Hi @jinkumak,
with pysoem you should be able to control any EtherCAT actor device, or retrive data from any EtherCAT sensor device.
You could have a look at issue #30 as a starting point, there is an example for a CiA 402 device profile based motor drive.
Please open a new issue for any further discussion.

from pysoem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.