linuxcnc-ethercat / linuxcnc-ethercat

LinuxCNC EtherCAT HAL driver
GNU General Public License v2.0
33 stars 13 forks source link

Add support for Omron 1S servo drives #440

Closed Bouni closed 6 days ago

Bouni commented 1 week ago

I try to add OMRON's 1S Series of servo drives. I tried to check whats different to the OMRON G5 series and the differences seem to be minimal.

So I tried to change everything named omrg5 for omr1s (case sensitive) in a copy of lcec_omrg5.c named lcec_omr1s.c.

When I run make all I get thsi output:

make[1]: Entering directory '/home/user/linuxcnc-ethercat/src'
Makefile:80: warning: overriding recipe for target 'install'
/usr/share/linuxcnc/Makefile.modinc:107: warning: ignoring old recipe for target 'install'
Makefile:80: warning: overriding recipe for target 'install'
/usr/share/linuxcnc/Makefile.modinc:107: warning: ignoring old recipe for target 'install'
Compiling realtime devices/lcec_omr1s.c
Creating library liblcecdevices.a
Linking lcec.so
ld -d -r -o lcec.so.tmp lcec_main.o lcec_devicelist.o lcec_ethercat.o lcec_pins.o lcec_lookup.o lcec_modparam.o lcec_malloc.o
objcopy -j .rtapi_export -O binary lcec.so.tmp lcec.so.sym
(echo '{ global : '; tr -s '\0' < lcec.so.sym | xargs -r0 printf '%s;\n' | grep .; echo 'local : * ; };') > lcec.so.ver
gcc -shared -Bsymbolic -Wl,-rpath,/lib -Wl,--version-script,lcec.so.ver -o lcec.so lcec_main.o lcec_devicelist.o lcec_ethercat.o lcec_pins.o lcec_lookup.o lcec_modparam.o lcec_malloc.o -lm -Wl,--whole-archive liblcecdevices.a -Wl,--no-whole-archive -L/lib -llinuxcnchal -lethercat -lrt
chmod -x lcec.so
gcc -o lcec_conf lcec_conf.o lcec_conf_icmds.o lcec_conf_util.o lcec_devicelist.o lcec_ethercat.o lcec_pins.o lcec_lookup.o lcec_modparam.o lcec_malloc.o -Wl,-rpath,/lib -L/lib -llinuxcnchal -lexpat -Wl,--whole-archive liblcecdevices.a -Wl,--no-whole-archive -lethercat -lm
gcc -o lcec_devices lcec_devices.o lcec_devicelist.o lcec_ethercat.o lcec_pins.o lcec_lookup.o lcec_modparam.o lcec_malloc.o -Wl,-rpath,/lib -L/lib -llinuxcnchal -lexpat -Wl,--whole-archive liblcecdevices.a -Wl,--no-whole-archive -lethercat -lm
(cd configgen ; go generate)
(cd configgen ; go build lcec_configgen.go)
cp configgen/lcec_configgen .
make[1]: Leaving directory '/home/user/linuxcnc-ethercat/src'
(cd scripts; ./update-devicelist.sh)
../../../go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/apic.go:1:1: expected 'package', found 'EOF'
make: *** [Makefile:28: documentation/DEVICES.md] Error 1

Any ideas whats the problem with the go package?

Bouni commented 1 week ago

Ok, if I don't do a make all and only a make I can build it and install it via make install.

If I then try to start linuxcnc it fails:

LINUXCNC - 2.9.3
Machine configuration directory is '/home/user/linuxcnc/configs/sim.axis'
Machine configuration file is 'axis.ini'
Starting LinuxCNC...
libnml/buffer/shmem.cc 320: Shared memory buffers toolCmd and toolCmd may conflict. (key=1004(0x3EC))
libnml/buffer/shmem.cc 320: Shared memory buffers toolSts and toolSts may conflict. (key=1005(0x3ED))
libnml/buffer/shmem.cc 320: Shared memory buffers emcError and emcError may conflict. (key=1003(0x3EB))
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Note: Using POSIX realtime
Found file(REL): ./ethercat.hal
lcec_conf: ERROR: Cannot find slave type R88D-1SN01H-ECT, verify type in XML file
lcec_conf: ERROR: Parse error at line 4: parsing aborted
./ethercat.hal:4: waitpid failed lcec_conf lcec_conf
./ethercat.hal:4: lcec_conf exited without becoming ready
Shutting down and cleaning up LinuxCNC...
Note: Using POSIX realtime
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/user/linuxcnc_debug.txt
and
    /home/user/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

My ethercat-conf.xml looks like this:

<masters>
  <master idx="0" appTimePeriod="1000000" refClockSyncCycles="1">
    <slave idx="1" type="EK1110" />
    <slave idx="2" type="R88D-1SN01H-ECT">
      <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
        <watchdog divider="2498" intervals="1000"/>
      </slave>
  </master>
</masters>

I tried to figure out where the types come from but had no success so far. @scottlaird can you explain this a little?

Bouni commented 1 week ago

I figured out that the example for Omron G5 servos is no longer valid:

It suggests using R88D-KN04H-ECT as type, but actually I have to use OmrG5_KN04H which makes sense as its the type used in the lcec_typelist_t:

https://github.com/linuxcnc-ethercat/linuxcnc-ethercat/blob/af7af3396be0b6765d871287393ea1a4d0913e85/src/devices/lcec_omrg5.c#L36C7-L36C18

If I use Omr1S_1SN04H linuxcnc starts with an error which is what I expected.

It seems this was changed a long time ago, I wasn't able to find out when R88D-KN04H-ECT was the right value to use ...

In my opinion that shoud be the value to use, its intuitive, OmrG5_KN04H is absolutely not ...