- Posts: 790
- Thank you received: 0
Ethercat HAL driver
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.
Please Log in to join the conversation.
db1981 wrote: 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.
bkt wrote: @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.
Please Log in to join the conversation.
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.....
Please Log in to join the conversation.
db1981 wrote: 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 to join the conversation.
db1981 wrote:
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 to join the conversation.
- sqmathlete
- Offline
- Premium Member
-
- Posts: 118
- Thank you received: 0
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
Please Log in to join the conversation.
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 to join the conversation.
-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 to join the conversation.
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
Please Log in to join the conversation.
Is there any difference if you control the drive with the indradrive setup functions to the drives behaviour with twincat? (may the twincat control loop makes the movement smooth)
I think that after switching the communcation to coe in indraworks another set of parameters gets active, so this parameters have to get tuned again.
can you please post the terminal output of "ethercat eoe" before and after linuxcnc start.
Please Log in to join the conversation.
