feecat / OpenSML

Open Sources SoftMotion Light For CiA402 Servo Drivers
GNU General Public License v3.0
42 stars 13 forks source link

Great Work, some improvements #2

Open elconfa opened 3 years ago

elconfa commented 3 years ago

Congratulations on this project! I have prepared the OpenSML_TC3.library file to be able to use your great work with Twincat. I have addes OpenSML_Status OpenSML_TC3.zip

In the "OpenSML_ProfilePosition" function it would be possible to add xAdditive to add a distance relative to the current position?

I'm also waiting for the Jog function and Probe.

Thanks Massimo

feecat commented 3 years ago

Hi Thanks for you library file.

You can set xRelativeMode:=TRUE to enable relative move. it will calc in servo driver. write code like this:

rt_Additive(CLK:=xAdditive); //<- This is R_TIRG
ProfilePosition_X(
    Axis:=Axis_X , 
    xEnable:=xMoveEnable , 
    xExecute:=xMoveExecute OR rt_Additive.Q , 
    xContinueMove:=FALSE , 
    xRelativeMode:=TRUE ,  //<- Set TRUE to use Relative Mode
    diTargetPosition:=diTarget , 
    udiProfileVelocity:=udiVel);

Currently i dont have servo driver for program test, But i think you can use SyncVelocity to create jog mode. just be careful. Probe function is depend on servo driver, different servo driver have different probe function, I dont have idea about this for now. maybe we need a lot of people take some servo drive for program test.

Thanks

elconfa commented 3 years ago

I worked with SML library and I have found some trouble. I fixed all FB and tested: OpenSML_Home OpenSML_Power OpenSML_ProfilePosition OpenSML_ProfileVelocity_Jog OpenSML_Reset OpenSML_Status OpenSML_Stop

All seems to work good. For people I upload Library for Twincat and Library for Codesys OpenSML-master.zip

I'm glad to hear your opinion. Thanks

feecat commented 3 years ago

Hi In you profilepositon if you continues move it take more time( iState change with 0 and 10\20\30), but i think its also good in actual use. Another problem is profile acc/dec not default on in device description file, Some plc software need manually add or even cant add it, only set it on servo commissioning software or manually create pdo write function, so in my code its didnt write.
Im suggest to read keba servoone usermanual, its best document of cia402 that i had see.

But you shared the library that could be useful, Great thanks.
And if you agree, can i add you library link into this repositories readme.md? If someone want they will quickly found library file, just import and test.
Thanks

elconfa commented 3 years ago

And if you agree, can i add you library link into this repositories readme.md?

Yes, you can. I will check your suggestion. Thanks a lot. Massimo

dlee99codesys commented 3 years ago

Hi feecat, I stumbled on your project and looks very promising. But I was not able to import the library into Codesys 3.5SP11Patch4. There was an error "Failed to open managed library. Reason: The project handle 122 is invalid." Something I am doing wrong? Dik

dlee99codesys commented 3 years ago

Never mind, Copied an pasted the code into the program and now it works. Thank you very much!

juki01 commented 2 years ago

Hello Feecat , Hello Elconfa , Hello dlee99codesys, am (beginner) dealing with the OpenSML Lib. I have successfully included the library in my Codesy project. To my Ethercat driver I added a SML CiA402 servo axis and renamed it as Drive. I added the OpenSML_Power block and assigned the inputs/outputs. I declared the axis input/output as Drive. During compilation this error is displayed C0201: Type 'SML_Drive_ETC.Axis_REF_ETC_DSP402_SML' does not match the type 'OpenSML_Axis' of VAR_IN_OUT 'Axis'.

Do you guys have any idea what I am doing wrong?

Many thanks and greetings Juki01

feecat commented 2 years ago

Snipaste_2021-11-02_14-25-59

OpenSML_Demo_SGD7S.zip

Hi @juki01 Here is a simple example for YASKAWA SGD7S servo driver, I had use it in real project. As you can see, Standard softmotion axis is license protected in codesys, so just create variables and connect it to input/output mapping in OpenSML, then it works.

juki01 commented 2 years ago

Hi feecat, thanks for your quick reply. It has helped me. At the moment I'm still struggling with the Power FB :( . I would get back to you if I can't get it to work.

Thanks again for your help.

Greetings juki01

juki01 commented 2 years ago

Hello feecat, I have a problem with the OpenSML_ProfilePosition FB. It is about the position accuracy. When positioning, the current position deviates from the set position by 3-4 increments loses per positioning. With the Codesys SML-Leicht FB in demo mode, the drive positions exactly. In the SMLOpen program, exactly the same parameters of the drive are set as in the Codesys SML-Light program.

Do you have an idea what this could be?

With kind regards juki01

feecat commented 2 years ago

Hi @juki01 Sorry for late. You should check "Target Position" and "Position Actual value" in device i/o mapping, Refer to the previous screenshot. The fieldbus drive never got increments loses in my tests. Did you are use Relative mode? it calc in servo (openSML Library), so maybe it takes problem.

juki01 commented 2 years ago

Hi feecat, thank you for your answer. As always, is the first look for the mistakes of others :( !! Your SML-FB blocks are o.k. ! I had not set the Inpos parameters of the drive correctly. After correcting the parameters, the drive positions exactly to the increment. Thanks for your help.

juki01