Jump to content
OMRON Forums

Following a set of predifined positions with P


EnrikDS

Recommended Posts

Hi,

 

I am trying to supply a set of sampled angular positions to the PMAC so they can be followed by our motor in position control. At the moment the positions are going to be supplied in a .txt with two columns, time and angular value. The motor has to follow those values in the given time. What is the best way to do this if possible?

What I am trying is to store the .txt in the Documentation folder inside PMAC and read the file from a C program called from a motion program through CfromScript function. At the moment I am sucked reading the file for some reason.

 

Thank you very much

 

Best Regards

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

There are many ways to accomplish this. Let me start by saying it would be way easier if you had PMAC sampling these angular positions directly and then commanding the motion directly through a motion program, thereby bypassing the need for a host computer to transmit a file to PMAC. If that's not possible, you can also use our Rotary Buffer program wherein your host PC sends motion commands one at a time (or in one big block) and PMAC executes them as it receives them.

 

If you want to stick with your .txt file idea, the easiest way would be to parse the whole .txt file in C and load the data into Sys.DData elements, probably loading the times into even elements and the positions into odd elements. Sys.DData is an array of up to 16 million or so double-precision floating point variables for general purpose use. The parsing only needs to be one time per .txt file if the contents are not changing during the motion program's execution (you can do it even if the contents are changing, but you have to program it smarter).

 

Then, in your motion program, use a while loop that indexes through the Sys.DData array, where i runs from the beginning of your move's data list and goes to the end of the list, and command PVT moves for each point. I recommend PVT moves because they permit you to prescribe the exact time each move takes (i.e. the exact amount of time it takes to get from your motor's current position to the angular position you command).

 

If you need specific code examples on how to parse the file, or write the motion program, or anything else, let me know and I can post them.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...