top of page
Search
Writer's pictureIvaylo Fiziev

Practical use case: Sigmoid motion profile


To continue the topic of motion profiles I would like to present a type of sigmoid function that is kind of useful in the area of robotics. This type of function can calculate the position of the joint in time based on the distance to travel and the maximum velocity.


Like before we need the definition of the function first:

FUNCTION "SIGMOID_MOP" : LREAL
VAR_INPUT
	VEL:LREAL; 				// velocity (mm/s, rad/s)
	DIST:LREAL;				// distance (mm,rad)
	ELAPSED_TIME:LREAL;		// elapsed time (sec)
END_VAR
VAR_TEMP
	B:LREAL;
	C:LREAL;
END_VAR
VAR CONSTANT
	LAMBDA:LREAL := 0.001; 	// error tolerance
END_VAR
BEGIN
	#B := 4 * (#VEL / #DIST);
	#C := (1 / #B) * LN((1 - #LAMBDA) / #LAMBDA);
	#SIGMOID_MOP := #DIST / (1 + EXP(-#B * (#ELAPSED_TIME - #C)));
END_FUNCTION

In Process Simulate you call it just like the trapezoid profile:

FUNCTION_BLOCK "MAIN"
VERSION:1.0
VAR_INPUT
	vel : LREAL;
	target : LREAL;
END_VAR
VAR_OUTPUT
	pos : LREAL;
END_VAR
VAR
	t : LREAL;
END_VAR
BEGIN
    #t := SIM_TIME(); // take current time in ms
    #t := #t / 1000;  // ms to sec
    #pos := "SIGMOID_MOP"(VEL:=#vel,
      DIST:=#target, 
      ELAPSED_TIME:=#t); // calculate the position at this time

    JUMP_JOINT(NAME:='j1', VALUE:=#pos); // jump the joint END_FUNCTION_BLOCK

Now let's take a look at the generated curves for position, speed and acceleration:

They look pretty promising !

Now you can move the joint without any shaking or vibration. This is what these profiles are all about. Cheers!


Note: If you have a big distance to travel this profile might not be the one for you. This makes it inappropriate for conveyors.


3 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page