Program Examples - Obtaining dynamic model parameters with the identification method

From SoftMC-Wiki
Jump to: navigation, search

The softMC can use a dynamic model in order to compensate for friction and dynamic effects for motion elements. In order to use the dynamic model, the user need to supply the dynamic model parameters of the system.

The identification method can be used for cases where the user do not have the dynamic model parameters. The identification method allows to estimate these parameters.

The following example describe how to use the identification method and retrieve the results. After running this example, one should retrieve the file idnt65.prg with the command: 'retrieve idnt65.prg' The '65' is the <ElementId> of the group. If your group has another <ElementId> (for example 67) then use this number instead. If the identification is for a single axis, then use the axis <ElementId> (1,2..).

The retrieved file, idnt65.prg, contains information about the identification process, among others:

1. The estimated dynamic model parameters.

2. Estimated errors regarding the values of the dynamic model parameters.

Running this file will update the dynamic model parameters with the estimated values.

'------------------------------------------------------------------------------
' File:        ident.prg
' Purpose:     An example of using the identification method for delta robot
' Version:     1.00
' Author:      Ron Danon
' Description:
' History:     2017-01-22  V1.00
'              Created
'------------------------------------------------------------------------------

program
	dim startPoint as generic joint
	dim sineTarget as generic joint
	dim SWfreq as generic joint
	
	startPoint = {-30,-30,-30,-200}
	sineTarget = {70,70,70,200}
	SWfreq = 0.3*{1,1.27,1.43,1.13} 
	'It is important that there will be alot of cycles before the system repeats it self. And that there will be blending of the phases of each joint.
	'Therefore, choose such frequencies that will sutisfy this condition.
	'For example, the frquencies {1,2,3,4} will cause the system to get back to its initial position after 1 cycle of the 1st joint
	'For example, the frquencies {1,1.27,1.43,1.13} will cause the system to get back to its initial position after 100 cycles of the 1st joint
	'the frquencies {1,1.01,1.02,1.03} will also cause the system to get back to its initial position after 100 cycles, but the phases will be almost synchronized at the beginning of the motion.
	
	with robot
		attach
			En = 0
			while En
				sleep 100
			end while
			DynamicModel = 1
			En = 1
			while not En
				sleep 100
			end while
			
			Move startPoint Abs = 1
			while IsMoving 
				sleep 100
			end while
			
			SineWave sineTarget SineWaveFreq = SWfreq
			
			sleep 2000
			
			IdentificationStart IdentFilterFreq = 80 'Low pass filter. Freq should be below 125 Hz
			
			sleep 20000 'the time of the identification, you can change this time.
			
			IdentificationFinish
			
			stop
			while IsMoving 
				sleep 100
			end while
			proceed
			En = 0
			
		detach
	end with
end program