Ethercat HAL driver

More
22 Nov 2017 17:20 #102202 by chimeno
Replied by chimeno on topic Ethercat HAL driver
Hello, I also had problems with the synchronization, and I still have some, I went to the RT-PREEMPT core that works much better than in RTAPI ..
a question refClockSyncCycles that means? What value is the most appropriate?

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

More
22 Nov 2017 18:01 #102208 by sirop
Replied by sirop on topic Ethercat HAL driver

a question refClockSyncCycles that means? What value is the most appropriate?


See github.com/sittner/linuxcnc-ethercat/blo...src/lcec_main.c#L475 and then github.com/sittner/linuxcnc-ethercat/blo...c_main.c#L1119-L1132 which altogether means that master->sync_ref_cycles = master_conf->refClockSyncCycles determines how often the ref clock is re-synced to the master.

I'd say that refClockSyncCycles is a value you have then to figure out estimating any latencies involved.
The following user(s) said Thank You: chimeno

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

More
23 Nov 2017 01:14 #102235 by sqmathlete
Replied by sqmathlete on topic Ethercat HAL driver
Hi Frank,

If you want to interchange between 0x08 CSP mode to 0x06 Home mode, you have to code a state machine component which changes the op-state to pre-op state and then changes MODE OF OPERATION INDEX 0X6060 to whatever by SDO communication similar to github.com/sirop/MK_sdo_download/blob/master/sdo_download.comp .


This may be, however such wizardry is way over my head. That being said, I went back to the beginning and found a couple of errors in my xml code. After fixing those I followed Roschi's approach of using ladder logic to switch modes and initiate the homing routine.
All good so far, homing routine is now working. The next step is to modify the homing.c file except that the link which shows the modification to the homing.c file is gone.
docs.google.com/document/d/1GiB065ZIAaoM...xGQl2X9DM9-THNM/edit
Any suggestions?

Thanks
Dan

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

More
23 Nov 2017 04:39 - 23 Nov 2017 04:41 #102245 by sirop
Replied by sirop on topic Ethercat HAL driver
I am not Frank, but try github.com/aschiffler/linuxcnc/blob/add-.../emc/motion/homing.c .

I am curious what is

Roschi's approach of using ladder logic to switch modes and initiate the homing routine

?

Can you give a link?
Last edit: 23 Nov 2017 04:41 by sirop.

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

More
24 Nov 2017 07:12 #102284 by chimeno
Replied by chimeno on topic Ethercat HAL driver
hello, sirop
Thank you very much, I will continue working if I get it to work.

regards

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

More
24 Nov 2017 16:43 #102293 by sqmathlete
Replied by sqmathlete on topic Ethercat HAL driver
Hi Sirop,

My apologies for calling you Frank. Not sure how I got that idea...

In my opinion, Roschi would be the best person to explain how he managed to use custom M-codes and the file custom.clp
github.com/aschiffler/linuxcnc/tree/add-...t/configs/roschi_cnc to utilize the internal homing routine of the servo amp ... without LinuxCNC issuing a joint following error. It may be that he used absolute encoders? and I missed that too.
github.com/aschiffler/linuxcnc/commit/d2...c13f1761b5396aed364f

The homing.c file that you pointed to (which was the one that I was looking for, thanks) uses a home sequence of -1, which since the merge of JA and master now as you know means a synchronized final movement of two or potentially more joints. As a caveat, Delta amps require the host controller to be able to preform this type of routine before you can switch them to gantry mode where they will synchronize.

When, I say i used Roschi's approach what I meant was, that his example used an amp that used the Cia402 standard and I was able to work out the equivalent pins/parameters for my amplifier which using the new "complex" variable instead of the "special 32".
Our ladder logic programs are not similar but, I believe that end result is the same. I will post the clp file later today.

Conceptually the routine is
1) check mode (home = 6) (csp =8)
2) if you need to switch modes, inhibit, the enable pin (pin3 0x6040), wait for break to turn on
3) set the coils that are connected to 0x6060 pins 1,2,3 to set the mode
4) look for feed back from 0x6061 that the mode = 6
5) turn off the inhibit, amp is enabled
6) start home routine ... this is where I get a joint following error from LCNC
7) when the home routine is finished, reverse the proccess so that you end up in csp mode

My thoughts are that the addition of a new variable for home sequence might be required, i.e. to call a special case where you can deactivate the joint calculations/feedback?, tell lcnc that you are homing, allow the servo to do it's thing, lcnc can only estop at this point. Completion of homing subroutine sets the axis as homed and linuxcnc is now ready for auto mode.

This is theoretical only and perhaps trying to utilize the internal routines may be more effort than it is worth?
Any thoughts?

Dan

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

More
24 Nov 2017 16:55 - 24 Nov 2017 16:55 #102294 by sirop
Replied by sirop on topic Ethercat HAL driver
@sqmathlete

My applications never needed the CNC part of LinuxCNC and that's why I used my own homing components.

So I can not share any experience concerning Roschi's method.
Last edit: 24 Nov 2017 16:55 by sirop.

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

More
24 Nov 2017 17:45 #102301 by roschi
Replied by roschi on topic Ethercat HAL driver
Hi Dan,

some conceptional remarks for the work I have done.
- LinuxCNC do only send commanded values for the position (output of path planing) - No control loop in LinuxCNC is used, all Control is done by the servos. So also the observing of overtravel, folling error;
- Therefore the following error is ignored within the LCNC --> in the ini file set it to 99999999
- I have modified the "homing.c" with two short cuts in the state machine
- - first is for the case that the LinuxCNC starts the homeing sequence and all the rest is done by the servo. The servo sends a signal that he has finished. The signal is connected to the "classical homing switch" and so the LCNC is fine. (this case can be configured by using a special value for speed in the inifile -->9.9
-- second is the same except that there is no axis movement because there are absolut encoders (battery supply); set speed in ini file to 6.6 (search the code homing.c for 6.6 and 9.9 in my repository to get clear)

Hope that givessome hints.

Best Regards
Andreas
The following user(s) said Thank You: sqmathlete, Nico2017

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

More
05 Dec 2017 21:36 #102707 by Piotr
Replied by Piotr on topic Ethercat HAL driver
Hello.
Sorry my english is not perfect.
I have problem with start examples swm-fm45.
I have servo Stober MDS5040/L
I changed ethercat-conf.xml
<masters>
   <master idx="0" appTimePeriod="1000000" refClockCycles="1000">
       <slave idx="1" type="StMDSk" name="SAT-EC-XML-EtherCAT_FastRefValue">
            <dcConf assignActive="300" sync0Cycle="*1" sync0Shift="-2500"/>
        </slave>
    </master>
</masters>
When I run the program it gets an error
Print file information:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.5
LINUXCNC - 2.7.0
Machine configuration directory is '/home/cezary2528/linuxcnc/configs/swm-fm45a'
Machine configuration file is 'swm-fm45a.ini'
INIFILE=/home/cezary2528/linuxcnc/configs/swm-fm45a/swm-fm45a.ini
PARAMETER_FILE=linuxcnc.var
TASK=milltask
HALUI=
DISPLAY=axis
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Found file(REL): ./swm-fm45a.hal
Shutting down and cleaning up LinuxCNC...
Killing task linuxcncsvr, PID=5688
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments

Debug file information:
.
Error: could not insert module /usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc/lcec.ko: Invalid parameters
./swm-fm45a.hal:22: exit value: 1
./swm-fm45a.hal:22: insmod for lcec failed, returned -1
See the output of 'dmesg' for more information.
5688
  PID TTY      STAT   TIME COMMAND
Stopping realtime threads
Unloading hal components

What am I doing wrong?
In the attachment there is the whole log
Thanks in advance
Attachments:

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

More
05 Dec 2017 23:13 - 05 Dec 2017 23:25 #102709 by sirop
Replied by sirop on topic Ethercat HAL driver
First of all check the correct type spelling:
github.com/sittner/linuxcnc-ethercat/blo...src/lcec_conf.c#L147

Then if

[ 987.272595] LCEC: slave 0.SAT-EC-XML-EtherCAT_FastRefValue: Failed to execute SDO request (0x2212:0x00)

from your kernel log is no false positive, try to investigate this.
Last edit: 05 Dec 2017 23:25 by sirop.

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

Time to create page: 1.156 seconds
Powered by Kunena Forum