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

Simple trapezoidal velocity move using Cam functions

Anonymous
2019-04-05
2019-04-11
  • Anonymous - 2019-04-05

    Originally created by: uk_sub

    Is it possible to create a move with trapezoidal velocity (linear velocity, no s-ramping) via the various Cam functions without having to use the Cam editor to define a general trapezoidal shape and then scaling this etc.. to suit my actual master and slave distances?

    I want to calculate (at run time) this Cam from just four points.
    For example, if 'a' is some nominal master distance..

    0,0
    a, (a/2)
    a+1, (a/2) + 1
    2a + 1, a + 1

    ..should be able to give me a nice trapezoidal profile (where the slave axis accelerates to a 1:1 velocity ratio with the master, travels 1 unit and then ramps down to a stop).

    However, whatever I try with the interpolation modes, use of SMC_CAMXYVA or other data types I cannot get linear velocity segments.

    e.g.
    CamData0[0].dX := 0;
    CamData0[0].dY := 0;
    CamData0[0].dV := 0;
    CamData0[0].dA := 0;

    CamData0[1].dX := 2;
    CamData0[1].dY := 1;
    CamData0[1].dV := 1;
    CamData0[1].dA := 0;

    CamData0[2].dX := 3;
    CamData0[2].dY := 3;
    CamData0[2].dV := 1;
    CamData0[2].dA := 0;

    CamData0[3].dX := 5;
    CamData0[3].dY := 4;
    CamData0[3].dV := 1;
    CamData0[3].dA := 0;

    Cam.nElements := 4;
    Cam.xStart := 0;
    Cam.xEnd := 5;

    Any ideas?

     

    Related

    Talk.ru: 1
    Talk.ru: 2
    Talk.ru: 3

  • Anonymous - 2019-04-11

    Originally created by: uk_sub

    Of course my example data wasn't quite right, it should be...

    CamData0[0].dX := 0;
    CamData0[0].dY := 0;
    CamData0[0].dV := 0;
    CamData0[0].dA := 0;

    CamData0[1].dX := 2;
    CamData0[1].dY := 1;
    CamData0[1].dV := 1;
    CamData0[1].dA := 0;

    CamData0[2].dX := 3;
    CamData0[2].dY := 2;
    CamData0[2].dV := 1;
    CamData0[2].dA := 0;

    CamData0[3].dX := 5;
    CamData0[3].dY := 3;
    CamData0[3].dV := 1;
    CamData0[3].dA := 0;

    It still doesn't work though.....over 100 views and no-one has any idea how to get a straight line trapezoidal profile out of a CAM??...

     

    Related

    Talk.ru: 1
    Talk.ru: 2
    Talk.ru: 3

  • Anonymous - 2019-04-11

    Originally created by: uk_sub

    I'm having a bad copy/paste day...the data should actually be...

    CamData0[0].dX := 0;
    CamData0[0].dY := 0;
    CamData0[0].dV := 0;
    CamData0[0].dA := 0;

    CamData0[1].dX := 2;
    CamData0[1].dY := 1;
    CamData0[1].dV := 1;
    CamData0[1].dA := 0;

    CamData0[2].dX := 3;
    CamData0[2].dY := 3;
    CamData0[2].dV := 1;
    CamData0[2].dA := 0;

    CamData0[3].dX := 5;
    CamData0[3].dY := 4;
    CamData0[3].dV := 0;
    CamData0[3].dA := 0;

    i.e. the final vel ratio is 0 of course....

    Anyway....I can get a nice poly (s-ramped) profile from this of course....but is there an easy way to get a non s-ramped version?...

     

    Related

    Talk.ru: 1
    Talk.ru: 2
    Talk.ru: 3


Log in to post a comment.