Video tutorial: http://www.zmotion.com.cn/video/yemian/tvideos32.html
Today we'll learn about the ZMC motion controller SCARA robotic arm application quick start guide.
Controller Wiring Reference
01 Overview
SCARA (Selective Compliance Assembly Robot Arm) is a special type of cylindrical coordinate industrial robot. SCARA robots can be manufactured in various sizes, with the most common working radius ranging from 100 mm to 1000 mm. The payload capacity of these SCARA robots ranges from 1 kg to 200 kg. SCARA systems exhibit compliance in the x and y directions, while possessing good stiffness in the z-axis direction. They also feature a tandem two-bar structure, making them suitable for handling parts and assembly tasks. Therefore, SCARA systems are widely used in assembling printed circuit boards, electronic components, and integrated circuit boards. Furthermore, they have extensive applications in the plastics, automotive, electronics, pharmaceutical, and food industries.
ZMC motion controllers are available in products with different numbers of motor axes, including 6, 12, 20, 30, 32, 60, and 64 axes. They support linear interpolation, arbitrary circular interpolation, spatial circular interpolation, helical interpolation, electronic cams, electronic gears, synchronous following, virtual axis settings, and robot commands. This article uses the ZMC motion controller to introduce the CONNFRAME robot command and its application in SCARA robots.
The ZMC motion controller uses simple and easy-to-understand BASIC programming for secondary development of robotic arm programs. It supports multi-file, multi-task operation and custom instructions, and provides a powerful ZDevelop development environment that supports PC simulation and online tracking debugging. It is compatible with VC's operating habits, making complex motion control simple and clear. The robotic arm program of the motion controller can also use common PC host computer development software, such as VC, VB, VS, C++, C#, etc. Depending on the development environment, download the PC function library programming materials from the ZMC website, find the corresponding DLL link library and related files, and use the ZAux_Direct_Connframe and ZAux_Direct_Connreframe instructions to establish the robotic arm connection in the program.
CONNFRAME instructions make programming simple and convenient for realizing SCARA robot movements; the motor movements are smooth and precise during the movement process; customers have unanimously recognized the performance and quality of ZMC products, and positive motion technology can also customize special instructions and controller models for different customers' different needs.
02 System Architecture
01 SCARA robotic arm
SCARA robotic arms support 2-4 axes: large joint axes + small joint axes [+Z axis] [+end-effector rotation axis].
This system is applied to a standard 4-axis SCARA robot, with two joint axes (X and Y), one vertical Z-axis, and one end effector rotation axis (R). The controller needs to support robot functionality and download the edited program to the controller offline (it can also be monitored by a PC or operated by sending commands in real time). The desired motion trajectory can be edited using a touchscreen teaching method.
02 ZMC Motion Controller
The ZMC406 bus controller is a new generation of network 6-axis motion controller launched by Zheng Motion Technology (the number of axes can be expanded through expansion modules, supporting up to 32 axes), and it comes with 6 pulse axis interfaces.
Supports RS232, RS485, Ethernet, USB flash drive, CAN, and EtherCAT communication interfaces. EtherCAT offers a refresh cycle of up to 500µs. Up to 4096 isolated input or output ports can be expanded via the EtherCAT bus. Output current can reach 300mA, directly driving some solenoid valves. Each axis output pulse frequency can reach 10MHz. Optimized network communication protocols enable real-time motion control. Supports encoder position measurement and can be configured for handwheel input mode. A single computer can support up to 256 ZMC controllers connected simultaneously.
This motion controller is compared to a PCI motion controller card.
It has the following advantages:
1. No slots are used, resulting in better stability;
2. A MINI computer or an ARM industrial control computer can be selected to reduce the overall cost;
3. The controller can be used directly as a junction box, saving space;
4. The controller can run programs in parallel, and only requires simple interaction with the PC, reducing the complexity of PC software and other advantages.
The ZMC controller is debugged using the ZDevelop development environment, which is a convenient environment for programming, compiling, and debugging. ZDevelop can connect to the controller via serial port, RS-485, USB, or Ethernet.
The application can be developed using software such as VC, VB, VS, C++Builder, and C#. During debugging, the ZDevelop software can be connected to the controller simultaneously. The program requires the dynamic library zmotion.dll to run.
03 Implementation Plan
The solution uses the ZMC406 model controller for positive motion, which enables precise and smooth movement of the SCARA robot.
On a control platform that supports robotic arm functions, the connection between the actual joint axes and virtual axes of the robotic arm is established through instructions. Motion control instructions are sent to the virtual axes, and the motion path of the joint axes is automatically calculated through the robotic arm algorithm, thereby controlling the movement of the joint axes.
Connect the joint axes of the robotic arm to the pulse axis interface of the controller in sequence.
01 Concepts related to robotic arms
1) Joint axis and virtual axis
joint axis
A joint axis refers to a rotary joint in an actual mechanical structure, which is generally displayed as a rotation angle in a program (in some structures it is also a translation axis).
Because there is a reduction ratio between the motor and the rotary joint, the UNITS should be set according to the actual rotation of the joint. At the same time, the structural parameters in the TABLE should be calculated based on the center of the rotary joint, not the center of the motor shaft.
Virtual axis
The virtual axes are not physically existing; they are abstracted as the six degrees of freedom of the world coordinate system, namely X, Y, Z, RX, RY, and RZ. They can be understood as the three linear axes and three rotational axes of a Cartesian coordinate system, used to determine the machining trajectory and coordinates of the robot's end effector.
2) Forward and inverse motion
correct answer
By manipulating the joint coordinates and then calculating the spatial position of the end effector in the Cartesian coordinate system based on the mechanical structure parameters, this process is called forward motion. At this time, the actual joint axis is being manipulated, while the virtual axis automatically calculates its coordinates.
The controller uses the CONNREFRAME instruction to establish forward mode. This instruction is applied to the virtual axis. At this time, only the joint axis can be operated. The joint axis can also perform various movements, but the actual movement trajectory is not a straight line or arc. Forward mode is generally used to manually adjust the joint position or return the power-on point to zero.
Inverse solution
Given a spatial position in a Cartesian coordinate system, the coordinates of each joint axis are deduced. This process is called inverse motion solving. At this time, virtual axes are operated on, and the actual joint axes automatically calculate their coordinates and move.
The controller uses the CONNFRAME instruction to establish the inverse kinematics mode. This instruction is applied to the joint axis. At this time, only the virtual axis can be operated. Motion commands are sent to the virtual axis, and linear, circular, and spatial circular motions can be performed in the Cartesian coordinate system. Under the action of CONNFRAME, the joint axis will automatically move to the position after inverse kinematics.
02 Robotic Arm Commands
Implementation instruction: CONNFRAME -- Establish reverse engineering link
Description: Associates the target position in the current joint coordinate system with the position in the virtual coordinate system; the maximum speed of the joint coordinate system is limited by the SPEED parameter; this movement will be canceled when there are errors such as joint axis alarms.
Syntax: CONNFRAME(frame, tablenum, viraxis0, viraxis1)
frame: Coordinate system type, 1-scara (For customization of special robot types, please contact the manufacturer).
tablenum: The TABLE position for storing conversion parameters. When frame=1, this is used to store: the length of the first joint axis, the length of the second joint axis, the number of pulses per revolution of the first joint axis, and the number of pulses per revolution of the second joint axis.
viraxis0: The first axis of the virtual coordinate system
viraxis1: The second axis of the virtual coordinate system
Command: CONNREFRAME -- Establishes a correct connection
Description: The coordinates of the virtual axis are associated with the coordinates of the joint axis. After the joint axis moves, the virtual axis automatically moves to the corresponding position.
Syntax: CONNREFRAME(frame, tablenum, viraxis0, viraxis1)
frame: Coordinate system type, 1-scara (For customization of special robot types, please contact the manufacturer).
tablenum: The TABLE position for storing conversion parameters. When frame=1, it stores: the length of the first joint axis, the length of the second joint axis, the number of pulses per revolution of the first joint axis, and the number of pulses per revolution of the second joint axis.
axis0: The first axis of the joint coordinate system
axis1: The second axis of the joint coordinate system
FRAME description: Frame = 1, SCARA, as shown in the figure below, the rotation axis is the joint axis, and the corresponding position of the end is a virtual position.
03 Operating Procedures for the Robotic Arm
1) Confirm that the motor rotation direction is correct.
The motor direction and angle range are defined, and the positive direction of each joint motor is shown by the blue arrow in the figure below.
2) Confirm the axis sequence of each joint axis of the robot arm corresponding to the controller command parameters.
Select the axis number for each joint and the corresponding virtual axis number.
3) Set the relevant mechanical structure parameters in the TABLE.
When establishing a robot connection, the mechanical structure parameters need to be filled into the TABLE array in the following order.
4) Set joint axis parameters and virtual axis parameters
The axis type and pulse equivalent of each axis must be set correctly. The length units of all virtual axes and joint axes of the robot must be consistent, generally in mm.
The UNITS of the virtual axis is unrelated to the actual number of pulses sent and is used to set the motion accuracy. It is generally recommended to set the number of pulses per mm of the virtual axis to 1000, which means the accuracy is 3 decimal places.
5) Move each joint axis to the specified zero point position.
When establishing the robot algorithm, a zero-point position is needed as a reference, and the direction of motor rotation needs to be determined.
When the zero point of SCARA is the zero point of the two joint axes, they form a straight line, pointing in the positive direction of the virtual X-axis.
Coordinate direction: When the joint axis is at the zero point, the coordinates of the virtual axis zero point are (L1+L2,0). There are no special requirements for the zero point position of the vertical telescopic axis.
After establishing the inverse kinematics connection, the DPOS coordinates of the virtual axis are automatically corrected to (L1+L2,0).
6) Use the CONNREFARME command to establish the correct solution mode.
Correct solution mode:
BASE(Viraxis_x, Viraxis_y, [Viraxis_v] [,Viraxis_z])
CONNREFRAME(1,tablenum, Axis_a,Axis_b[, Axis_c][,Axis_d])
WAIT LOADED
Once successfully established, the virtual axis's MTYPE will be displayed as 34, and IDLE as 0. At this point, only the joint axis can be manipulated to move within the joint coordinate system; the virtual axis will automatically calculate the position of the end-effector's working point in the Cartesian coordinate system.
7) Adjust the robot's posture by manipulating the joint axes to ensure that there is no interference during movement (some structures have only one posture).
In mathematical terms, the posture of a robotic arm is a solution with multiple sets of joint axes for the same set of virtual axis values. That is, when a robotic arm moves to a certain coordinate point A in a Cartesian coordinate system, it can have multiple motion trajectories, and these motion trajectories correspond to different postures.
The SCARA robotic arm has two postures: left-hand posture and right-hand posture. The joint axis can only be moved in forward mode to select the posture.
The current attitude can be queried using the FRAME_STATUS command.
When running in reverse engineering mode, due to mechanical structure issues, problems may arise such as the inability to move to a certain position or rigid body interference, in which case attitude adjustment is required.
The robot's posture can only be adjusted by operating the joint axes in forward mode.
8) Use the CONNFARME command to switch to reverse engineering mode.
Reverse engineering mode:
BASE(Axis_a, Axis_b [,Axis_c] [,Axis_d])
CONNFRAME(1,tablenum, Viraxis_x, Viraxis_y, [Viraxis_v] [,Viraxis_z]) WAIT LOADED
Once successfully established, the joint axis MTYPE will be displayed as 33, and IDLE as 0. At this point, only the virtual axis can be manipulated to move in the Cartesian coordinate system; the joint axis will automatically calculate how to coordinate its movements within the joint coordinate system.
9) Select the virtual axis and send motion commands.
BASE(Viraxis_x, Viraxis_y[,Viraxis_v] [,Viraxis_z])
MOVE(dis_x, dis_y [,dis_v] [,dis_z])
04 Application Examples
For example, when processing a workpiece as shown in the figure below on an automatic welding machine, the two joint axes L1 and L2 of the SCARA robot are both 250 in length. The trajectory to be welded is a racetrack shape. 1 is the initial zero point. At this time, the joint axis coordinates are (0,0) and the virtual axis coordinates are (500,0).
The machine moves from the zero point to the starting machining point. During the second segment of the movement, welding needs to be initiated. The joint axis first returns to the starting position and then moves above the workpiece while the Z-axis descends. The welding initiation I/O is activated with a 50ms delay (because the welding liquid needs a certain amount of time to open, otherwise there will be missed welding at the starting point). Then, it runs along the trajectory. After the track welding is completed, the I/O is deactivated and the Z-axis rises.
Processing instruction code:
BASE(6,7,8) 'After inverting the connection, use motion commands to control the virtual axis.'
MOVEABS(300,0,20) 'The first straight line moves from the zero point (500,0,0) to (300,0,20).
MOVE_OP(0,1) 'Enable soldering I/O'
MOVE_DELAY(50) 'Delay 50ms
MOVEABS(300,100,20) 'The second straight line moves from the starting welding point (300,0,20) to (300,100,20).
MOVECIRCABS(200,100,250,100,0) 'The third arc, (300,100,20) moves to (200,100,20).
MOVEABS(200,-100,20) 'The fourth straight line moves from (200,100,20) to (200,-100,20)'
MOVECIRCABS(300,-100,250,-100,0) 'The 5th arc, (200,-100,20) moves to (300,-100,20)
MOVEABS(300,0,20) 'The 6th straight line moves from (300,-100,20) to (300,0,20)
MOVE_OP(0,0) 'Processing complete, close I/O'
MOVEABS(300,0,50) 'Z-axis rise
Oscilloscope sampling trajectory:
The following is a sample application routine for a SCARA robotic arm:
'**********Motor and Robot Arm Parameter Definitions**********
DIM L1 'Uparm Length
DIM L2 'Forearm Length
DIM L3 'X Direction Offset'
DIM ZDis 'One revolution of the rotation axis, distance moved along the z-axis'
L1=250
L2=250
L3=0
ZDis=0
DIM u_m1 'Number of pulses per revolution of motor 1
DIM u_m2 'Number of pulses per revolution of motor 2'
DIM u_mz 'Number of pulses per revolution of motor z'
DIM u_mv 'Number of pulses per revolution of motor v'
u_m1=3600
u_m2=3600
u_mz=3600
u_mv=3600
DIM i_1 'Joint 1 transmission ratio
DIM i_2 'Joint 2 transmission ratio
DIM i_z 'Joint z transmission ratio
DIM i_v 'Joint v transmission ratio
i_1=2
i_2=2
i_z=2
i_v=2
DIM u_j1 'Number of pulses per revolution of joint 1
DIM u_j2 ' Actual number of pulses per revolution for joint 2
DIM u_jz 'Number of pulses per revolution of joint z
DIM u_jv 'Number of pulses per revolution of joint v'
u_j1=u_m1*i_1
u_j2=u_m2*i_2
u_jz=u_mz*i_z
u_jv=u_mv*i_v
DIM p_z 'z-axis pitch
p_z=1.5
'*************Joint axis settings*************'
BASE(0,1,2,3) 'Select joint axis number
ATYPE=1,1,1,1 'Set axis type to pulse axis'
UNITS=u_j1/360,u_j2/360,u_jv/360,u_jz/p_z 'Set the z-axis units to 1 pulse per millimeter, and the other axes to 1 pulse per degree.'
DPOS=0,0,0,0 'Sets the position of the joint axis. This needs to be modified according to the actual situation.
SPEED=100,100,100,100 'Speed parameter setting'
ACCEL=1000,1000,1000,1000
DECEL=1000,1000,1000,1000
CLUTCH_RATE=0,0,0,0 'Use joint axis velocity and acceleration limits
'*************Virtual Axis Settings*************
BASE(6,7,8,9)
ATYPE=0,0,0,0 'Set as virtual axis'
TABLE(0,L1,L2,u_j1,u_j2,u_jv, L3,ZDis) 'Fill in the parameters according to the manual instructions.
UNITS=1000,1000,u_jv/360,1000 'Motion precision must be set in advance and cannot be changed during the process.'
SPEED=200,200,200,200 'Speed parameter setting'
ACCEL=1000,1000,1000,1000
DECEL=1000,1000,1000,1000
SRAMP=100,100,100,100 'S-curve
MERGE=ON 'Enable continuous interpolation'
CORNER_MODE=2 'Initiate corner deceleration
DECEL_ANGLE=15*(PI/180) 'Start deceleration angle: 15 degrees
STOP_ANGLE=45*(PI/180) 'Decelerate to the minimum speed at an angle of 45 degrees.
Establish connection to the robotic arm*************
WHILE 1
IF SCAN_EVENT(IN(0))>0 THEN 'Input 0, rising edge triggered'
Establish the correct solution and adjust the robot's posture by manipulating the joint axes.
BASE(6,7,8,9) 'Select virtual axis number'
CONNREFRAME(1,0,0,1,2,3) 'Use axis 0/1 as the joint axis to initiate the forward connection.
WAIT LOADED 'Waiting for motion loading'
"Correct Solution Mode"
ELSEIF SCAN_EVENT(IN(0))<0 THEN 'Input 0, triggered on falling edge'
Establish inverse kinematics and run the machining program using virtual axes.
BASE(0,1,2,3) 'Select joint axis number
CONNFRAME(1,0,6,7,8,9) 'The 6th/7th axis is used as a virtual XY axis to initiate the reverse engineering connection.
WAIT LOADED 'Wait for motion loading; the virtual axis position will be automatically adjusted during this time.'
"Reverse engineering mode"
BASE(6,7,8) 'After inverting the connection, use motion commands to control the virtual axis.'
TRIGGER
MOVEABS(300,0,20) 'The first straight line moves from the zero point (500,0,0) to (300,0,20).
MOVE_OP(0,1) 'Enable soldering I/O'
MOVE_DELAY(50) 'Delay 50ms
MOVEABS(300,100,20) 'The second straight line moves from the starting welding point (300,0,20) to (300,100,20).
MOVECIRCABS(200,100,250,100,0) 'The third arc, (300,100,20) moves to (200,100,20).
MOVEABS(200,-100,20) 'The fourth straight line moves from (200,100,20) to (200,-100,20)'
MOVECIRCABS(300,-100,250,-100,0) 'The 5th arc, (200,-100,20) moves to (300,-100,20)
MOVEABS(300,0,20) 'The 6th straight line moves from (300,-100,20) to (300,0,20)
MOVE_OP(0,0) 'Processing complete, close I/O'
MOVEABS(300,0,50) 'Z-axis rise
ENDIF
WEND
05 Robotic Arm Simulation Software
After downloading the program to the controller and running it, and establishing a forward or inverse kinematics connection, open the forward motion robot simulation software ZRobotView, click "Connect" to bring up the window below, select the controller IP, or connect to the simulator to view the effect if there is no controller.
After selecting the controller IP and connecting, the robot model shown below will be displayed. At this point, you can run motion commands or manually debug to check the robot's operation.
The effect of the robotic arm simulation software can be seen in the demonstration section at the end of the video.
This concludes our "Quick Start Guide to ZMC Motion Controller SCARA Robotic Arm Applications". For more learning videos and detailed text explanations, please follow our WeChat Official Account "Zheng Motion Assistant".
This article is original content from Zheng Motion Technology. We welcome everyone to reprint it for mutual learning and to jointly improve China's intelligent manufacturing level. Copyright belongs to Zheng Motion Technology. Please indicate the source if you reprint this article.