OpenSML
Open Sources SoftMotion Light For CiA402 Servo Drivers
Why
codesys is the best plc programming platform. With the Raspberry Pi, you can get an advanced plc programming environment at a very low price.
However, the softmotion license was canceled in the latest version of codesys for raspberry pi. (> 3.5.14.40, which means Raspberry Pi 4 must pay to get a softmotion license)
The motion control used by most customers is very simple and does not involve interpolation motion.
This project aims to provide the open source cia402 motion library for codesys or twincat users.
Target
In theory, an interpolation procedure can be made, similar to CNC. I am still working hard for this, but time is not guaranteed.
How
I only use ST (Struct text language) programming and add as many comments as possible.
Example for MC_Power:
Power_X(Axis:=Axis_X,xEnable:=Enable);
Example for Home And Absolute Position Move:
CASE iState OF
0:
Power_X(Axis:=Axis_X,xEnable:=xStart);
IF Power_X.xDone THEN
iState:=10;
END_IF;
10:
Home_X(Axis:=Axis_X , xEnable:=xHomeEnable);
IF Home_X.xDone THEN
iState:=20;
END_IF
20:
ProfilePosition_X(
Axis:=Axis_X ,
xEnable:=xMoveEnable ,
xExecute:=xMoveExecute ,
xContinueMove:=FALSE ,
xRelativeMode:=FALSE ,
diTargetPosition:=diTarget ,
udiProfileVelocity:=udiVel);
END_CASE
Example for Cyclic synchronous Velocity Mode:
Power_X(Axis:=Axis_X,xEnable:=Enable);
SyncVelocity_X(
Axis:=Axis_X ,
xEnable:=EnableMove ,
diTargetVelocity:=diTargetVel ,
rAcceleration:=10000 ,
rDeceleration:=10000 ,
diCycleTime:=1000 ,
xError=>Error);
TODO
| FuncBlock | Status | Name |
|---|---|---|
| Struct | OpenSML_Axis | |
| Power | OpenSML_Power | |
| Reset | (use OpenSML_Power) | |
| Home | OpenSML_Home | |
| Halt | OpenSML_Stop | |
| MoveAbsolute | OpenSML_ProfilePosition | |
| MoveVelocity | OpenSML_ProfileVelocity | |
| MoveRelative | OpenSML_ProfilePosition | |
| Stop | OpenSML_Stop | |
| Jog | - | |
| TouchProbe | - | |
| Cyclic Sync Velocity Mode | OpenSML_SyncVelocity |