Bring Values and Sucesses To Our Customers

Home / Support and services / Technical Support

Technical support

Technical Support

EtherCAT Edge Programmable Industrial Motion Controller (6): Python + QT Continuous Trajectory Motion Control

Welcome Zmotion technical support -- EtherCAT Motion Control Edge Controller ZMC432H.

Before, we had learnt some:

EtherCAT motion control edge controller ZMC432H (1): ZMC432H Hardware Information

EtherCAT motion control edge controller ZMC432H (2): ZMC432H API Function Encapsulation

EtherCAT motion control edge controller ZMC432H (3): ZMC432H RTSys (ZDevelop) Development & Diagnosis

EtherCAT motion control edge controller ZMC432H (4): ZMC432H C++ Single-Axis Motion Control Development

EtherCAT motion control edge controller ZMC432H (5): ZMC432H Python + Qt Development of IO Configuration & Homing

Then, today, let's see the sixth part, Python + Qt development of continuous trajectory processing, including how to download RTBasic file.

There are still several parts to describe it for you, and the content can be obtained through word introduction, image showing and video description.

Let's begin.


1. ZMC432H Hardware Brief Introduction

EtherCAT motion control edge controller ZMC432H supports self-researched and self-controlled software and hardware. And this EtherCAT edge controller is an independent multi-axis motion controller that is compatible with EtherCAT bus and pulse.

32 axes motion control can be achieved. At the same time, Zmotion remote HMI function is valid, which means network configuration display is provided to watch and adjust parameters in real-time.

1.png

ZMC432H has rich hardware interfaces and control functional modules, then effective and stable motion control and real-time data acquisition can be achieved to meet application requirements of both industrial control and industrial internet.

What's more, Linux system is built in ZMC432H. That is, it can be connected through local LOCAL interface, then, instruction interaction speed can be faster. The one interaction time of one single instruction and multiple instructions is about 40us.

2.png

ZMC432H hardware video description




2. Python + QT Motion Control Development
01

Configure Python + QT Development Environment & Install Required Tools

a. download python interpreter

b. install pyside 2 or pyside 6

This depends on python interpreter version, for interpreter with higher version, pyside should be used. There are 2 methods to install pyside2.

method 1: use win+r to open running interface, then input cmd (when installing python interpreter, configure environment variables well according to installment guidance, otherwise following commands can't be executed successfully), pip install pyside2 -i https://pypi.douban.com/simple/

method 2: install in pycharm

c. install PyCharm Community Edition

And then in below interface, click "+" to add required tool, for example, pyside2.

3.png

d. In Pycharm, configure customized tools (used for QT interface editing)

--open "Tool" editing as below steps--

4.png

--self-define Pyside2-uic--

Program filling & editing:  Python install - \Scripts\pyside2-uic.exe

Arguments filling & editing: $FileName$ -o $FileNameWithoutExtension$.py

Working directory filling & editing:  $FileDir$

5.png

--self-define QtDesigner--

Program filling & editing: Python install - \Scripts\pyside2-designer.exe

Working directory filling & editing: $ProjectFileDir$

6.png

--after configured custom tools, it can be used directly in "PyCharm" menu--

click "Tool -- Qt -- Qtdesigner" to enter UI design interface.

7.png

right click "ui" file, then click "Qt -- Pyside2 -- uic" to generate py file of ui file.

8.png


02

New Build Python Project and Add Function Library

a. use PyCharm Community Edition 2022 to open one new folder, or new build one directory after entering PyCharm Community Edition 2022, then add Python file in directory.

9.png

b. obtain Zmotion PYTHON function library and corresponding routines, you can download them from here or contact us. For Windows system, add zauxdll.dll zmotion.dll and zauxdllPython.Py into new created folder.

10.png


03

Check PC Function Manual

The PC programming function library manual can be obtained from "download/software manual", or please contact us.

Then there are many commands

a. controller connection: ZAux_OpenEth ()

11.png

b. download ".bas" file to controller for running

12.png

c. pause and resume controller inside Basic program

13.png


04

RTBasic File Downloading & Continuous Trajectory Processing through Python + Qt

a. routine interface

14.png

b. convert image in CAD to motion control codes of ".bas" through "ZmotionCadV1.0" tool.

--open this tool, click "file" -- "import", then select and open CAD graphic in dxf form that is to be converted--

15.png

--after opening, like this--

16.png

--click "file" -- "export" to export ".bas" file, then it can do above trajectory motion control when it is downloaded into control card--

--please refer to former corresponding article for CAD usage--

c. program example

--load UI file of QT in Python--

from PySide2.QtWidgets import QMessageBox

from PySide2.QtCore import QFile, QTimer

from PySide2.QtUiTools import QUiLoader

q_state_file = QFile("mainweiget.ui")

q_state_file.open(QFile.ReadOnly)

self.ui = QUiLoader().load(q_state_file)

q_state_file.close()

note: at this time, self.ui means ui in qt.

--in event processing function of link button, call controller connection interface function "ZAux_OpenEth()" to connect to controller, then open timer 1 to watch controller status after linked--

17.png

--watch controller state through timer--

18.png

--select corresponding bas file through event processing function of "select bas file" button--

19.png

--download and open selected bas file through event processing function of "opening" button--

20.png

note: ".bas" file also can be downloaded through our ZDevelop programming software. ZAux_BasDown command will generate one single bas file as ZAR and download it into controller.

--stop, pause and resume controller through event processing function of "stop", "pause", "resume" buttons--

21.png




3. Debug & Watch

Compile and run the routine, at the same time, connect to controller through ZDevelop to watch controller states.

And filename of ".bas" file inside the controller can be viewed when opening "debug" mode in ZDevelop during connection.

22.png

Also, there is oscilloscope function in ZDevelop, it can capture waveform of continuous small segments. Below shows waveforms captured by oscilloscope and CAD respectively.

23.png

24.png




4. Video Description

IMAGE 25

VIDEO DESCRIPTION



ABOUT ZMOTION

That's all, thank you for your reading -- EtherCAT Edge Programmable Industrial Motion Controller (6): Python + QT Continuous Trajectory Motion Control

For more information, please pay close attention to "Support"  and   "Download" , and there are other platforms about Zmotion - Youtube   &   LinkedIn   &   Twitter    &   Tiktok    &   Facebook including technical information (development environment, routine code), product showing, company development, etc.

Hope to meet you, talk with you and be friends with you.  Welcome!

This article is edited by ZMOTION, here, share with you, let's learn together.

ZMOTION: DO THE BEST TO USE MOTION CONTROL.

Note: Copyright belongs to Zmotion Technology, if there is reproduction, please indicate article source. Thank you.

Zmotion Technology focuses on development of motion control technology and general motion control products, it is a national high and new technology enterprise. Due to its concentration and hard work in motion control technology, ZMOTION already become one of the fastest growing industrial motion control companies in China, and is also the rare company who has managed core technologies of motion control and real time industrial control software completely. Here, Zmotion provides motion controller, motion control card, vision motion controller, expansion module and HMI. In addition, there is one program software developed by Zmotion -- ZDevelop. It is a good choice for you to program and compile. And program through upper computer, there is PC manual.

Zmotion Technology provides motion control card, motion controller, vision motion controller, expansion module and HMI. ( more keywords   for Zmotion: EtherCAT motion control card, EtherCAT motion controller, motion control system, vision controller, motion control PLC, robot controller, vision positioning...)

Have a good day, best wishes, see you next time.


2013-2023 版权所有 Zmotion Corp. Copyright Reserved 粤ICP备13037187号-1