Drivers implementation for ROS - rtt_soem

More
5 years 2 months ago #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.

Please Log in to join the conversation.

More
5 years 2 months ago #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 to join the conversation.

More
5 years 2 months ago #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?




 

Please Log in to join the conversation.

More
5 years 2 months ago #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)

Attachment not found



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

Please Log in to join the conversation.

More
5 years 2 months ago #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 to join the conversation.

More
5 years 2 months ago #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 to join the conversation.

More
5 years 2 months ago #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.

Please Log in to join the conversation.

More
5 years 2 months ago #218482 by juniorfi
This was my first attempt to compile everything in case do you want to have a look.

 

Attachment not found

Please Log in to join the conversation.

More
5 years 2 months ago #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 to join the conversation.

More
5 years 2 months ago #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 to join the conversation.

Time to create page: 0.100 seconds
Powered by Kunena Forum