Modifying robot trajectory by overlaying custom motion

Hello everyone!

I am trying to program the UR5e to follow a welding path. I found out this article (Modify robot trajectory with custom motion) about custom motion between waypoints and I tried it.

offset[1] = sin((i / cycle_duration) * 2.0 * 3.14159) * amplitude

For this value, I divided it by 1000 since the result was in meters and it went over the default max offset value of 0.1m. Now the offset was 6mm which was good for the intended use.

Anyways, I am now getting an error: Path offset, Maximum acceleration limit exceeded. How can I make it work?

This is the thread code for calculating the offset positions:

thread Thread_1():
while (True):
$ 6 “setup”
$ 7 “ctrl_frequency≔500.0”
global ctrl_frequency=500.0
$ 8 “weave_frequency≔3.0”
global weave_frequency=3.0
$ 9 “amplitude≔0.006”
global amplitude=0.006
$ 10 “cycle_duration≔ctrl_frequency / weave_frequency”
global cycle_duration=ctrl_frequency / weave_frequency
$ 11 “pi≔3.14159”
global pi=3.14159
$ 12 “enable”
$ 13 “offset≔[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]”
global offset=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
$ 14 “i≔0”
global i=0
$ 15 “path_offset_enable()”
path_offset_enable()
$ 16 “alpha≔0.27”
global alpha=0.27
$ 17 “path_offset_set_alpha_filter(alpha)”
path_offset_set_alpha_filter(alpha)
$ 18 “weave”
$ 19 “Loop”
while (True):
$ 20 “offset[1]=sin((i / cycle_duration) * 2.0 * pi) * amplitude”
offset[1]=sin((i / cycle_duration) * 2.0 * pi) * amplitude
$ 21 “path_offset_set(offset, 2)”
path_offset_set(offset, 2)
$ 22 “i≔i+1”
global i=i+1
$ 23 “sync()”
sync()
end
end
end