feecat / opensml Goto Github PK
View Code? Open in Web Editor NEWOpen Sources SoftMotion Light For CiA402 Servo Drivers
License: GNU General Public License v3.0
Open Sources SoftMotion Light For CiA402 Servo Drivers
License: GNU General Public License v3.0
Hi,
This is the first time i use Github for bug report so forgive me if i am not doing it wrong.
I noticed a small bug in the latest OpenSML.library V1.9.
When using the OpenSML_Axiscontroller FB the first time after starting the controller.
At STEP 10 of the state machine the axis gets disabled because the mode of operation has to be set first
there is a line to enable the axis again after operating mode = 8 but because the axis was enabled first the Axis.StatusWord.2 is still true and the state machine steps to STEP 20 before the axis is enabled again.
see the code change i made to fix this:
10://Set Mode
Axis.Modes_of_operation:=8;//Cyclic Synchronous Position Mode
Axis.ControlWord.3:=Axis.Modes_of_operation_display=8;//Success change mode, enable operation
otg.CurrentPosition:=DINT_TO_LREAL(Axis.Position_Actual_Value) / Control.Scale;//Write actual position to otg
IF Axis.StatusWord.2 **AND (Axis.Modes_of_operation_display=8)** THEN//Operation Enabled
iState:=20;
END_IF
I made another change to be able to change the cycle time of the otg FB, it was fixed to 0.01...
otg(
ControlInterface:= InterfaceType,//ControlInterfaceType.Position ,
TargetPosition:= Control.lrFollowPosition ,
TargetVelocity:= JogVel ,
TargetAcceleration:= 0 ,
CycleTIme:= **Control.CycleTime**,//was 0.01
MaxVelocity:= MoveVel,//Control.para.MaxVelocity ,
MaxAcceleration:= Control.MaxAcceleration ,
MaxJerk:= Control.MaxJerk);//accept new position and going on
BR,
Rinie
Hi
I'm coding with codesys a long time, i had use it to make some industrial controller, fieldbus adapter, cnc machine etc. I think i already known some principle about logical and softmotion function block.
But when i know more, i think the motion planning calc is very difficutily for me. For example, the real machine need s-curve acceleration or jerk planning, Normally just use function block like MC_MoveAbsolute and select velocity ramp mode in codesys, But i dont known how it calc position and speed in jerk motion. For now i can only realize trapezpid velocity ramp.
Then i had digger some information about motion planning... And i cannot found any plc core code about softmotion, they have a consensus that hide sourcecode. The closest is a paper about 4th order real-time trajectory generation function but no lucky to get sourcecode. Also no lucky in plcopen-motion public document.
Another way is fake a axis, due to define AXIS_REF_SM3 and make some patch like following, it bypass softmotion license and can be use MC_MoveAbsolute with full jerk funcion. Maybe i can do more work for it?
Please post any idea about this, Thanks.
Axis1:AXIS_REF_SM3;
Axis1.bCommunication:=TRUE;
Axis1.bRegulatorRealState:=TRUE;
Axis1.bDriveStartRealState:=TRUE;
IF Axis1.nAxisState=0 THEN
Axis1.nAxisState:=3;
END_IF
Axis1.eRampType:=2;
Axis1.fSavePosition:=Axis1.fSetPosition;
Axis1.fCycleTimeSpent:=0;
Axis1.fTaskCycle:=0.001;
Some helped link:
1, codesys velocity ramp
2, Programming S-curve motion profiles
3, S-Curve acceleration?
4, ISG-MC_MoveAbsolute
5, TML-LIB_S7
Thank you for your sharing your code.
it is very helpful.
But do you have any plan to make CSP mode? Cyclic sync position mode.
I think the CSP(Point to point) is more important compared with Profile Position mode.
it will not depend on the servo.
I have a question about quickstop,in FunctionBlock OpenSML_Power I see the following code
Axis.ControlWord.2:=xEmergencyStop;//QuickStop
This means that the flag bit is set to 1 when I want to execute QuickStop cmd.
But in some documents about CiA402 ,it seems that in Normal state(e.g. Operation Enable) this bit2 flag is 1.
And, instead, this flag bit is set to 0 when the QuickStop command is executed.
Is this due to different drive manufacturers?
In addition, I think it is possible to achieve the Jog function by speed mode(Operation mode = 3).
Hi!
Very nice project, but I am failing on adding my canOpen402 motor to the example.
The example uses an Axis Controller and and a Control unit - but which Axis I should use to map my motor to?
AxisController : OpenSML_AxisController;
con : OpenSML_Control;
I mapped the motor to con and If i turn the motor manually the actual position in the VISU changes - so that works.
But the rest doesnt work.
con.xSimulation:=FALSE;
I changed this to false as I am using a real motor.
Check my screenshot, I guess my mapping is wrong?
Thanks a lot!!
Hi,
I want to use this library but I have some problems settings thing up.
I get the following error:
'SM3_Drive_ETC_DS402_CyclicSync.AXIS_REF_ETC_DS402_CS' is not equal to type 'OpenSML_Axis' of VAR_IN_OUT 'Axis'
It would be of great help if somebody has a sample project for me, or can tell me what steps to take after importing this library.
Thanks in advance!!
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.