04-08-2024, 02:53 AM
(This post was last modified: 04-08-2024, 02:56 AM by JaeHong Yoo.)
Hello, I have a question.
I want to get the joint angle value of the robot model implemented on RoboDK and move the actual KUKA robot with that joint angle value, and make this process happen in real time without In this process, I am facing the problem of receiving the joint angle values of the connected KUKA robot and not receiving the joint angle values of the robot model implemented on RoboDK when using robot.Joints() while the connection with the KUKA robot is successful.
I will attach the example code that I wrote.
I would really appreciate it if you could refer to this code and provide a solution.
Have a good day.
I want to get the joint angle value of the robot model implemented on RoboDK and move the actual KUKA robot with that joint angle value, and make this process happen in real time without In this process, I am facing the problem of receiving the joint angle values of the connected KUKA robot and not receiving the joint angle values of the robot model implemented on RoboDK when using robot.Joints() while the connection with the KUKA robot is successful.
I will attach the example code that I wrote.
I would really appreciate it if you could refer to this code and provide a solution.
Have a good day.
Code:
from robodk.robolink import *
from robodk import robomath as rm
import time
if __name__ == "__main__":
RDK = Robolink()
robot = RDK.Item('KUKA KR 70 R2100-Meltio')
tool = robot.Tool()
turntable = RDK.Item('2DOF Turn-table')
reference = RDK.Item('Baseline')
linear_speed = 10
angular_speed = 180
joints_speed = 5
joints_accel = 40
is_stop = False
joints = robot.Joints()
print("Current joint values are:", joints)
# Connect to the robot using default connetion parameters
success = robot.Connect()
print("SUCCESS: " + str(success))
status, status_msg = robot.ConnectedState()
print("STATUS: " + str(status))
print("STATUS_MSG: " + status_msg)
if status != ROBOTCOM_READY:
# Stop if the connection did not succeed
raise Exception("Failed to connect: " + status_msg)
# init
robot.setPoseFrame(reference)
robot.setPoseTool(tool)
robot.setSpeedJoints(joints_speed)
while True:
joints = robot.Joints()
print("Current joint values are:", joints)
robot.MoveJ(joints)
print("Robot MoveJ")
time.sleep(0.01)
if is_stop:
break
RDK.ShowMessage("Done", True)