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

Function for automatic "Get Position" when running a program on robot

#11
This is what my "Get_Position" macro in my RDK station looks like:
   

The only thing I did was to copy the script from the post by Albert and paste it into the Macro. 
Code:
# Type help("robolink") or help("robodk") for more information
# Press F5 to run the script
# Documentation: https://robodk.com/doc/en/RoboDK-API.html
# Reference:     https://robodk.com/doc/en/PythonAPI/index.html
# Note: It is not required to keep a copy of this file, your python script is saved with the station
#from robolink import *
RDK = Robolink()
robot = RDK.Item('',ITEM_TYPE_ROBOT)
if robot.Connect() > 0:
  robot.Joints()
else:
  raise Exception("Unable to connect to robot")


Is that what you meant by "Did you "import" Robolink in your python program."? 

I have attached my station.

.rdk   Forum_GetPosition_SimulationFreeze.rdk (Size: 9.92 MB / Downloads: 311)
#12
simply uncomment line 6 and it should work.

Jeremy
Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our Youtube Channel


  




Users browsing this thread:
1 Guest(s)