urScript.cpython-312.pyc•92.3 kB
�
#0h ; � �J � d Z ddlZdZdZdZddlZddlZddlZ G d� de � Z
y)aw
Python 3.x library to control an UR robot through its TCP/IP interfaces
Copyright (C) 2017 Martin Huus Bjerge, Rope Robotics ApS, Denmark
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL "Rope Robotics ApS" BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of "Rope Robotics ApS" shall not be used
in advertising or otherwise to promote the sale, use or other dealings in this Software
without prior written authorization from "Rope Robotics ApS".
� NzMartin Huus Bjergez*Copyright 2017, Rope Robotics ApS, DenmarkzMIT 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 �RD:\mcp\Nonead-Universal-Robots-MCP\Nonead-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.waitRobotIdleOrStopFlagG 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'