APIs, concepts, guides, and more
Multi-Axis Velocity

Perform velocity moves on multiple axes that can be updated synchronously and on the fly.

🔹 What is Multi-Axis Motion?

Multi-Axis Velocity Motion refers to a multi-axis velocity move that can be updated on the fly. This means that when a new velocity is commanded, all axes will update their velocities synchronously.

🔹 When to Use Multi-Axis Motion?

When it is necessary to update velocity, synchronously, and on the fly on multiple axes.

🔹 Multi-Axis Motion Test

In this picture, you can observe a Multi-Axis object updating its velocity 5 separate times every second. All 6 axes updated their velocity synchronously and on the fly. This means that every 1 second, the velocity of all 6 axes were updated and their update rate was tightly synchronized (happening at the same time).

Image

In this picture, you can observe 6 axes Multi-Axis object being updated with different velocities every 100ms.

Image

In this picture, you can observe how all 6 axes were updated every 100ms with random velocities, and every velocity update was happening at the same time (The vertical white lines display when a move is being updated).

Image

Why did we Test?

It was important to see how fast we could update velocities on a Multi-Axis object and how synchronized these velocity moves would be.

Therefore, we ran a test that would update a Multi-Axis velocity 100,000 times. We found that every velocity update was happening at approximately 2ms.

Conclusion

A Multi-Axis object velocity can be updated every2ms.

A Multi-Axis can change all its axes' velocities on the fly in a tightly synchronized manner

📜 Sample Code

  • C#

    // RapidCode Objects
    MultiAxis multi; // Declare what multi is.
    // Constants
    const int cycles = 2; // Specify how many times you want to update the velocity.
    const int NUM_OF_AXES = 6;
    controller.AxisCountSet(NUM_OF_AXES);
    controller.MotionCountSet(NUM_OF_AXES + 1); // We will need a motion supervisor for every Axis object and MultiAxis object
    int i;
    double[] accelerations = new double[6] { 1000, 1000, 1000, 1000, 1000, 1000 }; // Specify the acceleration for all 6 axes.
    double[] velocities = new double[6]; // Initialize the array that will contain the velocities of all 6 axes.
    Random rnd = new Random(); // Initialize the Random object that we will use to generate random velocities.
    Axis x_axis = controller.AxisGet(Constants.X_AXIS_NUMBER); // Initialize axis. (You can use RapidSetup to see what axes you are using.)
    Axis y_axis = controller.AxisGet(Constants.Y_AXIS_NUMBER); // Initialize axis.
    Axis z_axis = controller.AxisGet(Constants.Z_AXIS_NUMBER); // Initialize axis.
    Axis a_axis = controller.AxisGet(Constants.A_AXIS_NUMBER); // Initialize axis.
    Axis b_axis = controller.AxisGet(Constants.B_AXIS_NUMBER); // Initialize axis.
    Axis c_axis = controller.AxisGet(Constants.C_AXIS_NUMBER); // Initialize axis.
    HelperFunctions.CheckErrors(x_axis); // Check that the axis has been initialize correctly.
    HelperFunctions.CheckErrors(y_axis); // Check that the axis has been initialize correctly.
    HelperFunctions.CheckErrors(z_axis); // Check that the axis has been initialize correctly.
    HelperFunctions.CheckErrors(a_axis); // Check that the axis has been initialize correctly.
    HelperFunctions.CheckErrors(b_axis); // Check that the axis has been initialize correctly.
    HelperFunctions.CheckErrors(c_axis); // Check that the axis has been initialize correctly.
    multi = controller.MultiAxisGet(NUM_OF_AXES); // Configure your MultiAxis on RapidSetup (Make sure MotionCount is 1 higher than AxisCount)
    HelperFunctions.CheckErrors(multi); // Check that multi has been initialized correctly.
    multi.AxisRemoveAll(); // If there are any current axes on multi, remove them.
    multi.AxisAdd(x_axis); // Add axis to your Multi-Axis controller.
    multi.AxisAdd(y_axis); // Add axis to your Multi-Axis controller.
    multi.AxisAdd(z_axis); // Add axis to your Multi-Axis controller.
    multi.AxisAdd(a_axis); // Add axis to your Multi-Axis controller.
    multi.AxisAdd(b_axis); // Add axis to your Multi-Axis controller.
    multi.AxisAdd(c_axis); // Add axis to your Multi-Axis controller.
    multi.Abort(); // If there is any motion happening, abort it.
    multi.ClearFaults(); // Clear faults and enable all axes.
    multi.AmpEnableSet(true); // Enable the motor.
    for (i = 0; i < cycles; i++) // This loop will iterate 5 times based on the value of "cycles"
    {
    int random_vel1 = rnd.Next(1, 100); // random_vel1 is a number [ >= 1 and < 100 ]
    int random_vel2 = rnd.Next(1, 100);
    int random_vel3 = rnd.Next(1, 100);
    int random_vel4 = rnd.Next(1, 100);
    int random_vel5 = rnd.Next(1, 100);
    int random_vel6 = rnd.Next(1, 100);
    velocities = new double[6] {random_vel1, // Update axis's velocity.
    random_vel2, // Update axis's velocity.
    random_vel3, // Update axis's velocity.
    random_vel4, // Update axis's velocity.
    random_vel5, // Update axis's velocity.
    random_vel6 }; // Update axis's velocity.
    multi.MoveVelocity(velocities, accelerations); // Move your Multi-Axis. (this will also update the move on the fly)
    System.Threading.Thread.Sleep(100); // Sleep for 100ms before iterating again.
    }
    multi.Abort(); // Stop motion on all axes.