Ethercat HAL driver
16 Feb 2021 08:56 - 16 Feb 2021 08:57 #199029
by bkt
Replied by bkt on topic Ethercat HAL driver
@bd1981 .... about your suggested xml file, you sign 607A as s32 type .... but sign it as float with scale = 10000 is the same things or really different? And why is different? .... sorry but I did not understand this thing and I would like to understand better .... some post ago you had doubts about my use of the float value and I wanted to dig deep into this aspect of linuxcnc-ethercat ...
regards
bkt
regards
bkt
Last edit: 16 Feb 2021 08:57 by bkt. Reason: error
Please Log in or Create an account to join the conversation.
16 Feb 2021 09:49 #199031
by db1981
Replied by db1981 on topic Ethercat HAL driver
this was Svens XML, i only added the initcmds config...
If you take a look at this:
this is the ethercat reading for an HAL_TYPE=float value.
So if you setup your PDO as float, lcec read it as S32. (if you set it as "float-unsigned", it will read U32). After this scaling and offset are attached.
If your nodes S32 Value is 5 with :
scale = 1.0 , your halpin(float) will be =5.0 ;
scale = 10000, your halpin is =50000.0 ;
scale = 0.001, your halpin is = 0.005 .
that is it for reading.
At the writing your value is first multiplyed with the scale and then converted to an S32.
If you halpin(float) is 5.123 with :
scale =1.0, Value to to the node = 5;
scale =1000, value to the node = 5123;
scale = 10, value to the node = 51;
scale = 0.1, value to the node = 0 ( float 5.123 * 0.1 = 0.5123 -> cast to INT = 0);
halpin = 51.23, scale 0.1, value to the node = 5.
Maybe i have unsettled you with one of my past post. Sorry but there has been only the code from the master in my head, i had not took a look at the generic_slave and that theres an native scale in it, because i always write complete drivers for slaves i have to controll.
If you take a look at this:
case HAL_FLOAT:
if (hal_data->subType == lcecPdoEntTypeFloatUnsigned) {
fval = lcec_generic_read_u32(pd, hal_data);
} else {
fval = lcec_generic_read_s32(pd, hal_data);
}
fval *= hal_data->floatScale;
fval += hal_data->floatOffset;
*((hal_float_t *) hal_data->pin[0]) = fval;
break;
this is the ethercat reading for an HAL_TYPE=float value.
So if you setup your PDO as float, lcec read it as S32. (if you set it as "float-unsigned", it will read U32). After this scaling and offset are attached.
If your nodes S32 Value is 5 with :
scale = 1.0 , your halpin(float) will be =5.0 ;
scale = 10000, your halpin is =50000.0 ;
scale = 0.001, your halpin is = 0.005 .
that is it for reading.
At the writing your value is first multiplyed with the scale and then converted to an S32.
If you halpin(float) is 5.123 with :
scale =1.0, Value to to the node = 5;
scale =1000, value to the node = 5123;
scale = 10, value to the node = 51;
scale = 0.1, value to the node = 0 ( float 5.123 * 0.1 = 0.5123 -> cast to INT = 0);
halpin = 51.23, scale 0.1, value to the node = 5.
Maybe i have unsettled you with one of my past post. Sorry but there has been only the code from the master in my head, i had not took a look at the generic_slave and that theres an native scale in it, because i always write complete drivers for slaves i have to controll.
The following user(s) said Thank You: bkt
Please Log in or Create an account to join the conversation.
16 Feb 2021 10:28 - 16 Feb 2021 10:33 #199037
by jc2ktr
Yes after one time setup with TwinCAT the drive was able to start in Linuxcnc even after powerloss.
I tested your solution from yesterday with the default settings loaded in the drive and then Changed to EtherCAT protocol without using TwinCAT, the only thing i had to do to get it to work was rearranging the devices in my BusTopology, first the drive then the io devices.
Seems that TwinCAT also configures the adresses of the devices. Which was not done by Indraworks.
But the drive runs, but scaling was also changed, seems to be that this is done by the cia402 Control setting.
I used float first but LinuxCNC started with an error about wrong signaltypes, after change to s32 it was starting without errors.
The scaling is done in my axis.hal file but i first have to resolve the problem that my drive is using angular degrees to set position.
I calculated that my max travel were 7614° which are roundabout 211,5mm from my linear axis.
And the velocity in Linuxcnc is far away from usual.
Replied by jc2ktr on topic Ethercat HAL driver
ah ok,
if you once did start the drive with Twincat, you can start it again direct with linuxcnc after an power cycle?
Yes after one time setup with TwinCAT the drive was able to start in Linuxcnc even after powerloss.
I tested your solution from yesterday with the default settings loaded in the drive and then Changed to EtherCAT protocol without using TwinCAT, the only thing i had to do to get it to work was rearranging the devices in my BusTopology, first the drive then the io devices.
Seems that TwinCAT also configures the adresses of the devices. Which was not done by Indraworks.
But the drive runs, but scaling was also changed, seems to be that this is done by the cia402 Control setting.
@bd1981 .... about your suggested xml file, you sign 607A as s32 type .... but sign it as float with scale = 10000 is the same things or really different? And why is different? .... sorry but I did not understand this thing and I would like to understand better .... some post ago you had doubts about my use of the float value and I wanted to dig deep into this aspect of linuxcnc-ethercat ...
regards
bkt
I used float first but LinuxCNC started with an error about wrong signaltypes, after change to s32 it was starting without errors.
The scaling is done in my axis.hal file but i first have to resolve the problem that my drive is using angular degrees to set position.
I calculated that my max travel were 7614° which are roundabout 211,5mm from my linear axis.
And the velocity in Linuxcnc is far away from usual.
Last edit: 16 Feb 2021 10:33 by jc2ktr. Reason: Edit
Please Log in or Create an account to join the conversation.
16 Feb 2021 10:48 - 16 Feb 2021 10:49 #199040
by db1981
Replied by db1981 on topic Ethercat HAL driver
nice that this works.
Scaling should be no big problem, i think that the grad /mm thing is only an Indraworks Gui (bug) thing. the parameters for linear axis and scaling exist in both sets soe and coe. maybe it is only needed to attach them to the initcmds.
next step: setting up an EoE gateway in lcec, for using indraworks in conjunction with Lcnc.
but i am out of the shop no till late evening.....
Scaling should be no big problem, i think that the grad /mm thing is only an Indraworks Gui (bug) thing. the parameters for linear axis and scaling exist in both sets soe and coe. maybe it is only needed to attach them to the initcmds.
next step: setting up an EoE gateway in lcec, for using indraworks in conjunction with Lcnc.
but i am out of the shop no till late evening.....
Last edit: 16 Feb 2021 10:49 by db1981.
The following user(s) said Thank You: jc2ktr
Please Log in or Create an account to join the conversation.
16 Feb 2021 11:35 #199050
by jc2ktr
This were really helpful, though i have a second PC for Indraworks.
It is only a Test Setup at the moment, my actual CNC runs under Windows with CS-Lab controller. I want to change it over Time to linuxcnc, this is first only to get to know it and learn how it can be done. Because of that i don´t have time pressure.
But i dont know much about the init commands or the Indraworks parameters.
And thats why i really appreciate your help
Replied by jc2ktr on topic Ethercat HAL driver
nice that this works.
Scaling should be no big problem, i think that the grad /mm thing is only an Indraworks Gui (bug) thing. the parameters for linear axis and scaling exist in both sets soe and coe. maybe it is only needed to attach them to the initcmds.
next step: setting up an EoE gateway in lcec, for using indraworks in conjunction with Lcnc.
but i am out of the shop no till late evening.....
This were really helpful, though i have a second PC for Indraworks.
It is only a Test Setup at the moment, my actual CNC runs under Windows with CS-Lab controller. I want to change it over Time to linuxcnc, this is first only to get to know it and learn how it can be done. Because of that i don´t have time pressure.
But i dont know much about the init commands or the Indraworks parameters.
And thats why i really appreciate your help
Please Log in or Create an account to join the conversation.
17 Feb 2021 08:27 #199137
by bkt
Very thanks for these explanations ... I haven't read the drive code carefully. I looked at it I realized it could go I tried and it worked. The problems arose only with the "scaling" to be able to have the correct output positioning values which, as mentioned, I still do not understand what relationship they have with the available revolution pulses and the reduction ratio. I sensed a certain linearity but not the formula which is evident has nothing to do with the calculations that are usually done ..... then I had not considered the cast and now I understand that everything works equally just because in any case the number of pulses per revolution on a 17bit ecoder are exaggerated having a mechanical reduction 1 (motor): 37.5 (output) .... so the decimals in fact are not noticed at all. However if I had a 1: 1 mechanical ratio and a very poor ecoder (512 puls / rev) I would probably have some positioning problems.
Now I have no time at all, but I will try to write the right drive for my drive so that I will understand better.
regards
bkt
Replied by bkt on topic Ethercat HAL driver
If you halpin(float) is 5.123 with :
scale =1.0, Value to to the node = 5;
scale =1000, value to the node = 5123;
scale = 10, value to the node = 51;
scale = 0.1, value to the node = 0 ( float 5.123 * 0.1 = 0.5123 -> cast to INT = 0);
halpin = 51.23, scale 0.1, value to the node = 5.
Very thanks for these explanations ... I haven't read the drive code carefully. I looked at it I realized it could go I tried and it worked. The problems arose only with the "scaling" to be able to have the correct output positioning values which, as mentioned, I still do not understand what relationship they have with the available revolution pulses and the reduction ratio. I sensed a certain linearity but not the formula which is evident has nothing to do with the calculations that are usually done ..... then I had not considered the cast and now I understand that everything works equally just because in any case the number of pulses per revolution on a 17bit ecoder are exaggerated having a mechanical reduction 1 (motor): 37.5 (output) .... so the decimals in fact are not noticed at all. However if I had a 1: 1 mechanical ratio and a very poor ecoder (512 puls / rev) I would probably have some positioning problems.
Now I have no time at all, but I will try to write the right drive for my drive so that I will understand better.
regards
bkt
Please Log in or Create an account to join the conversation.
- sqmathlete
- Offline
- Premium Member
Less
More
- Posts: 118
- Thank you received: 17
17 Feb 2021 22:39 #199191
by sqmathlete
Replied by sqmathlete on topic Ethercat HAL driver
@ Corbett
In regards to EL5101
I've had this working for a few weeks but haven't had the time to update you. It required a short hal component to calculate the rpm in rev/sec and rev/min from the count/frequency and then apply a +/- sign based on the spindle direction. I haven't done a ton of testing yet but it does seem to be working and satisfying linuxcnc's requirements of coordinated motion.
Dan
In regards to EL5101
I want to add spindle feedback on as have been working on 2 other setups...
I've had this working for a few weeks but haven't had the time to update you. It required a short hal component to calculate the rpm in rev/sec and rev/min from the count/frequency and then apply a +/- sign based on the spindle direction. I haven't done a ton of testing yet but it does seem to be working and satisfying linuxcnc's requirements of coordinated motion.
Dan
The following user(s) said Thank You: CORBETT
Please Log in or Create an account to join the conversation.
18 Feb 2021 14:22 #199256
by bkt
Replied by bkt on topic Ethercat HAL driver
@corbet too
I have just connect my el5151 to slaves .... <slave idx="6" type="EL5151"/> .... ok terminal command "ethercat pdos -p6" & "ethercat slaves -p6" show me the correct info .... but when test in Axis gui "shox axis configuration HAL" the slaves nr. 6 is not seen ... all other is ok obviuslly.
Is there something i forgot to do? in the .hal file and in the .ini file I have not written anything, but in any case I should see the slaves ... which however is not there .... my encoders is npn at 24V and yet the leds do not light up in any case.
regards
bkt
I have just connect my el5151 to slaves .... <slave idx="6" type="EL5151"/> .... ok terminal command "ethercat pdos -p6" & "ethercat slaves -p6" show me the correct info .... but when test in Axis gui "shox axis configuration HAL" the slaves nr. 6 is not seen ... all other is ok obviuslly.
Is there something i forgot to do? in the .hal file and in the .ini file I have not written anything, but in any case I should see the slaves ... which however is not there .... my encoders is npn at 24V and yet the leds do not light up in any case.
regards
bkt
Please Log in or Create an account to join the conversation.
18 Feb 2021 15:09 #199264
by db1981
Replied by db1981 on topic Ethercat HAL driver
@bkt
-does the slave 6 goes to op state, after starting linuxcnc? (ethercat slaves)
-"shox axis configuration HAL" is not clear to me... Do you mean "show hal configuration"? Then looking under Pins lcec - 0 - there should be an "6"
-check dmesg after starting linuxcnc, if there are errors with initialization
-does the slave 6 goes to op state, after starting linuxcnc? (ethercat slaves)
-"shox axis configuration HAL" is not clear to me... Do you mean "show hal configuration"? Then looking under Pins lcec - 0 - there should be an "6"
-check dmesg after starting linuxcnc, if there are errors with initialization
Please Log in or Create an account to join the conversation.
18 Feb 2021 15:49 - 18 Feb 2021 16:00 #199275
by jc2ktr
Replied by jc2ktr on topic Ethercat HAL driver
Now i have a little progress update, my drive runs and the scaling is also nearly correct in LinuxCNC the only issue at moment is. A squeeking axis in Linuxcnc. And a not so good control loop under LinuxCNC.
In TwinCAT/Indraworks it moves much better.
Travel distance was ca 100 mm in a endless loop in LCNC & Windows:
TwinCAT Movement
LinuxCNC Movement
LinuxCNC Movement
In TwinCAT/Indraworks it moves much better.
Travel distance was ca 100 mm in a endless loop in LCNC & Windows:
TwinCAT Movement
LinuxCNC Movement
LinuxCNC Movement
Last edit: 18 Feb 2021 16:00 by jc2ktr. Reason: edit
Please Log in or Create an account to join the conversation.
Time to create page: 0.156 seconds