Hi, there,
I would like to ask about some questions about MoveL control in RoboDK.
I have a trajectory about UR10 robot,and it's successful to run whole traj by moveJ, but when use MoveL to control, it went to wrong with 'robodk.robolink.TargetReachError', seems like 'Unable to reach desired target or destination error.' I checked all my programs and robodk sets, still not find any mistakes. The code block is here:
I would like to ask about some questions about MoveL control in RoboDK.
I have a trajectory about UR10 robot,and it's successful to run whole traj by moveJ, but when use MoveL to control, it went to wrong with 'robodk.robolink.TargetReachError', seems like 'Unable to reach desired target or destination error.' I checked all my programs and robodk sets, still not find any mistakes. The code block is here:
Code:
def load_Joint_angles(file_path):
data = scipy.io.loadmat(file_path)
joint_angles_rad = data["q"] # 直接访问变量 q
joint_angles_deg = np.degrees(joint_angles_rad)
print(f"成功加载关节角度数据,形状为: {joint_angles_deg.shape}")
return joint_angles_deg
# Any interaction with RoboDK must be done through RDK:
RDK = Robolink()
# Select a robot (popup is displayed if more than one robot is available)
# robot = RDK.ItemUserPick('Select a robot', 'KUKA KR 6 R900 sixx')
robot = RDK.Item('UR10')
if not robot.Valid():
raise Exception('No robot selected or available')
# get the current position of the TCP with respect to the reference frame:
# (4x4 matrix representing position and orientation)
target_ref = robot.Pose()
pos_ref = target_ref.Pos()
# It is important to provide the reference frame and the tool frames when generating programs offline
#robot.setPoseFrame(robot.PoseFrame())
#robot.setPoseTool(robot.PoseTool())
robot.setRounding(1) # Set the rounding parameter (Also known as: CNT, APO/C_DIS, ZoneData, Blending radius, cornering, ...)
# Set linear speed in mm/s
robot.setSpeed(20)
mat_file_path = "D:/OneDrive - National University of Singapore/Repos/UR_dual_robot_manufacturing_py/Energy Consumtion/Energy consumption model-Matlab/Robot_Dynamic_Identify/tra_optimization_q_12_25_100mm"
joint_angles = load_Joint_angles(mat_file_path)
num_steps = joint_angles.shape[1]
end_effector_poses = []
for i in range(num_steps):
joint_position = joint_angles[:, i].tolist()
# robot.setJoints(joint_position)
# robot.MoveJ(joint_position)
robot.MoveL(robot.SolveFK(joint_position, robot.PoseTool()))
pose = robot.Pose()
end_effector_poses.append(pose)