�
Ii�5 � �F � d dl Z dZdZdZd dlZd dlZd dlZ G d� de� Z y)� NzAnthony ZhuangzCopyright 2009-2025zMIT Licensec �F � e Zd ZdZd|d�Zd� Zd}d�Zd~d�Zdd �Zd�d
�Z d�d�Z
g d�g d
�g d�dg d�ddfd�Zd|d�Zd�d�Z
d�d�Zd�d�Zd�d�Zd�d�Zd�d�Zd|d�Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zd� Zd�d �Zd�d!�Zd�d"�Zd�d#�Zg d�dfd$�Zd�d%�Zd�d&�Z d�d'�Z!d�d(�Z"d�d)�Z#d�d*�Z$d�d+�Z%d�d,�Z&d�d-�Z'd.� Z(d/� Z)g d0�d1d1fd2�Z*d3� Z+d4� Z,d5� Z-d6� Z.d7� Z/d8� Z0d�d9�Z1d:� Z2d;� Z3d<� Z4d=� Z5d�d>�Z6d?� Z7d�d@�Z8dA� Z9d�dB�Z:d�dC�Z;d�dD�Z<dE� Z=dF� Z>d�dG�Z?e@dH� � ZAdI� ZBdJ� ZCdK� ZDdL� ZEdM� ZFd�dN�ZGd�dO�ZHd�dP�ZIdQ� ZJdR� ZKdS� ZLdT� ZMdU� ZNdV� ZOdW� ZPdX� ZQdY� ZRdZ� ZSd[� ZTd\� ZUd]� ZVd^� ZWd_� ZXd`� ZYda� ZZdb� Z[dc� Z\dd� Z]de� Z^d�df�Z_dg� Z`dh� Zadi� Zbdj� Zcdk� Zddl� Zedm� Zfdn� Zgdo� Zhdp� Zidq� Zjdr� Zkds� Zldt� Zmdu� Zndv� Zodw� Zpdx� Zqdy� Zrdz� Zsd{� Zty)��UrScripta�
Interface to remote access UR script commands.
For more details see the script manual at this site:
http://www.universal-robots.com/download/
Beside the implementation of the script interface, this class also inherits from the
Real Time Client and RTDE interface and thereby also open a connection to these data interfaces.
The Real Time Client in this version is only used to send program and script commands
to the robot, not to read data from the robot, all data reading is done via the RTDE interface.
The constructor takes a UR robot hostname as input, and a RTDE configuration file, and optional a logger object.
Input parameters:
host (string): hostname or IP of UR Robot (RT CLient server)
rtde_conf_filename (string): Path to xml file describing what channels to activate
Example:
rob = URBasic.urScript.UrScript('192.168.56.101', rtde_conf_filename='rtde_configuration.xml')
self.close_rtc()
Fc �| � t j j |||� | _ | j j j � �Et d� t
j d� | j j j � ��Et | j j j � � y)zB
Constructor see class description for more info.
Nz"waiting for everything to be ready� )�URBasic�robotConnector�RobotConnector�
RobotModel�
ActualTCPPose�print�time�sleep)�self�host�
robotModel�hasForceTorques �CD:\MyProgram\GitLab\NOENAD-Universal-Robots-MCP\URBasic\urScript.py�__init__zUrScript.__init__# s� � � &�4�4�C�C�J�PT�Vd�e����"�"�-�-�;�;�=�E��6�7��J�J�q�M� �"�"�-�-�;�;�=�E� �d�!�!�,�,�:�:�<�=� c � � | j j j � r�| j j j � s^t j
d� | j j j � r%| j j j � s�^| j j j rt d� �y )Ng����Mb`?z Robot program execution error!!!)r r
�RuntimeState�StopRunningFlagr
r �rtcProgramExecutionError�RuntimeError�r s r �waitRobotIdleOrStopFlagz UrScript.waitRobotIdleOrStopFlag0 s� � ��"�"�-�-�:�:�<�T�EX�EX�Ec�Ec�Es�Es�Eu��J�J�u�� �"�"�-�-�:�:�<�T�EX�EX�Ec�Ec�Es�Es�Eu� ���)�)�B�B��A�B�B� Cr NTc
�� � d}| j d|||||||�� } |j di t � ��}
| j j j |
� |r| j
� yy)a
Move to position (linear in joint-space) When using this command, the
robot must be at standstill or come from a movej og movel with a
blend. The speed and acceleration parameters controls the trapezoid
speed profile of the move. The $t$ parameters can be used in stead to
set the time for this move. Time setting has priority over speed and
acceleration settings. The blend radius can be set with the $r$
parameters, to avoid the robot stopping at the point. However, if he
blend region of this mover overlaps with previous or following regions,
this move will be skipped, and an 'Overlapping Blends' warning
message will be generated.
Parameters:
q: joint positions (Can also be a pose)
a: joint acceleration of leading axis [rad/s^2]
v: joint speed of leading axis [rad/s]
t: time [S]
r: blend radius [m]
wait: function return when movement is finished
pose: target pose
zdef move_j():
{movestr}
end
�j��movetype�pose�a�v�t�r�wait�qN� ��_move�format�localsr �RealTimeClient�SendProgramr )r r'