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

Compare robot position with DUT position - Issue with RobotsMonitor.py

#1
Hi Forum,

I would like to take a measurement with a robot. For this I would like to compare the x/y/(z) position from the device under test with the position of the robot in relation to the reference frame of the DUT. A similar question has already been asked here in the forum and referred to the RobotsMonitor.py script. But I have some troubles with the script:
1.) Does the script have to be executed inside or outside of RoboDK? If I execute the script within RoboDK, the program flow hangs. If I execute the script outside in a console, a crash occurs (see attached image). It seems that the function tic() is not defined. Do I need another library? If Yes, wich one?
2.) How do I get the position related to the reference frame of the DUT?
3.) Do I have access to a time stamp to synchronize the position of the robot with the position of the DUT?

Thanks for your help,
Thomas

我忘了说我的系统:
Linux Mint Cinnamon with Anaconda
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
RoboDK V5.2.0.19949 (64 Bit)


Attached Files Thumbnail(s)


.rdk Step 2 - Niryo with finger tool.rdk(Size: 195.78 KB / Downloads: 259)
#2
Could you try swapping the order of lines 6 and 7, so change
from robolink import * # API to communicate with RoboDK
from robodk import * # basic matrix operations
to
from robodk import * # basic matrix operations
from robolink import * # API to communicate with RoboDK

some functions of robolink uses functions defined in in the robodk module
#3
Hi Philip,

Thanks for answering. Changing these two lines results in the same error.

Regards,
Thomas
#4
Hi Phillip,

tic() and toc() is not supported. But there exists a lib.

Are there new informations to my questions?

I would like to take a measurement with a robot. For this I would like to compare the x/y/(z) position from the device under test with the position of the robot in relation to the reference frame of the DUT. A similar question has already been asked here in the forum and referred to the RobotsMonitor.py script. But I have some troubles with the script:
1.) SOLVED - Does the script have to be executed inside or outside of RoboDK? If I execute the script within RoboDK, the program flow hangs. If I execute the script outside in a console, a crash occurs (see attached image). It seems that the function tic() is not defined. Do I need another library? If Yes, wich one?
2.) How do I get the position of a real robot(not simulated) related to the reference frame of the DUT?
3.) Do I have access to a time stamp to synchronize the position of the real robot with the position of the DUT?

Have a nice weekend,

Thomas
#5
Hi Thomas,

任何Python script can be executed externally or within RoboDK. Performance should be the same.

Regarding the missing questions:
2. You can get the position of a real robot using the attached example. You should call the Joints function to force retrieving the position from the real robot to RoboDK. I attached an example.
3.你试过relying on the computer timestamp? RoboDK usually monitors robots at 15-20 Hz and the speed of the API should be irrelevant. This highly depends on the robot controller. If you need speeds closer to 1000 Hz the computer time stamp may have an impact and I don't think RoboDK can help you get high frequency monitoring information in a generic manner, or accurate time stamps.

I attached a sample file that can help you calculate the position and speed of the TCP. This section of code shows the relevant part:

Code:
while True:
# If we are connected to the real robot, this retrieves the position of the real robot
# (blocks until it receives an update from the real robot)
joints = robot.Joints().list()
if joints_changed(joints, joints_last):
# Get the TCP with respect to the coordinate system
# (the robot position was just updated from the real robot using Joints())
tcp_xyz = robot.Pose().Pos()
x,y,z = tcp_xyz
print("TCP position [X,Y,Z] (mm): [%.3f,%.3f,%.3f]" % (x,y,z))


Attached Files
.py Monitor_TCP_Speed.py(Size: 2.34 KB / Downloads: 327)
#6
Hi Albert,

Thank you for the example. I haven't tried to use the PC's time yet. The sampling rate should be between 130-150Hz. Faster is not necessary. The robot controller is a Mitsubishi CR2B-574. In our laboratory we use a 6-axis MELFA robot with proprietary software that controls the robot's controller. With this software I get a sample every 7ms. This is my target value that I would like to achieve with RoboDK. Is this possible?
I also have another question. How can I make the TCP move at a constant speed? The background is a measurement run with the TCP (effector) over a curved surface. Basically a swiping movement like that on a cell phone display when I want to scroll to the next screen. This movement should be constant in speed. A constant speed is desirable for approaching and moving away from the display, but not absolutely necessary.

Best regards,
Thomas




Users browsing this thread:
1 Guest(s)