Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Error with MC_AddAxisToGroup / SMC_AXIS_GROUP_AXIS_IN_DIFFERENT_TASK

cyril-g
2017-09-13
2019-01-08
  • cyril-g - 2017-09-13

    Hi,

    I have a project in which I am trying to setup a new axis group based on PLCopen function blocks MC_AddAxisToGroup/MC_SetKinTransform/MC_GroupEnable.
    I wrote an SFC program for which the first step is the creation of the axis group. I've declared an AXIS_GROUP_REF_SM3 variable in the SFC program variable declaration header. This program is running on the only task of the project (MainTask).
    When I call MC_AddAxisToGroup with the declared axis group and an axis (a servo drive in this case (SM_Drive_Servo/AXIS_REF_SERVO) as inputs, I get the following error:

    SMC_AXIS_GROUP_AXIS_IN_DIFFERENT_TASK - An axis belonging to an axis group must be executed in the same task
    

    I couldn't figure out what's wrong with my program and the error message didn't make it clearer.
    Could anyone help me understanding this error message and debuging this issue ?
    Thanks ahead

     
  • josepmariarams - 2017-09-14

    Te task where the axe runs has to be the same as the task wher the group is created.

    See in axe:

    IMG: demo1.jpeg

     
  • cyril-g - 2017-09-14

    Thanks for your quick reply.
    I've changed the bus cycle task of my servo drives to MainTask which is the task where my SFC program is running (and one step of my SFC is creating the axis group). I still encounter the same error message though. Do you have any other suggestions ?

    BTW, in case you'd find it helpful, I've checked the field m_hTask of my axis group and it is set to 16#000000 wheras the field hTask in the servo drive variable (AXIS_REF_SERVO type) is 16#0883BAA0. This sounds to me like the drive and the program are still running in two different tasks, even though I did the change you've suggested (but not knowing what these two variables really stand for, this may have nothing to do with the current error...).

     
  • cyril-g - 2017-09-14

    I've created a simpler project to test this issue in isolation.
    I have a single program, assigned to MainTask (only task running in this application):

    PROGRAM PLC_PRG
    VAR
       ax_group : AXIS_GROUP_REF_SM3;
       addaxg : MC_AddAxisToGroup;
    END_VAR
    addaxg(
       AxisGroup:= ax_group, 
       Axis:= SM_Drive_Servo, 
       Execute:= TRUE, 
       Done=> , 
       Busy=> , 
       Error=> , 
       ErrorID=> );
    

    SM_Drive_Servo is a servo drive connected to Adafruit_PWM_SoftMotion on an I2C master on the I2C bus of a Raspberry Pi 3.
    The drive as well as the Adafruit_PWM_Softmotion objects have the bus cycle task set to MainTask.

    Even with this simple project, the error SMC_AXIS_GROUP_AXIS_IN_DIFFERENT_TASK is raised.

     
  • josepmariarams - 2017-09-14

    It seems that you not have a task assigned to the axis group.

    IMG: demo2.jpeg

     
  • cyril-g - 2017-09-14

    Ok, I see.
    The thing is, I was trying to make a new axis group based solely on PLCopen function blocks (MC_AddAxisToGroup/MC_SetKinTransform/MC_GroupEnable).
    Hence I only declare the axis group and then populate it with the axes and a kinematic transform (basically just the same as what is described in PLCopen part4, paragraph 4.1). Is this not possible with CodeSys 3.5SP11 ? Do I have to use the axis group configurator in any case ?
    If yes, then my next question will be how to set my custom kinematics to an axis group ? I've implemented the TRAFO.MC_KIN_REF_SM3 interface but I don't see it appearing in the list of kinematics in the axis group configurator. My implementation of the MC_KIN_REF3 interface is a POU in the same application where I want to configure an axis group.

     
  • josepmariarams - 2017-09-14

    Have you test to call your refgroup from the beguining of your program?

     
  • cyril-g - 2017-09-14

    Is this not what the program I've copied in a previous post doing ?
    I'm not sure I fully understand your comment. Maybe you would like to attach some example code to make your comment more clear for me?

    EDIT: For your convenience, I am attaching a simple project which can be used to reproduce the SMC_AXIS_GROUP_AXIS_IN_DIFFERENT_TASK error.

    TestAddGroup.project [131.43 KiB]

     
  • eschwellinger

    eschwellinger - 2017-09-15

    Hi,
    it does not make really sense to add all these fb's manually in the appication code.
    All these global init code and implcit fb calls are missing then (which gives the SoftMotion if you use the editors/configuration).
    So I would recommend to check the examples (which are all using the configuration for kinematics)

    BR
    Edwin

     
  • cyril-g - 2017-09-15

    Hi Edwin,
    Thanks for your reply.
    I guess this means the answer to my previous question about implementing an axis group the way it is done in PLCopen part4, paragraph 4.1 is no.
    Fine for me.

    Actually I do also prefer using the axis group configurator. However, my robot's kinematic is not supported by the SM3_Transformation library. I've then followed the steps defined in Softmotion's documentation to define my own kinemactics. As mentionned earlier, I've implemented the TRAFO.MC_KIN_REF_SM3 interface but I don't see it appearing in the list of kinematics in the axis group configurator. My implementation of the MC_KIN_REF3 interface is a POU in the same application where I want to configure an axis group.
    How can I make my custom kinematics visible from the axis group configurator ?
    Do you have an example project you could share with me that I could use to look into how to create my own custom kinematics ?
    Thanks ahead.

     
  • eschwellinger

    eschwellinger - 2017-09-16

    Hi,
    there will come an example implementation for an Gantry kinematic in this example project.
    Attached an exampleproject.

    BR
    Edwin

    Trafo Implementation.project [111.15 KiB]

     
  • cyril-g - 2017-09-18

    Many thanks!
    Your example project helped me solving the issues I was facing.
    Thanks for your great support.

     
  • josepmariarams - 2017-12-25

    Dears.

    If I need a diferent kinematic transformation than the ones predefined:

    I need to create an predefided group and after change the kinematic transformation?

    Or can I create an re_axis_group and call it every cycle?

    At the end the question is:

    The path os generated in the ref_axis_group or in any hidden fb?

    Enviat des del meu HUAWEI LYO-L21 usant Tapatalk

     
  • medlock - 2019-01-08

    Edwin Schwellinger hat geschrieben:
    Hi,
    there will come an example implementation for an Gantry kinematic in this example project.
    Attached an exampleproject.
    BR
    Edwin

    The example seems to be empty. Can you post again?

     

Log in to post a comment.