gladevcp and Ethercat IO

More
06 Aug 2021 09:48 #217035 by wang
hi everyone

I made a CNC interface myself and used a lot of linuxcnc interfaces. Now I want to use Ethercat IO module (8-out, 8-in) to do IO control on the interface. like this 

But I have tried for a long time and have not been able to flexibly control IO through Ethercat on the interface.

This is my partial XML and HAL file, I hope everyone can help me solve this problem, thank you

hal
loadusr -W lcec_conf /home/qxh-wyk/linuxcnc-dev/configs/sim/axis/DM3E556.xml
loadrt lcec
loadusr -Wn gladevcp  /usr/bin/gui3_bk /usr/share/linuxcnc/gui3.glade

addf lcec.read-all servo-thread


addf lcec.write-all servo-thread

setp lcec.0.0.drivecontrol-1 1
setp lcec.0.0.drivecontrol-2 1

setp lcec.0.1.drivecontrol-1 1
setp lcec.0.1.drivecontrol-2 1


setp lcec.0.2.drivecontrol-1 1
setp lcec.0.2.drivecontrol-2 1


net Xpos joint.0.motor-pos-cmd => lcec.0.0.poscommand
net Ypos joint.1.motor-pos-cmd => lcec.0.1.poscommand
net Zpos joint.2.motor-pos-cmd => lcec.0.2.poscommand
#net Xachse_fb lcec.0.0.pos => joint.0.motor-pos-fb

net Xachse_AF joint.0.amp-enable-out => lcec.0.0.drivecontrol-0
net Xachse_AF  => lcec.0.0.drivecontrol-3
net Xachse_AF  => lcec.0.0.drivecontrol-5


net Yachse_AF joint.1.amp-enable-out => lcec.0.1.drivecontrol-0
net Yachse_AF  => lcec.0.1.drivecontrol-3
net Yachse_AF  => lcec.0.1.drivecontrol-5


net Zachse_AF joint.2.amp-enable-out => lcec.0.2.drivecontrol-0
net Zachse_AF  => lcec.0.2.drivecontrol-3
net Zachse_AF  => lcec.0.2.drivecontrol-5



net pin0 lcec.0.3.RXPDO-0 gladevcp.pin0
net pin1 lcec.0.3.RXPDO-1 gladevcp.pin1 

#setp lcec.0.3.TXPDO-0 true
#setp lcec.0.3.TXPDO-1 true
net pina gladevcp.pina lcec.0.3.TXPDO-0 
net pinb gladevcp.pinb lcec.0.3.TXPDO-1


xml
<slave idx="3" type="generic" vid="0x00000b95" pid="0x00010205" configPdos="true">


    <syncManager idx="0" dir="out">
    <pdo idx="1600">
        <pdoEntry idx="3001" subIdx="00" bitLen="8" halPin="TXPDO" halType="bit"/>
    </pdo>
    </syncManager>

    <syncManager idx="1" dir="in">
    <pdo idx="1a00">
        <pdoEntry idx="3101" subIdx="00" bitLen="8" halPin="RXPDO" halType="bit"/>
    </pdo>
    </syncManager>

    <dcConf assignActivate="100" sync0Cycle="*1" sync0Shift="250000"/>

    </slave>


At the same time, there is a problem that bothers me a lot. How should I match the elements on the glade interface with the signal, and what is the meaning of the pin01、pin02、pin03........  signal? 


Looking forward to your reply

thanks

                                                                                                                                                                                                                  wang
Attachments:

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

More
07 Aug 2021 07:08 #217101 by db1981
Replied by db1981 on topic gladevcp and Ethercat IO
hi,

for me it is not clear whats is your question.
-does your ethercat not work?
-you don't know how to link the gladepanel to the ec-slave?
-linking works (no hal error), but there is no function at testing? ...

About "pin01 ..." :
this is the name for the hal net connection, it could also be xx,yy,sk,red,blue ...
at this example the connection (net) bettween
PortTest.btn01 and parport.0.pin-01-out and Porttest.led-01 is named "pin01" .

every net (connection) in hal needs an unique identifier (name). read the hal section of the manual.

so if you don't know how to link, try for example

net mynet PortTest.btn01 lcec.0.3.xxxx
The following user(s) said Thank You: wang

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

More
09 Aug 2021 01:33 #217276 by wang
Replied by wang on topic gladevcp and Ethercat IO
thank you for your reply

I still have a question, because I did not use the Axis interface, I used the interface designed by myself through glade. The way I loaded this interface was to change the DISPLAY=gui3 in the ini file (the interface Py file I designed) .

So how should I access the controls on my interface in the hal file?
Is this sentence correct?
loadusr -Wn gladevcp /usr/bin/gui3_bk /usr/share/linuxcnc/gui3.glade

But when I use this sentence, the entire linuxcnc system will run very slowly and the communication via serial port/Ethercat will freeze. Why?

Thank you, my best wishes

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

More
09 Aug 2021 07:15 #217298 by db1981
Replied by db1981 on topic gladevcp and Ethercat IO
Hello,

there should be no influence from the glade gui to the servo thread.
seems that you have something done wrong in the glade or py file, may be an hunging loop or something else.

acces in hal: youre gui exports pins, that are named gui3.xxxx ,
if you open halshow while running linuxcnc, you can browse which pins are exported and how are they named.
The following user(s) said Thank You: wang

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

More
09 Aug 2021 11:34 #217310 by wang
Replied by wang on topic gladevcp and Ethercat IO
thank you for your reply

Is this sentence correct?
loadusr -Wn gladevcp /usr/bin/gui3_bk /usr/share/linuxcnc/gui3.glade

Should I load my glade file like this? Or what should I do besides modifying Display in the ini file?

Thank you, my best wishes

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

More
09 Aug 2021 12:14 - 09 Aug 2021 12:15 #217312 by db1981
Replied by db1981 on topic gladevcp and Ethercat IO
i am not a expert about guis.

but if you use completly your own gui, i dont think that this line is neccessary.
if the python and the glade file have the same filenames, then you only have to tell
display = gui3_bk in the ini.

have a look at this : www.gnipsel.com/linuxcnc/gui/gui03b.html
Last edit: 09 Aug 2021 12:15 by db1981.
The following user(s) said Thank You: Grotius

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

More
09 Aug 2021 19:14 - 09 Aug 2021 19:17 #217327 by Grotius
Replied by Grotius on topic gladevcp and Ethercat IO
Hi,

If you are new to python, you could consider starting with c++. Personally i don't like python. I don't see the programming logic, even after a long time.

Glade is currently outdated. Qt is a nice replacement.
A 8io interface with gui in c++ would take a few minutes, if you make it as userland app.

My last projects are kernel modules (c coded files) that are using c++ code for interfacing with gui and complex tasks.
This result's in a powerful combination inside a real-time environment.
You see the example of db1981 is python with a 100ms update timing.
For normal ethercat io this will not be a problem.
For time critical application's like motion, pulses or encoders 100ms is quite useless.

Therefore investing some time in c++ in combination with c coded kernel style will bring you almost unlimited
linuxcnc power.

If you are interested in such a solution. Maybe i can make a tiny example app for your 8io app.
Would you preferr a c++ userland app (not realtime) or a c-c++ kernel style app (realtime) ?
P.s. you need to install qt as well. If you are interested in using qt, i can point you to a qt-installer.
 
Last edit: 09 Aug 2021 19:17 by Grotius.
The following user(s) said Thank You: wang

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

More
10 Aug 2021 01:37 #217353 by wang
Replied by wang on topic gladevcp and Ethercat IO
Gǎnxiè nín de huífù yóuyú wǒmen yī kāishǐ jiēchù linuxcnc de shíhòu jiù kàn dàole glade fēicháng xiángxì de jiàochéng, suǒyǐ wǒmen xuǎnzé glade zuòwéi GUI de dì yī kāifā gōngjù. Rúguǒ nín yuànyì gěi wǒmen tígōng jīyú QT de jiàochéng dehuà nà shì jí hǎo de. Yīnwèi wǒmen zài linuxcnc guānfāng méiyǒu kàn dào fēicháng wánchéng zhěng de QT yǔ linuxcnc jiéhé de jiàochéng. Rúguǒ yǒu de huà wǒ fēicháng yuànyì shǐyòng QT, yīnwèi wǒ zài Windows shàng yīzhí shǐyòng QT kāifā GUI. Xīwàng nín néng tígōng yīgè wánzhěng xuéxí QT yǔ linuxcnc jiéhé de zīliào, shífēn gǎnxiè. Wǒ zuì hǎo de zhùyuàn.
展开
220 / 5000
翻译结果
thank you for your reply

Since we saw glade's very detailed tutorial when we first came into contact with linuxcnc, we chose glade as the first GUI development tool. If you are willing to provide us with QT-based tutorials, that would be great. Because we did not see a very complete tutorial on the combination of QT and linuxcnc in the linuxcnc official. If there is, I am very willing to use QT, because I have been using QT to develop GUI on Windows.

I hope you can provide a complete study of the combination of QT and linuxcnc, thank you very much.

My best wishes.

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

Time to create page: 0.187 seconds
Powered by Kunena Forum