Program Examples:Single Axis Blending

From SoftMC-Wiki
Jump to: navigation, search
Language: English

here is an example of using blended motion for a single axis. the motion is done with different blendingFactor: 0 / 1 / 2

 

'------------------------------------------------------------------------------
' File:        BLEND.prg
' Purpose:     MC training for blending motion of a single axis
' Version:     1.00
' Author:      Eran Korkidi
' History:     2021-08-04  Created 
'------------------------------------------------------------------------------



program

	Attach X
	X.En = 1
	Sleep 100
	X.Abs = 1
	
	X.CP = 20
	X.BlendingFactor = 80
	Record X_MOT2.rec 10000 Gap=1 RecData = X.pcmd, X.VCMD, X.ismoving
		X.BlendingMethod = 0
		call executeMot
		X.BlendingMethod = 1
		call executeMot
		X.BlendingMethod = 2
		call executeMot
	RecordClose
	
	Detach X

end program ' <MyTask>.prg


sub executeMot
	Move X 0 Vcruise=100
	waitForMotion X
	RecordOn
		Sleep 100
		Move X 50 Vcruise=20
		Sleep 500
		Move X 100 Vcruise=20
		waitForMotion X
		Sleep 100
	RecordOff
end sub

result:

RTENOTITLE