Sign in to follow this  
Followers 0
ravi.joshi53

Running two axes (motors) simultaneously using TwinCAT 2 PLC Control

13 posts in this topic

Hi, We have Beckhoff CPU module CX1020-0113 and two Beckhoff AC servo drives conneted using EL7201 card. I want to run both of the motors simultaneously using TwinCAT 2 PLC Control. Since I want to control the position, so I am using MC_AbsolutePosition function block. The sinusoidal trajectory can be taken as 60*SIN(w*t) /*here t is time. w is angular frequency which is constant*/Below is the snippet from PLC program - Please see below image for System Manager Info - Can somebody tell me how to provide sinusoidal trajectory as position? Please note that both the motors must run simultaneously. - Thanks Ravi Edited by ravi.joshi53

Share this post


Link to post
Share on other sites
not sure what you are asking... are you trying to do 2-axis circular interpolation?

Share this post


Link to post
Share on other sites
Hi panic mode, Apologize for the inconvenience. Basically I have Beckhoff AC servo motors. I want to run these motors using TwinCAT 2 PLC Control. Presently, I am able to run them using two separate program (FBD) Joint1 and Joint2. These FBDs are later on called from MAIN FBD. Please see the below screenshot of PLC Control- I want to control the position of axis 1 and axis 2 by providing them different-2 profile. It means axis 1 may be runing on linear position profile howvere axis 2 may run on sinusoidal profile. Both the axes must move simultaneously. - Thanks Ravi

Share this post


Link to post
Share on other sites
Use a virtual axis as a master and link each axis profile to the master as a slave.

Share this post


Link to post
Share on other sites
Use a virtual axis as a master and link each axis profile to the master as a slave.

Share this post


Link to post
Share on other sites
Hi BITS N BYTES, Thank you for your suggestion. I would like to tell you more about the system. Here I am building a serial chain robot (a manipulator), which has 2 degree of freedom. Each joint is connected to a separate motor. Hence, when I run both the motors simulataneoulsy, I can achive certain trajectory at the final link flange (end-effector). Since, I do not have enough experience with TwinCAT, I would like to hear some more explanation about your suggestion. Can you please elaborate your suggestion more? I would really appreciate, if you can provide some sample TwinCAT project for the same. - Thank you. Ravi Edited by ravi.joshi53

Share this post


Link to post
Share on other sites
what do you mean by both joints are connected to a single motor? in serial chain manipulators, each joint is controlled by separate motor. so motor1 for example controls link1 (joint1 connects base and link1). motor2 controls link2 (joint2 connects link1 and link2) end of link2 is end of arm.

Share this post


Link to post
Share on other sites
Hi Panic Mode, That was a mistake while posting the reply. Yes. You are right i.e. each joint is controlled by separate motor. Hence in order to control the position of end-effector, I need to move both the motors simultaneously. Just for the demonstration purpose, I want to provide same trajectory (sinusoidal trajectory) to both the motors. Although I actual scenario the trajectories will be different for each motor. I have attached a screenshot of TwinCAT 2 PLC control program in my question. Please have a look. - Thanks Ravi

Share this post


Link to post
Share on other sites
Ravi, Please check out this link on the Beckhoff documentation: http://infosys.beckhoff.com/english.php?content=../content/1033/tcncptp/html/tcncslaves.htm&id= Axis 2 will be configured as a "Linear Slave Axis". You will set up the Axes so that you command Axis 1 and Axis 2 will follow depending on the function that you set up. If you need more help I can walk you through step by step.

Share this post


Link to post
Share on other sites
Hi OutOfControl, Thank you for your answer. However I think that I do not require "Slave Axis". Both the motors may have different-different trajectories BUT the only condition is that they must run simultaneously. Please see your inbox. I have sent you a message with more discription about the setup. - Thanks Ravi

Share this post


Link to post
Share on other sites
As mentioned in my previous post, THAT IS EXACTLY WHY YOU SHOULD USE A VIRTUAL AXIS !!

Share this post


Link to post
Share on other sites
BITS N BYTES, some more explanation please. Any sample code is always appreciated much more. - Thanks Ravi

Share this post


Link to post
Share on other sites
Am I correct in assuming you have enough position points for each axis so that the curve fits to your required curve? If you have the points, 1. Create an array with the positions 2. Run a loop where, the motor performs a FB_MoveAbsolute for every position. I think you are having trouble is, you set FBMove.Start= TRUE, then it doesn't move to the second position? Is that correct?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0