I have a Kuka KR 20. I am running my robot in automatic mode and streaming commands using "RUNMODE_RUN_ROBOT" mode. The temperature of each motor is stored in the"$MOT_TEMP" Kuka system value. Is there a command to read this value in the Python roboDK library?
Yes, it is possible to read KUKA variables by using the Driver parameter on a robot and the GET command (special parameter for the KUKA driver). You can try something like this:
Code:
value = robot.setParam("Driver", "GET $MOT_TEMP") print(value)
06-19-2023, 07:27 PM(This post was last modified: 06-19-2023, 07:29 PM bypetsven.Edit Reason: Fixed code formatting
)
I just tried that code, but I am just getting an empty string. Here is my code:
Code:
# Import import robodk.robolink as rl
# Establish a link with the simulator global RDK RDK = rl.Robolink(args="-SKIPMAINT") # -SKIPMAINT removes maintenance dialogs
# Retrieve the robot global robot robot = RDK.Item("KUKA KR 20 R1810")
# If a station is not open, then open one if str(robot) == "RoboDK item (INVALID)": RDK.AddFile("PythonTest9.rdk") robot = RDK.Item("KUKA KR 20 R1810")
# Check if we are connected to the robot already state, msg = robot.ConnectedState()
# Connect to the robot if we are not already connected if state == -2: print("Connecting to robot...") status = robot.Connect() if status == 0: print("Robot connected") else: RDK.setRunMode(rl.RUNMODE_RUN_ROBOT)
# Print the temperature temperature = robot.setParam("Driver", "GET $MOT_TEMP[1]") print("The temperature is: '" + temperature + "'") print(type(temperature))
Make sure to install the latest version while RoboDK is not running. Also, make sure to kill any process started by RoboDK that's running in the background (such as apikuka.exe).
(06-20-2023, 10:57 AM)Albert Wrote:Are you using the latest version of RoboDK?
Make sure to install the latest version while RoboDK is not running. Also, make sure to kill any process started by RoboDK that's running in the background (such as apikuka.exe).
I am using RoboDK5.3.2和我使用的5.6.0版本RoboDK Python library.