You are here: Advanced Topics > Coordinated Motion > How-To: Coordinated Motion > Create a Linear or Circular Coordinated Motion Application

Create a Linear or Circular Coordinated Motion Application

A Coordinated Motion application can be created in one of two ways:

Related axes are "grouped" in an axes group. Coordinated motion is then performed on an axes group. For more information see What are Axes Groups?.

Typically, the following set of function blocks should be called before executing coordinated motion.

  1. Call MLMotionInit (BasePeriod) to initialize the motion engine. Base period is specified in microseconds.

    MLMotionInit(1000.0);   // 1000 µSec -> 1 mSec
  2. Call MC_CreateAxesGrp (EnableEnable signal for the drive, Hardware-Enable with 24V signal to X8, Software-Enable command by setup Software, fieldbus or permanently set. Both are required for enabling the drive., GroupName, UpdateRate, MaxNumberOfAxes, AxesGroupRef) to create a Coordinated Motion Axes Group

    Inst_MC_CreateAxesGrp(TRUE, 'GROUP1', 6, 2, Group1_ref);

    In the example above, the axes group name is 'GROUP1', the update rate is 1 mSec (specified by '6') and the maximum number of axes that can be added to the group is 2. The group reference variable 'Group1_ref' will be used in future coordinated motion function block calls to reference this newly created group.

  3. Call MC_InitAxesGrp (Enable, AxesGroup, VelLimit, AccLimit, DecLimit, JerkLimit) to initialize the path limits for velocity, acceleration, deceleration, and jerkIn physics, jerk is the rate of change of acceleration; more precisely, the derivative of acceleration with respect to time.

    Inst_MC_InitAxesGrp(TRUE, Group1_ref, 100.0, 300.0, 300.0, 1000.0);

    In the example above, the kinematic limits for axes group 'Group1_ref' will be set. The velocity limit will be set to 100.0 user units/second, acceleration and deceleration limits will be set to 300.0 user units/second2 and jerk will be set to 1000.0 user units per second3 (JerkIn physics, jerk is the rate of change of acceleration; more precisely, the derivative of acceleration with respect to time will be supported in a future release).

  4. Call MC_CreateAxis (AxisName, BusInterface, BusAddress, AxisNumber, AxisType, UserUnits, FeedbackUnits, Rollover, UpdateRate) to create a Coordinated Motion Axis. This function needs to be called for each Coordinated Motion Axis wanted in the application.

    Inst_MC_CreateAxis(TRUE, 'CoordAxis1', 'EtherCATDriver', 1001, CoordAxis1_AxisNum, 0, 360, 1048576, 0, 6);
    Inst_MC_CreateAxis(TRUE, 'CoordAxis2', 'EtherCATDriver', 1002, CoordAxis2_AxisNum, 0, 360, 1048576, 0, 6);

    In the example above:

  5. Call MLMotionStart () to start the Motion and the motion bus driver. This also initializes the EtherCATEtherCAT is an open, high-performance Ethernet-based fieldbus system. The development goal of EtherCAT was to apply Ethernet to automation applications which require short data update times (also called cycle times) with low communication jitter (for synchronization purposes) and low hardware costs network to operational mode.

    MLMotionStart();
  6. Call MC_AddAxisToGrp (Execute, AxesGroup, Axis, IdentInGroup) for each axis to be added to the group.

    Inst_MC_AddAxisToGrp(TRUE, Group1_ref, CoordAxis1_ref, 0);
    Inst_MC_AddAxisToGrp(TRUE, Group1_ref, CoordAxis2_ref, 1);

    In the example above, we are adding two axes, CoordAxis1 and CoordAxis2, to the group referenced by 'Group1_ref'. The axes are stored in the IdentInGroup positions 0 and 1. Note that when the group was created, it was specified that no more than 2 axes will be part of this group. Therefore, valid IdentInGroup locations are 0 and 1.

  7. Call MC_Power (Enable, Axis, EnablePositive, EnableNegative, BufferMode) for each Coordinated Motion Axis to enable the drive and close the servo loop.

    Inst_MC_Power1(TRUE, CoordAxis1_ref, TRUE, TRUE, 0);
    Inst_MC_Power2(TRUE, CoordAxis2_ref, TRUE, TRUE, 0);

    In the example above, drives CoordAxis1_ref and CoordAxis2_ref will be enabled and the position loop will be closed. Note that parameters 'TRUE, TRUE, 0' are place holders for future use and are not currently used.

  8. Call MC_GrpEnable (Execute, AxesGroup) to change the state of the Coordinated Motion Axis Group from GroupDisabled to GroupStandby and allow motion to be performed on the group.

    Inst_MC_GrpEnable(TRUE, Group1_ref);

    In the example above, 'Group1_ref' state will be changed from GroupDisabled to GroupStandby. The group must be in GroupStandby in order to perform motion.

  9. For the examples that follow, we want to set the current location of the axes in the group to 0, 0. This can be done by calling MC_GrpSetPos (Execute, AxesGroup, Position[], Relative, CoordSystem, BufferMode)

    PosAbs[1]:= 0;
    PosAbs[2]:= 0;
    Inst_MC_GrpSetPos(TRUE, Group1_ref, PosAbs, 0, MC_COORDINATE_SYSTEM_ACS, 0);

    In the example above, the axis positions of 'Group1_ref' will be set to 0, 0. 'PosAbs' specifies the position for each axis in the group. 'Relative' input, '0', uses 'PosAbs' to set the absolute position. The coordinate system is set to ACS . The buffer mode, '0', is a placeholder for future use and is not currently used.

  10. Optional: To Add more axes to the group, modify the above code in the following way:

After the above function calls have been made, we can start coordinated motion moves.

Performing a Linear Move

Performing a Circular Move

 

What are Axes Groups?

Performing a Linear Move

Performing a Circular Move


Stay Connected with Kollmorgen

Copyright © 2015 Kollmorgen™