GNU General Public License v3.0

项目介绍

feecat/OpenSML 是一个托管在 GitHub 上的开源项目,采用 GNU General Public License v3.0 许可证,目前获得 58 个 Star、15 次 Fork。

仓库全名
feecat/OpenSML
开源许可证
GNU General Public License v3.0
Star 数
58
Fork 数
15
未关闭 Issue
4

README 摘要

OpenSML Open Sources SoftMotion Light For CiA402 Servo Drivers Tips: Library file should worked on CODESYS and TwinCAT3, Quadratic velocity ramp calc we used S7RTT Library. There is suggest to read keba servoone usermanual to get more information about cia402. Also i suggest that use Absolute Encoder, You don't need do reference travel at every start. And if you have any questions please feel free to push your…

完整内容见 GitHub 原始 README 或本页 。

常见问题

OpenSML 可以免费商用吗?

仓库标注的许可证为 GNU General Public License v3.0,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 OpenSML 的源码?

可以直接克隆仓库:git clone https://github.com/feecat/OpenSML.git;安装与运行步骤见仓库 README。

OpenSML 最近还在维护吗?

仓库最近一次更新为 2025年12月18日,当前有 4 个未关闭 Issue;Star 数为 58,可作为社区活跃度的参考。

关于

Open Sources SoftMotion Light For CiA402 Servo Drivers

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
146
价值分
44
活跃状态
活跃

README

OpenSML

Open Sources SoftMotion Light For CiA402 Servo Drivers

Tips:
Library file should worked on CODESYS and TwinCAT3, Quadratic velocity ramp calc we used S7RTT Library.

There is suggest to read keba servoone usermanual to get more information about cia402.
Also i suggest that use Absolute Encoder, You don’t need do reference travel at every start.
And if you have any questions please feel free to push your issues.

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 Position Mode:

Power_X(Axis:=Axis_X,xEnable:=Enable);
SyncPosition_X(
	Axis:=Axis_X , 
	MaxVelocity:=2000 , 
	MaxAcceleration:=20000 , 
	MaxJerk:=200000 , 
	CycleTime:=0.001 , 
	TargetPosition:=rTarget , 
	xEnable:=TRUE , 
	lrScale:=1.0 , 
	xSimulation:=TRUE,
	xError=> );

TODO

FuncBlock Status Name
Struct :white_check_mark: OpenSML_Axis
Power :white_check_mark: OpenSML_Power
Reset :white_check_mark: (use OpenSML_Power)
Home :white_check_mark: OpenSML_Home
Halt :white_check_mark: OpenSML_Stop
MoveAbsolute :white_check_mark: OpenSML_ProfilePosition
MoveVelocity :white_check_mark: OpenSML_ProfileVelocity
MoveRelative :white_check_mark: OpenSML_ProfilePosition
Stop :white_check_mark: OpenSML_Stop
Jog :construction: -
TouchProbe :construction: -
Cyclic Synchronous Velocity Mode :white_check_mark: OpenSML_SyncVelocity
Cyclic Synchronous Position Mode :white_check_mark: OpenSML_SyncPosition

Velocity Ramp

Quadratic velocity ramp calculate is very difficulty. Its simple when calc a curve, but its complexable when break a move without speed jitter.

I had create a 6th velocity ramp base g2 at https://github.com/feecat/OpenSML/issues/4#issuecomment-1146995447 , But it cannot break a move. This is unacceptable for most applications.

Struckig and Ruckig is a good choose, We had use it in v2.x. However, It have some problem when calc. So in V3.x we changed to S7RTT planner.

At this trace,

  1. POU.otg.CurrentPosition from struckig.
  2. POU.Axis1.fSetPosition from SM3_Basic.
  3. POU.csp.otg.CurrentPosition from OpenSML_SyncPosition.

They overlap perfectly, diff < 1e-5.

Overflow

PDO use DINT as TargetPosition, Range is -2147483648 ~ 2147483647. It could overflow. For Example:
A Servo Driver use 24bit encoder, its 16777216 pulse/rev(16#1000000). Normally Driver parameter will to be divided by 16(16#10), So its 1048576 pulse/rev(16#100000) for EtherCAT PDO(TargetPosition). If we use pitch=5mm ball screw, its 209715.2 pulse/mm.

So, if we dont want overflow, The position range is -10240 ~ 10239mm.
Overflow will automatic sum at some servo driver. so driver can accept overflow. But, if overflow happend, and OpenSML_SyncPosition FunctionBlock xEnable drop down, we cannot know how many overflow happend. When xEnable up, Actual position not equal OpenSML_SyncPosition feedback. It could make some exception move.

If you need a large move range, make sure not overflow. Also, Some servo driver cannot accept overflow.

评论

暂无评论