New LinuxCNC-Ethercat git tree

More
02 Jan 2024 03:02 #289526 by scottlaird
As probably everyone has noticed, it's difficult to get things merged into github.com/sittner/linuxcnc-ethercat, as the maintainer doesn't really have much time to devote to it any more.  With his blessing (see github.com/sittner/linuxcnc-ethercat/pul...uecomment-1368261269), I've forked it into a new repository github.com/linuxcnc-ethercat/linuxcnc-ethercat and I've been trying to fix issues and merge pull requests.  I think it's finally at a state where it'd be good to have people poke at it.

A few changes compared to the current sittner tree:
  • There's an auto-generated list of supported devices: github.com/linuxcnc-ethercat/linuxcnc-et...mentation/DEVICES.md
  • Device driver code has been moved from src/ into src/devices, and there is no longer a need to edit lcec_main.c, lcec_conf.h, lcec_conf.c, or Kbuild.  Just drop properly-configured code into src/devices and it'll build automatically.  This should make new module distribution via this forum less work.
  • Drivers for several additional devices have been added.  In addition to all of the pending PRs from the old repo, I've added (currently mostly untested) support for ~all of the EL3[01]xx analog input devices.
  • There's a Github release and testing process, so at least we can't commit code that doesn't build.  I'm working on getting Debian packages build automatically, but that's kind of a pain right now.
I've also assembled a test system with a bunch of random Beckhoff modules and I have a shell script that verifies that everything probes correctly and does some basic operations against the stack.  I'm slowly adding additional tests here as missing modules arrive in the mail.  I'd like to run this automatically this against every new change, but there are security issues with doing it the easy way in Github, so it may take a while.

At this point, I'd love people to do a few things:
  • Test out the new tree, especially the new EL3xxx code, and let me know what works and what doesn't.
  • Submit bug reports against the new tree.
  • Send new drivers, bug fixes, and documentation updates.
  • Send updates to the device list , especially updating notes and testing status.  If you're using devices and they work, then let's update the doc to say so.
I'd also love to add a couple extra maintainers for the repository.  I don't want to get into a state where I move on to something new and the PR backlog piles up like it did before.  
The following user(s) said Thank You: arvidb, tommylight, bob8020, 0x2102, besriworld, GuiHue, foxington

Please Log in or Create an account to join the conversation.

More
02 Jan 2024 03:57 #289528 by tommylight
Thank you.

Please Log in or Create an account to join the conversation.

More
02 Jan 2024 06:46 #289533 by rodw
Replied by rodw on topic New LinuxCNC-Ethercat git tree
There is no need to maintain this repository because Sasha Itner has made an agreement with iGH the etherlabmaster people to host it on their repository. This repository is installed with the linuxcnc 2.9.x live installers.

If you download and install the Linuxcnc 2.9.2 iso from the downloads page linuxcnc.org/downloads/ all you need to do is to 
sudo apt update
sudo apt install ethercat-master libethercat-dev  linuxcnc-ethercat

Then follow the normal ethercat steps documented in this sticky here
www.forum.linuxcnc.org/ethercat/45336-et...-how-to-step-by-step

There is a very brief description (readme.md) deployed to your home folder by the linuxcnc ISO installer
The following user(s) said Thank You: besriworld

Please Log in or Create an account to join the conversation.

More
02 Jan 2024 06:53 #289534 by Hakan
Great, that was needed.

Can we have a look at the halType=float for the generic driver? It's less than ideal today.
As it is today, lcec does a type conversion between ethercat datatype dint (int32) and hal's float (64-bit), so conversion between integer to float on bit level.
When I actually send a float through ethercat (real), it comes out wrong from lcec. This has been adressed by the halType=float-ieee, and another one halType=float-unsigned (I think it was).
I'm making  my own ethercat device and want to send a double (64-bit float) because it has better range, 14-15 digits, and float in hal is 64-bits (since LCNC 2.5 or so). Just normal C/C++ "double" datatype, ethercat datatype lreal.
And that can not be done today, it isn't possible to get 64-bit variables through lcec.

I see two ways.
The quick solution is to add a halType=float-double along the lines of float-ieee.
A more general way, which might raise other questions, is to acknowledge the data conversion aspect of the lcec generic driver and add something like ethercatType=lreal in the config line. Then lcec will read the ethercat data as a lreal (64-bit float) and convert it into the requested halType. It's my understanding that there is no info on datatypes in the ethercat data stream, only the data sizes, otherwise one should have used that to identify what comes in via ethercat, and how it should be sent out.



 

Please Log in or Create an account to join the conversation.

More
02 Jan 2024 07:00 #289537 by rodw
Replied by rodw on topic New LinuxCNC-Ethercat git tree
This was the email I received from Bjarn van Horn from IGh on 10 November 2023:

I'm happy to announce that Sascha Ittner's linuxcnc-ethercat package is now
available in our Debian 12 repository at  build.opensuse.org/project/
show/science:EtherLab . Yesterday we hat a very interesting call with Sascha,
he was fine that we distribute his package.
Now, linuxcnc users only have to add our debian repository to their machines,
like you explained in the forum post, and install linuxcnc-ethercat which
automatically installs the ethercat master too.

On a closer read, it looks like all you need to do is
sudo apt update
sudo apt install linuxcnc-ethercat

I'm just not sure where you would send PRs for new drivers. Perhaps here somewhere?
build.opensuse.org/package/show/science:...ab/linuxcnc-ethercat
The following user(s) said Thank You: besriworld

Please Log in or Create an account to join the conversation.

More
02 Jan 2024 22:46 #289615 by scottlaird

Please Log in or Create an account to join the conversation.

More
02 Jan 2024 22:51 #289616 by scottlaird
that... is not the same thing. They're pulling the source code (presumably from github.com/sittner/linuxcnc-ethercat) and building it, which is *great* and makes people's life easier, but it doesn't help with the fact that only a handful of changes have been made to that tree in the past 18 months, and he hasn't had a lot of time to put into it for years.

I'm trying to fix that end of things.

Please Log in or Create an account to join the conversation.

More
02 Jan 2024 23:01 #289617 by scottlaird
Ah, I didn't read enough. Until the PR listed (which was copied from elsewhere), we wouldn't even try to send floats at all with generic devices. Now we send whatever EC_WRITE_REAL is, presumably a 32-bit IEEE float. It looks like we could pretty easily add EC_WRITE_LREAL, but yeah, hal_type_t doesn't have distinct options for 32 vs 64 bit floats, so we'd need some other way to specify that in the XML file. Shouldn't be rocket science, but I don't have anything to test it against.

Please Log in or Create an account to join the conversation.

More
02 Jan 2024 23:42 #289621 by Hakan
I have made a modification for myself which seems to work for doubles. So when the dust has settled around where to keep the development I can come back on that topic.
I appreciate that you organize this. There is a need for drivers for many devices. One can try with the lcec_generic driver but one can only do so much and can end up with things in hal that shouldn't be there.

Please Log in or Create an account to join the conversation.

More
03 Jan 2024 00:38 #289625 by scottlaird
This doesn't actually look all that tricky; the "halType" values in our XML file are ours, and code in lcec_conf.c maps those onto LinuxCNC's HAL types.

Here's a draft PR that *should* implement this, although I don't really have hardware to test it against right now.

github.com/linuxcnc-ethercat/linuxcnc-ethercat/pull/116

It won't patch cleanly into anyone else's tree because (a) lcec_generic.c has changed directories in my tree and (b) this includes the other float fix, but other than that it should be straightforward enough to patch.

Please Log in or Create an account to join the conversation.

Time to create page: 0.100 seconds
Powered by Kunena Forum