Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

InstructionListJoints not smoothing linear moves

#1
Hello!

I've recently been starting to work with the InstructionListJoints() method of the API, and I can't get it to behave as documented:

Quote:Linear moves are rounded according to the smoothing parameter set inside the program.

My repro project is simple:
  • New Station
  • Add a program
  • In the program, set a rounding (smoothing) instruction with a non-zero parameter
  • Add a MoveJ to the current robot position
  • Move the TCP linearly a shortish way (~50mm) in some direction
  • Add a MoveL to this position
  • Repeat the last two steps a few times so that the program should now be a series of collinear MoveL actions.

non-smooth-screenshot.png   

When I simulate this program, it behaves as expected - a single continuous linear motion from the first to the last pose. But when I extract the list of poses with InstructionListJoints and plot them, the result shows the robot ramping up and down between each target point. In fact, a closer look actually shows some weird double-move for each MoveL operation (see plots below).

Am I missing something, or is this a bug?

Plots of the output from InstructionListJoints:
non-smooth-y-coord.png     
non-smooth-joint-speeds.png   

(RoboDK 5.8.0 on Windows)
#2
Did you use a time-based calculation type for the InstructionListJoints function?

Can you share the RoboDK project file and the script you used?
#3
Hi Albert,

Yes, I used time-based calculation. Here's the script for extracting the joint angles:

Code:
from robodk import robolink
RDK = robolink.Robolink()
program = RDK.Item("Prog1", robolink.ITEM_TYPE_PROGRAM)
program.InstructionListJoints(save_to_file="c:/(...)/line.csv", flags=4, time_step=0.002)

And here's the script for plotting them (the Y coordinate, anyway - the joint plots are much the same):

Code:
import numpy
from matplotlib import pyplot as plt
data = numpy.loadtxt( "c:/(...)/line.csv" , skiprows=1, delimiter=",")
timestamps = numpy.arange(len(data), dtype=float) * 2e-3
y = data[:, 12]
plt.plot(timestamps, y)
plt.xlabel("Time (s)")
plt.ylabel("Y Coordinate (mm)")
plt.grid(True)
plt.tight_layout()
plt.show()

and I've attached a project file that exhibits the issue.


Attached Files
.rdk   non-smooth.rdk (Size: 3.07 MB / Downloads: 184)
#4
The fact you request a time stamp of 0.002 seconds does not mean that each step will take exactly this amount of time. This is usually the maximum. This time step may be split into smaller time steps in the viccinity of a target.

You should accumulate the delta time stamps by adding the time for each step and add it to all previous steps.
#5
Hi Albert,

Thank you for that suggestion, I didn't realise that was the case. However, I have remade the plots above with that in mind and they look identical to before - the movement still ramps up and down for each MoveL rather than smoothing/blending them together. Is this not the case for you?
#6
Hi @Albert,

Do you get a smooth result when extracting joint angles using InstructionListJoints?
#7
I recommend you to try running the following script:
C:/RoboDK/Library/Scripts/ProgramListCSV.py
#8
Hi @Albert, thanks, but that gives me the same results (when I change the time-step to match what I'm doing). Can you confirm that when you extract joint angles like this that the movements in your CSV data blend smoothly?
#9
I'm unable to reproduce this issue by using the ProgramListCSV.py example script that calculates positions and speeds. The plots attached show smooth curve for the position over time and the speed follows a trapezoid form (constant acceleration until the desired speed is reached and then constant deceleration).

You can take a look at the excel file to better understand how to calculate the curves attached.

Position and Speed calculation with ProgramListCSV.png   


Attached Files
.xlsx   Position and Speed math.xlsx (Size: 131.89 KB / Downloads: 163)
#10
Hi @Albert,

Thank you for showing that output data, that's what I've been expecting. I was confused about how you got that data out when it comes out differently for me, but after some experimentation I have found what appears to be the cause, and may well be a bug in RoboDK. If I run the program in question (double-click it in the tree) prior to exporting the joint angles with ProgramListCSV.py (or InstructionListJoints() generally) then the resulting data includes ramps before and after each step despite the smoothing configuration. If I then run a different program that sets the smoothing to any value other than what the main program uses, then try exporting again, then the data is smooth again as it should be. If I had to guess, I would say that the InstructionListJoints() internals are seeing the `Smooth(5)` instruction and skipping it because the smoothing is already set to 5 in the main application, but some smoothing parameter internal to InstructionListJoints is then not being set properly and the smoothing isn't applied.

Is this a bug?
  




Users browsing this thread:
1 Guest(s)