Introduction to Motion Direct Commands
In our last document, we added two virtual axis. If you have not done so already, please visit this page to add the two virtual axis before we continue. I will be assuming you are using a spare processor that is not attached to any machinery. Once your virtual axis are set up, please download to the processor. Go to Remote Run Mode.
In this example, I will demonstrate how the motion direct commands work by issuing a simple jog instruction. If you choose to use these commands on an actual servo, ensure the motion will not cause any damage to equipment or personnel!
In the Controller Tag database, you will notice that tags have been created for our virtual axis. Expand VirtualAxis1 by pressing the “+” next to the tag.
Find the tag for the actual position. In the first section, we will be looking at this position as we run through the motion direct commands to ensure our axis is responding.
Opening the Motion Direct Commands
In the Controller Organizer window (at the left), right click on VirtualAxis1, and we will open the “Motion Direct Commands”.
You will see the command list appear for our motion direct commands. Normally, if this were an actual axis, you would want to clear any faults or shutdown conditions with the MASR (Motion Axis Shutdown Reset), and MAFR (Motion Axis Fault Reset) commands. On an actual axis, you would then issue an MSO command (Motion Servo On). Since we are working with a virtual axis, however, the MSO command will not be functional since we don’t need to turn on an actual servo drive.
Execute a Command
To test the motion direct commands, we will simply perform a jog. In your command list, locate the MAJ (Motion Axis Jog) command. We will set the speed at 100 units per second for this demonstration, then execute the command.
You will see the actual position is now increasing with an actual velocity of near 100 (which was our setting) and the average velocity is also 100 (or close to 100).
To stop the axis, issue an MAS (Motion Axis Stop) command.
You will see that your velocity has gone to zero, and the position is no longer changing.
Other commands work very similar. You can use the help file if you need more information on how the other commands work. By using the motion direct commands on a virtual axis, you can experiment with the operation of various commands. This will help you get a good understanding of how the commands work before using them in logic.
You can execute a Motion Axis Home (MAH) command to return the axis values to the home position.
Next, you can move on to try the Motion Axis Move command!
— Ricky Bryce
Pingback: Creating a Virtual Axis in the ControlLogix processor
Pingback: Using the Motion Axis Move Command in a ControlLogix processor
Weird question, but I’ve looked everywhere and not (yet) found a solution.
I’m working on a machine with 2 physical axis that are geared to a virtual axis. I’m not going to have time while at the machine to rewrite the code to simply gear the slave to the master (I’m unsure why the virtual was created, honestly). I need to be able to actively home (via MAH, preferably) the virtual axis via the registration input of one of the physical axes. Is this possible and if you have the time can you explain how to do this?
If not, my plan is to perform a slow jog toward the prox sensor (registration input for homing) and stop when the sensor is set. Then set the virtual position to 0. I’m fairly certain this will have lower precision than a real MAH.
I understand what you are saying! Unfortunately a virtual axis (since it’s not physical) does not support the active homing. Homing the virtual axis will just set the .ActualPosition immediately to 0 (as I’m sure you found out). Sometimes a programmer will use a Virtual Axis when writing the code, so the project can be simulated more easily without real hardware before the project is deployed. I don’t know the full situation, but another option might be to temporarily “un-gear” from the virtual axis, then MAG the two physical axis together to get them to the right position, un-gear, MAH the virtual axis (if this is where you want it to be 0) and then re-MAG to the virtual axis. If I remember correctly, the MAS will un-gear the axis. There might be others with good motion experience that might have better ideas! — Ricky Bryce