Drivers implementation for ROS - rtt_soem

More
20 Aug 2021 13:25 - 20 Aug 2021 13:49 #218238 by Grotius
Hi,

Nice.

Indeed edit the start_hal.sh file to load ethercat stuff.
You have the opurtunity to be the first to test the ethercat
on hal-core.

To point at the xml, you can do that in the start_hal.sh file.
See my attachements how i load a lcec config. You can use this as template.

# Full command to load a .hal file with halcmd:
/opt/hal-core/bin/./halcmd \-f ethercat.hal

or if you are already in dir (path), just :
halcmd \-f ethercat.hal

Then it would be something like this:
#!/usr/bin/bash

cd scripts
. ./rip-environment
cd ..

cd bin

halcmd stop
halcmd \-f ethercat.hal
halcmd start

halcmd show

# To clean the hal environment :
# $ /opt/hal-core$ /opt/linuxcnc/scripts/halrun -U

You can load the ethercat stuff from within a .c file. I do this freqently like :
system("/opt/hal-core/bin/./halcmd \-f ethercat.hal");

A hint could be executing this file :
** github.com/grotius-cnc/Linux-Pro/release...0.0/online-installer
If you open that file, you can edit your needs.
It will install linuxcnc, ethercat etc in /opt/ dir alongside the /opt/hal-core/
In the linuxcnc dir there is a /addons dir where ethercat lives.
Soon i will make something similar for the hal-core app.
Attachments:
Last edit: 20 Aug 2021 13:49 by Grotius.

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

More
23 Aug 2021 08:34 #218472 by juniorfi

Hi,

Nice.

Indeed edit the start_hal.sh file to load ethercat stuff.
You have the opurtunity to be the first to test the ethercat
on hal-core.

To point at the xml, you can do that in the start_hal.sh file.
See my attachements how i load a lcec config. You can use this as template.

# Full command to load a .hal file with halcmd:
/opt/hal-core/bin/./halcmd \-f ethercat.hal

or if you are already in dir (path), just :
halcmd \-f ethercat.hal

Then it would be something like this:
#!/usr/bin/bash

cd scripts
. ./rip-environment
cd ..

cd bin

halcmd stop
halcmd \-f ethercat.hal
halcmd start

halcmd show

# To clean the hal environment :
# $ /opt/hal-core$ /opt/linuxcnc/scripts/halrun -U

You can load the ethercat stuff from within a .c file. I do this freqently like :
system("/opt/hal-core/bin/./halcmd \-f ethercat.hal");

A hint could be executing this file :
** github.com/grotius-cnc/Linux-Pro/release...0.0/online-installer
If you open that file, you can edit your needs.
It will install linuxcnc, ethercat etc in /opt/ dir alongside the /opt/hal-core/
In the linuxcnc dir there is a /addons dir where ethercat lives.
Soon i will make something similar for the hal-core app.
 

Hi Grotius,

Thanks again for the hints.

Right now I was able to build and convert the .o files to .so and place it into rtlib (EtherCAT drivers).
Also I already change the start_hal.sh file with my own configuration.

Right now I got this when launch the start_hal.sh script: pastebin.com/4nQ3Cr2W (At least boots and start working but no the EtherCAT one)

I double checked that files are located in the right places.

This is part of my actual configuration:


halcmd stop
halcmd loadrt threads name1=base-thread fp1=0 period1=25000 name2=servo-thread period2=1000000
halcmd loadusr -W /opt/hal-core/rtlib/lcec_conf /opt/hal-core/ethercat-conf.xml
halcmd loadrt lcec
halcmd addf lcec.read-all servo-thread
halcmd addf lcec.write-all servo-thread
halcmd start
 

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

More
23 Aug 2021 08:59 - 23 Aug 2021 09:00 #218474 by Grotius
Hi,

It could'nt find the lcec.so, wich has to be located in the /rtlib. But i think you forgot to clean you hal environment :
$ /opt/hal-core/scripts/halrun -U

Maybe wait a few hours, I will try to fabricate a hal-core ethercat installer.

Right now I was able to build and convert the .o files to .so and place it into rtlib (EtherCAT drivers).
Can you point me to your procedure?




 
Last edit: 23 Aug 2021 09:00 by Grotius.

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

More
23 Aug 2021 09:29 - 23 Aug 2021 09:34 #218476 by juniorfi
I just have the same idea to build a EtherCAT installer for it :) .

I provide you the changes I did in the script you should put in linuxcnc-ethercat/src/.
1. First have to run make on the linuxcnc-ethercat directory. Once we have the .o files created, you should run the script (Attached here)

File Attachment:

File Name: compile_lcec.sh.txt
File Size:5 KB


I all I did. Because I modified you script to build the .o but got different errors on the way.
I will try to do a issue in the Git so you can get more that I have done or to check changes I have done so far.

Regards
Attachments:
Last edit: 23 Aug 2021 09:34 by juniorfi. Reason: Extension changed to be able to attach the file.

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

More
23 Aug 2021 09:42 #218478 by juniorfi
I recompiled everything from scratch and was able to get LCEC running with some other errors like: pastebin.com/tTxhBndT

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

More
23 Aug 2021 09:57 #218479 by Grotius
Hi,

Interesting. You build everything as stand alone instead of one lcec.so library that includes all the ethercat slaves?

 

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

More
23 Aug 2021 10:05 #218481 by juniorfi
Yes, because doing that way I don't get any error related to lcec.so when it tries to load ax5200 for example.

I will try to replicate that issue. If you know a better way to do this please let me know.
The following user(s) said Thank You: tommylight

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

More
23 Aug 2021 10:12 #218482 by juniorfi
This was my first attempt to compile everything in case do you want to have a look.

 

File Attachment:

File Name: compile_lc...l.sh.txt
File Size:17 KB
Attachments:

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

More
23 Aug 2021 10:55 #218487 by Grotius
Hi,

I had a quick look. I think you missed the -lethercat flag when building the last stage "shared libs".

# Compile to shared library
gcc -shared -o lcec.so lcec_main.o lcec_class_enc.o lcec_generic.o lcec_ax5200.o lcec_el1xxx.o lcec_el1252.o lcec_el1859.o lcec_el2521.o lcec_el2xxx.o lcec_el2202.o lcec_el31x2.o lcec_el31x4.o lcec_el3255.o lcec_el40x1.o lcec_el40x2.o lcec_el40x8.o lcec_el41x2.o lcec_el41x4.o lcec_el5101.o lcec_el5151.o lcec_el5152.o lcec_el6900.o lcec_el1904.o lcec_el2904.o lcec_el7041_1000.o lcec_el7211.o lcec_el7342.o lcec_el95xx.o lcec_em7004.o lcec_stmds5k.o lcec_deasda.o lcec_omrg5.o lcec_ph3lm2rm.o -Wl,-rpath,/opt/hal-core/lib -L/opt/hal-core/lib -lhalcore -lethercat -lrt

 

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

More
23 Aug 2021 11:54 #218497 by Grotius
Hi,

I found the problem. In the /opt/linuxcnc/ install the ethercat compiled in the /hal-core/ dir works.
But starting from /hal-core/ we have a problem with the "loadusr .." command.
I will take a look into the halcmd source code.
 

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

Time to create page: 0.152 seconds
Powered by Kunena Forum