ur package

Universal Robots 制御パッケージ。

制御本体は UrRtde である。FastAPI / DeviceProxy 関連の公開入口は ur.server に置く。

class Config(yaml_path=None)[source]

Bases: object

BCAP_PORT = 5007
CLIENT_LOGGER_NAME = 'cobotta_client'
COBOTTA_IP = '10.170.10.35'
JOYPAD_INTERVAL = 0.01
JOYPAD_LOGGER_NAME = 'cobotta_joypad'
JOYPAD_PORT = 50051
LOGGER_LEVEL = 'debug'
ROBOT_IP = '10.170.10.56'
ROBOT_VAR_FILE = 'ur_robot_vars.json'
SERVER_IP = '10.170.10.33'
SERVER_LOGGER_NAME = 'cobotta_server'
SERVER_PORT = 8002
TIMEOUT = 5
UR_DEFAULT_BLEND_RADIUS = 0.005
UR_MAX_JOINT_ACCELERATION = 1.4
UR_MAX_JOINT_SPEED = 1.05
UR_MAX_LINEAR_ACCELERATION = 1.2
UR_MAX_LINEAR_SPEED = 0.25
UR_USE_DASHBOARD = False
_load_yaml(*, yaml_path, depth)[source]

コンストラクタから呼び出す

Parameters:

depth (int)

static _resolve_path(*, yaml_path, depth)[source]

絶対パスならそのまま、相対パスならこのメソッドの呼び出し元を基準に解決する

Parameters:
  • yaml_path (str | Path)

  • depth (int)

Return type:

Path

classmethod load_yaml(yaml_path)[source]

クラスとして使う

class MotionMode(*values)[source]

Bases: str, Enum

CobottaCtrl 互換名で公開する移動モード。

UR の RTDE API へ渡す直前に、PTP は moveJ / moveJ_IK、LINE は moveL、 CIRCLE は moveC 相当へ変換する。SPLINE は互換名として保持するが、UrRtde 側で未対応の場合は明示的に NotImplementedError として扱う。

CIRCLE = 'CIRCLE'
LINE = 'LINE'
PTP = 'PTP'
SPLINE = 'SPLINE'
class UrCtrl(robot_ip='10.170.10.56', arm_name='Arm', instance_name='Ctrl', logger=None, log_level=None, config=None, check_ik=True, hand=None, hand_interface=None)[source]

Bases: object

UR 用ロボット共通 I/F クラス。

UrRtde は I/F 層であり、RTDEControlInterface などの UR 固有実装を 利用者側へ露出しない。下位実装は self._ctrl に保持し、公開 I/F は このクラスで明示する。

_VAR_NAME_RE = re.compile('(P|J|F|I|IO)(\\d+)$')
property accel
approach(lComp, vntPoseBase, vntPoseLen, bstrOpt=None)[source]
autocal(origin=False)[source]

COBOTTA autocal の互換 I/F UR では該当機能がないため True を返す。

Parameters:

origin (bool)

Return type:

bool

property busy_status
change_tool(work_no)[source]
change_work(work_no=0)[source]
check_error()[source]

共通ロボットI/F: 現在または非同期動作後のURエラーを確認する。

clear_log()[source]

COBOTTA ログクリアの互換 I/F である。

Return type:

bool

clear_servo_log()[source]

COBOTTA サーボログクリアの互換 I/F である。

Return type:

bool

connect()[source]

共通ロボット I/F: 管理・監視・IO の通信接続を確立する。

ここでは Dashboard / RTDEReceive / RTDEIO までを接続する。 RTDEControlInterface は作らない。モーション制御権の取得は take_arm() が担当する。

Return type:

bool

property coord_type
property current_angle
property current_position
property decel
delete()[source]

接続を閉じ、ローカル P/J/I/F 変数を保存する。

Return type:

bool

dev(base, offset)[source]
property direct_mode
disconnect()[source]

共通ロボット I/F: 使用中の全通信経路を閉じる。

UR 固有の Dashboard / RTDE Receive / RTDE IO / RTDE Control は UrRtde に委譲し、交換可能なハンドはメーカー固有クラスで切断する。

Return type:

bool

drive(target, relative=False, path_blend=None, speed=None, is_async=False, bstrOpt=None)[source]
property error_code
property error_description
property extaccel
property extdecel
property extspeed
get_F(id_num)[source]
get_I(id_num)[source]
get_IO(id_num)[source]
get_J(id_num)[source]
get_P(id_num)[source]
get_accel()[source]
get_all_var()[source]
get_check_ik()[source]

共通ロボットI/F: 逆運動学事前確認設定を返す。

get_coord_type()[source]
get_current_angle()[source]
get_current_error_info()[source]
get_current_pose()[source]
get_current_position()[source]
get_current_tool()[source]
get_current_tool_no()[source]
get_current_work_no()[source]
get_decel()[source]
get_direct_mode()[source]
get_error()[source]
get_error_code()[source]
get_error_count()[source]
get_error_description(error_code)[source]
get_error_info(index)[source]
get_extaccel()[source]
get_extdecel()[source]
get_extspeed()[source]
get_jspeed()[source]
get_log_count()[source]

互換ログ件数を返す。

UR では専用ログを保持しないため 0 を返す。

Return type:

int

get_log_record(index)[source]
get_motion_complete()[source]
get_motion_mode()[source]
get_motion_preparation()[source]
get_path_blend()[source]
get_speed()[source]
get_task_status()[source]
get_tool(tool_no=0)[source]
get_tool_define(tool_no=0)[source]
get_var(kind_or_combined, id_num=None)[source]
get_version(rel_toml_path=None)[source]
get_work(work_no=0)[source]
give_arm()[source]

共通ロボット I/F: モーション制御権を解放する。

halt()[source]
hand(pos=None, *, position=None, force=None, direction=True, relative=False, speed=None, is_async=False, bstrOpt=None)[source]

共通ロボット I/F からメーカー固有ハンドを操作する。

Parameters:
  • pos – 開口幅 [mm]。position の互換引数。

  • position – 開口幅 [mm]。

  • force – 把持力 [N]。 指定した場合は direction の方向へ力を加える。

  • direction – force 指定時の動作方向。 True は閉方向、False は開方向。

  • relative – 相対位置指定かどうか。

  • speed – 動作速度 [%]。

  • is_async – 非同期動作を行うか。

  • bstrOpt – COBOTTA 互換引数。現在は使用しない。

Returns:

成功時 True、失敗時 False。

hand_close(speed=None)[source]

共通ロボット I/F: ハンドを完全に閉じる。

speed は 0~100 % で指定する。 完全に閉じる操作なので force の指定は要求しない。

メーカー固有ハンドが通信上 force 値を必要とする場合は、 対応する hand_interface が内部既定値を設定する。

hand_open(speed=None)[source]

共通ロボット I/F: ハンドを完全に開く。

speed は 0~100 % で指定する。 ハンド固有値への変換は hand_interface が行う。

hand_stop()[source]

共通ロボット I/F: ハンド動作を停止する。

init_hand()[source]

共通ロボット I/F: 選択されたハンドを初期化する。

is_connected()[source]

共通ロボット I/F の connect() が成立しているかを返す。

Dashboard / RTDEReceive / RTDEIO の通信系が成立している場合 True。 RTDEControl は含めない。RTDEControl の状態は is_control_connected() または take_arm() の戻り値で判断する。

Return type:

bool

is_empty_position(id_num, coord_type=None, tol=None)[source]
is_running()[source]
j2p(j_type_pos)[source]
property jspeed
property lock
motion_complete()[source]
property motion_mode
move(target, motion_mode=None, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=False, bstrOpt=None, check_ik=None)[source]
p2j(p_type_pos)[source]
property path_blend
print_error(error)[source]
print_error_info(error)[source]
reconnect()[source]

既存接続を閉じてから RTDE 接続を再確立する。

Return type:

bool

release_arm()[source]

共通ロボット I/F: モーション制御権を解放する。

remove_extension(filename)[source]
reset_error()[source]

共通ロボット I/F: エラー解除と動作可能状態への復帰を行う。

UR 固有の通常 popup、safety popup、安全状態、電源、ブレーキの 復帰処理は下位層の dashboard_recovery() に委譲する。

rotate(plane, angle, center, path_blend=None, speed=None, is_async=False, bstrOpt=None)[source]
run_script()[source]
property servo_on
set_F(id_num, value)[source]
set_I(id_num, value)[source]
set_IO(id_num, value)[source]
set_J(id_num, value)[source]
set_P(id_num, value)[source]
set_accel(accel)[source]
set_check_ik(enabled)[source]

共通ロボットI/F: 逆運動学事前確認を設定する。

set_coord_type(coord_type)[source]
set_decel(decel)[source]
set_extaccel(extaccel)[source]
set_extdecel(extdecel)[source]
set_extspeed(speed)[source]
set_jspeed(speed)[source]
set_motion_mode(mode)[source]
set_path_blend(path_blend)[source]
set_speed(speed)[source]
set_tool(tool_no, tool_define)[source]
set_tool_define(tool_no, tool_define)[source]
set_var(kind_or_combined, id_or_value, value=None)[source]
set_work(work_no, work_define, work_attribute=None)[source]
property speed
start_log()[source]
start_servo_log()[source]

COBOTTA サーボログ開始の互換 I/F である。

Return type:

bool

state()[source]
stop()[source]
stop_log()[source]
stop_servo_log()[source]

COBOTTA サーボログ停止の互換 I/F である。

Return type:

bool

take_arm()[source]

共通ロボット I/F: モーション制御権を取得する。

property task
property task_state
task_stop()[source]
teach(kind_or_combined='P', id_num=None, save=True)[source]
turn_off_motor()[source]
turn_on_motor()[source]
wait_for_complete(timeout=None, interval=0.02)[source]

Subpackages

Submodules

ur.config module

Kengo NAKADA: https://github.com/shimane-dev, https://github.com/kengo-nakada kengo.nakada@mat.shimane-u.ac.jp, kengo.nakada@gmail.com

class Config(yaml_path=None)[source]

Bases: object

BCAP_PORT = 5007
CLIENT_LOGGER_NAME = 'cobotta_client'
COBOTTA_IP = '10.170.10.35'
JOYPAD_INTERVAL = 0.01
JOYPAD_LOGGER_NAME = 'cobotta_joypad'
JOYPAD_PORT = 50051
LOGGER_LEVEL = 'debug'
ROBOT_IP = '10.170.10.56'
ROBOT_VAR_FILE = 'ur_robot_vars.json'
SERVER_IP = '10.170.10.33'
SERVER_LOGGER_NAME = 'cobotta_server'
SERVER_PORT = 8002
TIMEOUT = 5
UR_DEFAULT_BLEND_RADIUS = 0.005
UR_MAX_JOINT_ACCELERATION = 1.4
UR_MAX_JOINT_SPEED = 1.05
UR_MAX_LINEAR_ACCELERATION = 1.2
UR_MAX_LINEAR_SPEED = 0.25
UR_USE_DASHBOARD = False
_load_yaml(*, yaml_path, depth)[source]

コンストラクタから呼び出す

Parameters:

depth (int)

static _resolve_path(*, yaml_path, depth)[source]

絶対パスならそのまま、相対パスならこのメソッドの呼び出し元を基準に解決する

Parameters:
  • yaml_path (str | Path)

  • depth (int)

Return type:

Path

classmethod load_yaml(yaml_path)[source]

クラスとして使う

ur.robot_var_manager module

class RobotVarManager(robot_instance=None, logger=None, filename=None, autosave=False, autoload=False)[source]

Bases: object

Cobotta だけではなく一般的な Robot 向けの座標マネージャ

Parameters:
  • filename (str | None)

  • autosave (bool)

  • autoload (bool)

_autosave_if_enabled()[source]

autosave=True のときだけ現在のローカル変数を保存する。

static _make_key(kind_or_combined, num=None)[source]

(“P”, 10) と “P10” を同じキー表現へ正規化する。

Parameters:
  • kind_or_combined (str)

  • num (str | int | None)

Return type:

str

add_robot(cobotta)[source]
attach_robot(cobotta)[source]
get_robot(varname)[source]

Cobotta本体から値を取得し、managerにも反映

Parameters:

varname (str)

get_var(kind_or_combined, num=None, default=False)[source]

単一ローカル変数を取得する。

get_var(“P”, 10) と get_var(“P10”) は同じ意味である。 変数が存在しない場合は CobottaCtrl 側の慣例に合わせて False を返す。

Parameters:
  • kind_or_combined (str)

  • num (str | int | None)

  • default (Any)

list_vars()[source]
load(filename=None)[source]
read_var_from_robot(kind, num=None)[source]

cobotta本体 –> managerに反映

Parameters:
  • kind (str)

  • num (str | int | None)

read_vars_from_robot(kind, start, end=None)[source]

cobotta本体 –> managerに反映

Parameters:
  • kind (str)

  • start (str | int)

save(filename=None)[source]
set_var(kind, num, value=None)[source]

単一ローカル変数のセット。

set_var(“P”, 10, value) と set_var(“P10”, value) の両方を受け付ける。

Parameters:
  • kind (str)

  • num (str | int | Any)

set_vars(kind, start, end=None, value=None)[source]

ローカル変数の一括/範囲セット(cobotta本体には影響しない)

例::

set_vars(“P”, 10, value=[1,2,3,4,5,6]) set_vars(“P”, 10, 12, value=[ [1,2,3,4,5,6], … ])

Parameters:
  • kind

  • start

  • end

  • value

Returns:

write_all_to_robot()[source]

Manager に存在する全変数を robot_instance 本体に一斉反映(超危険)

write_var_to_robot(kind, num=None)[source]

end 省略と同じ意味 manager –> cobotta本体へ反映(危険!)

Parameters:
  • kind (str)

  • num (str | int | None)

write_vars_to_cobotta(kind, start, end=None)[source]

end 省略で var のみ登録(一つだけ) manager –> cobotta本体へ反映(危険!)

ur.server module

ur.ur_ctrl module

Universal Robots 用ロボット共通 I/F 層。 K.NAKADA, kengo.nakada@gmail.com

このモジュールは、UR 固有の RTDE 実装を直接公開しないための上位 I/F 層である。 実処理は ur_rtde.py 側に置き、このクラスはロボット共通 I/F として 公開するメソッドだけを明示的に定義する。

__getattr__ / __setattr__ は P/J/I/F/IO 形式の仮想変数アクセスに限定する。

class UrCtrl(robot_ip='10.170.10.56', arm_name='Arm', instance_name='Ctrl', logger=None, log_level=None, config=None, check_ik=True, hand=None, hand_interface=None)[source]

Bases: object

UR 用ロボット共通 I/F クラス。

UrRtde は I/F 層であり、RTDEControlInterface などの UR 固有実装を 利用者側へ露出しない。下位実装は self._ctrl に保持し、公開 I/F は このクラスで明示する。

_VAR_NAME_RE = re.compile('(P|J|F|I|IO)(\\d+)$')
property accel
approach(lComp, vntPoseBase, vntPoseLen, bstrOpt=None)[source]
autocal(origin=False)[source]

COBOTTA autocal の互換 I/F UR では該当機能がないため True を返す。

Parameters:

origin (bool)

Return type:

bool

property busy_status
change_tool(work_no)[source]
change_work(work_no=0)[source]
check_error()[source]

共通ロボットI/F: 現在または非同期動作後のURエラーを確認する。

clear_log()[source]

COBOTTA ログクリアの互換 I/F である。

Return type:

bool

clear_servo_log()[source]

COBOTTA サーボログクリアの互換 I/F である。

Return type:

bool

connect()[source]

共通ロボット I/F: 管理・監視・IO の通信接続を確立する。

ここでは Dashboard / RTDEReceive / RTDEIO までを接続する。 RTDEControlInterface は作らない。モーション制御権の取得は take_arm() が担当する。

Return type:

bool

property coord_type
property current_angle
property current_position
property decel
delete()[source]

接続を閉じ、ローカル P/J/I/F 変数を保存する。

Return type:

bool

dev(base, offset)[source]
property direct_mode
disconnect()[source]

共通ロボット I/F: 使用中の全通信経路を閉じる。

UR 固有の Dashboard / RTDE Receive / RTDE IO / RTDE Control は UrRtde に委譲し、交換可能なハンドはメーカー固有クラスで切断する。

Return type:

bool

drive(target, relative=False, path_blend=None, speed=None, is_async=False, bstrOpt=None)[source]
property error_code
property error_description
property extaccel
property extdecel
property extspeed
get_F(id_num)[source]
get_I(id_num)[source]
get_IO(id_num)[source]
get_J(id_num)[source]
get_P(id_num)[source]
get_accel()[source]
get_all_var()[source]
get_check_ik()[source]

共通ロボットI/F: 逆運動学事前確認設定を返す。

get_coord_type()[source]
get_current_angle()[source]
get_current_error_info()[source]
get_current_pose()[source]
get_current_position()[source]
get_current_tool()[source]
get_current_tool_no()[source]
get_current_work_no()[source]
get_decel()[source]
get_direct_mode()[source]
get_error()[source]
get_error_code()[source]
get_error_count()[source]
get_error_description(error_code)[source]
get_error_info(index)[source]
get_extaccel()[source]
get_extdecel()[source]
get_extspeed()[source]
get_jspeed()[source]
get_log_count()[source]

互換ログ件数を返す。

UR では専用ログを保持しないため 0 を返す。

Return type:

int

get_log_record(index)[source]
get_motion_complete()[source]
get_motion_mode()[source]
get_motion_preparation()[source]
get_path_blend()[source]
get_speed()[source]
get_task_status()[source]
get_tool(tool_no=0)[source]
get_tool_define(tool_no=0)[source]
get_var(kind_or_combined, id_num=None)[source]
get_version(rel_toml_path=None)[source]
get_work(work_no=0)[source]
give_arm()[source]

共通ロボット I/F: モーション制御権を解放する。

halt()[source]
hand(pos=None, *, position=None, force=None, direction=True, relative=False, speed=None, is_async=False, bstrOpt=None)[source]

共通ロボット I/F からメーカー固有ハンドを操作する。

Parameters:
  • pos – 開口幅 [mm]。position の互換引数。

  • position – 開口幅 [mm]。

  • force – 把持力 [N]。 指定した場合は direction の方向へ力を加える。

  • direction – force 指定時の動作方向。 True は閉方向、False は開方向。

  • relative – 相対位置指定かどうか。

  • speed – 動作速度 [%]。

  • is_async – 非同期動作を行うか。

  • bstrOpt – COBOTTA 互換引数。現在は使用しない。

Returns:

成功時 True、失敗時 False。

hand_close(speed=None)[source]

共通ロボット I/F: ハンドを完全に閉じる。

speed は 0~100 % で指定する。 完全に閉じる操作なので force の指定は要求しない。

メーカー固有ハンドが通信上 force 値を必要とする場合は、 対応する hand_interface が内部既定値を設定する。

hand_open(speed=None)[source]

共通ロボット I/F: ハンドを完全に開く。

speed は 0~100 % で指定する。 ハンド固有値への変換は hand_interface が行う。

hand_stop()[source]

共通ロボット I/F: ハンド動作を停止する。

init_hand()[source]

共通ロボット I/F: 選択されたハンドを初期化する。

is_connected()[source]

共通ロボット I/F の connect() が成立しているかを返す。

Dashboard / RTDEReceive / RTDEIO の通信系が成立している場合 True。 RTDEControl は含めない。RTDEControl の状態は is_control_connected() または take_arm() の戻り値で判断する。

Return type:

bool

is_empty_position(id_num, coord_type=None, tol=None)[source]
is_running()[source]
j2p(j_type_pos)[source]
property jspeed
property lock
motion_complete()[source]
property motion_mode
move(target, motion_mode=None, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=False, bstrOpt=None, check_ik=None)[source]
p2j(p_type_pos)[source]
property path_blend
print_error(error)[source]
print_error_info(error)[source]
reconnect()[source]

既存接続を閉じてから RTDE 接続を再確立する。

Return type:

bool

release_arm()[source]

共通ロボット I/F: モーション制御権を解放する。

remove_extension(filename)[source]
reset_error()[source]

共通ロボット I/F: エラー解除と動作可能状態への復帰を行う。

UR 固有の通常 popup、safety popup、安全状態、電源、ブレーキの 復帰処理は下位層の dashboard_recovery() に委譲する。

rotate(plane, angle, center, path_blend=None, speed=None, is_async=False, bstrOpt=None)[source]
run_script()[source]
property servo_on
set_F(id_num, value)[source]
set_I(id_num, value)[source]
set_IO(id_num, value)[source]
set_J(id_num, value)[source]
set_P(id_num, value)[source]
set_accel(accel)[source]
set_check_ik(enabled)[source]

共通ロボットI/F: 逆運動学事前確認を設定する。

set_coord_type(coord_type)[source]
set_decel(decel)[source]
set_extaccel(extaccel)[source]
set_extdecel(extdecel)[source]
set_extspeed(speed)[source]
set_jspeed(speed)[source]
set_motion_mode(mode)[source]
set_path_blend(path_blend)[source]
set_speed(speed)[source]
set_tool(tool_no, tool_define)[source]
set_tool_define(tool_no, tool_define)[source]
set_var(kind_or_combined, id_or_value, value=None)[source]
set_work(work_no, work_define, work_attribute=None)[source]
property speed
start_log()[source]
start_servo_log()[source]

COBOTTA サーボログ開始の互換 I/F である。

Return type:

bool

state()[source]
stop()[source]
stop_log()[source]
stop_servo_log()[source]

COBOTTA サーボログ停止の互換 I/F である。

Return type:

bool

take_arm()[source]

共通ロボット I/F: モーション制御権を取得する。

property task
property task_state
task_stop()[source]
teach(kind_or_combined='P', id_num=None, save=True)[source]
turn_off_motor()[source]
turn_on_motor()[source]
wait_for_complete(timeout=None, interval=0.02)[source]

ur.ur_error module

K.NAKADA, kengo.nakada@gmail.com

class UrError[source]

Bases: object

ROBOT_STATUS_BIT_DESCRIPTIONS = {'power_button_pressed': 'TP/操作画面上の power button が押下中', 'power_on': 'ロボット駆動系(サーボ電源)が ON。TP/コントローラ電源の意味ではない', 'program_running': 'UR プログラムまたは RTDE 制御スクリプトが実行中', 'teach_button_pressed': 'TP の teach button が押下中'}
_ROBOT_MODE_DESCRIPTIONS = {-1: 'RTDE からコントローラ状態を取得できない。ネットワーク、RTDE サービス、または接続タイミングを確認する', 0: 'RTDE から見てロボットコントローラが切断状態。IP 到達性と UR 側サービス状態を確認する', 1: 'TP 側で安全確認待ち。外部制御前に TP 上の安全確認操作が必要な可能性がある', 2: 'ロボット制御系が起動中。POWER_OFF/POWER_ON/IDLE/RUNNING への状態遷移を待つ', 3: 'コントローラと TP は起動しているが、ロボット駆動系が Power Off。TP/コントローラ電源 OFF ではない。Dashboard powerOn() の対象', 4: 'ロボット駆動系は Power On。ブレーキ解除が未完了なら Dashboard brakeRelease() の対象', 5: 'アイドル状態。ロボット駆動系は起動済み。RTDE control script を開始できる候補状態', 6: 'Backdrive 状態。手動誘導状態のため通常の外部移動指令は不可', 7: '実行中。UR プログラムまたは RTDE control script が動作中', 8: 'ファームウェア更新中。外部制御不可'}
_ROBOT_MODE_NAMES = {-1: 'NO_CONTROLLER', 0: 'DISCONNECTED', 1: 'CONFIRM_SAFETY', 2: 'BOOTING', 3: 'POWER_OFF', 4: 'POWER_ON', 5: 'IDLE', 6: 'BACKDRIVE', 7: 'RUNNING', 8: 'UPDATING_FIRMWARE'}
_RUNTIME_EXCEPTION_DESCRIPTIONS = {'inv_kin_convergence': {'description_en': 'The robot cannot reach the specified target pose.', 'description_ja': 'ロボットは指定された目標姿勢に到達できません。', 'error_type': 'TARGET_UNREACHABLE'}}
_SAFETY_ERROR_PRIORITIES = ('system_emergency_stopped', 'robot_emergency_stopped', 'emergency_stopped', 'fault', 'violation', 'protective_stopped', 'safeguard_stopped', 'recovery_mode', 'stopped_due_to_safety')
_SAFETY_MODE_DESCRIPTIONS = {1: '通常安全状態。安全停止・Safety Fault は検出されていない', 2: 'Reduced mode。安全設定により速度・力などが制限されている', 3: 'Protective Stop。原因確認後、closeSafetyPopup() と unlockProtectiveStop() の対象', 4: 'Recovery Mode。安全復帰用の低速/手動復帰状態', 5: 'Safeguard Stop。安全扉、ライトカーテン、外部安全入力などが停止要求中', 6: 'System Emergency Stop。システム側非常停止が有効', 7: 'Robot Emergency Stop。ロボット側非常停止が有効', 8: 'Safety Violation。安全制限違反。原因除去後 restartSafety() の対象', 9: 'Safety Fault。安全系異常。原因除去後 restartSafety()、続いて powerOn()/brakeRelease() の対象', 10: 'Validate Joint ID。関節 ID 確認状態。通常の外部制御状態ではない', 11: '未定義の安全モード。状態値の解釈不可'}
_SAFETY_MODE_NAMES = {1: 'SAFETY_MODE_NORMAL', 2: 'SAFETY_MODE_REDUCED', 3: 'SAFETY_MODE_PROTECTIVE_STOP', 4: 'SAFETY_MODE_RECOVERY', 5: 'SAFETY_MODE_SAFEGUARD_STOP', 6: 'SAFETY_MODE_SYSTEM_EMERGENCY_STOP', 7: 'SAFETY_MODE_ROBOT_EMERGENCY_STOP', 8: 'SAFETY_MODE_VIOLATION', 9: 'SAFETY_MODE_FAULT', 10: 'SAFETY_MODE_VALIDATE_JOINT_ID', 11: 'SAFETY_MODE_UNDEFINED_SAFETY_MODE'}
_SAFETY_STATUS_BIT_DESCRIPTIONS = {'emergency_stopped': '非常停止発生中', 'fault': 'Safety Fault 発生中', 'normal_mode': '通常安全状態', 'protective_stopped': 'Protective Stop 発生中', 'recovery_mode': 'Recovery Mode 発生中', 'reduced_mode': '縮退安全モード', 'robot_emergency_stopped': 'ロボット側非常停止発生中', 'safeguard_stopped': 'Safeguard Stop 発生中', 'stopped_due_to_safety': '安全機能により停止中', 'system_emergency_stopped': 'システム側非常停止発生中', 'violation': 'Safety Violation 発生中'}
_SAFETY_STATUS_BIT_NAMES = {0: 'normal_mode', 1: 'reduced_mode', 2: 'protective_stopped', 3: 'recovery_mode', 4: 'safeguard_stopped', 5: 'system_emergency_stopped', 6: 'robot_emergency_stopped', 7: 'emergency_stopped', 8: 'violation', 9: 'fault', 10: 'stopped_due_to_safety'}
classmethod decode_runtime_exception(raw_message)[source]

Primary Interface の runtime exception を解釈する。

Parameters:

raw_message (str)

Return type:

Dict[str, Any]

classmethod decode_safety_state(state)[source]

RTDE safety state を具体的なエラー分類へ変換する。

Parameters:

state (Dict[str, Any])

Return type:

Dict[str, Any] | None

class UrPrimaryErrorReceiver(robot_ip, logger, port=30001)[source]

Bases: object

UR Primary Interface からロボットメッセージを受信する。

Parameters:
  • robot_ip (str)

  • logger (Any)

  • port (int)

MESSAGE_TYPE_ROBOT_MESSAGE = 20
ROBOT_MESSAGE_TYPE_ERROR_CODE = 6
ROBOT_MESSAGE_TYPE_RUNTIME_EXCEPTION = 10
ROBOT_MESSAGE_TYPE_TEXT = 0
_parse_message(packet)[source]
Parameters:

packet (bytes)

Return type:

None

_receive_exact(size)[source]
Parameters:

size (int)

Return type:

bytes

_receive_loop()[source]
Return type:

None

connect()[source]
Return type:

bool

disconnect()[source]
Return type:

bool

get_messages_after(sequence, timeout=0.5)[source]
Parameters:
  • sequence (int)

  • timeout (float)

Return type:

List[Dict[str, Any]]

is_connected()[source]
Return type:

bool

mark()[source]
Return type:

int

ur.ur_rtde module

CobottaCtrl に近い I/F を持つ Universal Robots 制御クラス。 K.NAKADA, kengo.nakada@gmail.com

依存:

pip install ur-rtde

公開 I/F の単位:

P座標 [x, y, z, rx, ry, rz] : mm, degree J座標 [j1, …, j6] : degree speed / accel / decel : 0 < 値 <= 100 の百分率

UR の姿勢 rx, ry, rz は Euler 角ではなく rotation vector である。 本クラスでは rotation vector の各成分を degree 表記して公開する。 RTDE 境界では位置を m、角度を rad に変換する。

互換上の注意:
  • P/J/I/F は UR コントローラ変数ではなく、このクラス内の仮想変数である。 constructor で自動決定した JSON ファイルへ常時保存する。

  • @0 は blend=0、@P は default_blend_radius として move_path() で扱う。 単一点の move() ではブレンドは適用されない。

  • Cobotta 固有の PacScript、ファイル、専用ハンド機能は提供しない。

class UrRtde(robot_ip=None, logger=None, log_level=None, config=None, check_ik=True)[source]

Bases: object

ur_rtde を CobottaCtrl 風に扱うラッパークラス。

CobottaCtrl の公開 I/F を既存アプリケーションから差し替えやすくする ことを目的にした薄い互換層である。UR の RTDE は Cobotta/RC8 の 変数系、@P、PacScript、TakeArm/GiveArm と同じ概念を持たないため、 それらは「互換名を持つローカル実装」または「安全な no-op」として 扱う。

位置単位は CobottaCtrl 側に合わせて公開 I/F では mm と degree とし、 RTDE 呼び出し直前に m と rad へ変換する。UR の姿勢成分 rx, ry, rz は Euler 角ではなく rotation vector である点に注意すること。

Parameters:
  • robot_ip (Optional[str])

  • logger (Optional[Any])

  • log_level (Optional[str])

  • config (Optional[Any])

  • check_ik (bool)

_POSITION_VAR_RE = re.compile('^(?:@\\S+\\s+)?([PJ])(\\d+)$', re.IGNORECASE)
_VAR_RE = re.compile('(P|J|F|I|IO)(\\d+)$', re.IGNORECASE)
classmethod _active_flag_names(flags)[source]

有効な flag 名だけを取り出す。

Parameters:

flags (Dict[str, bool])

Return type:

List[str]

_begin_api_error_capture(operation, source_class, source_method, details=None)[source]

API実行前のPrimaryメッセージ位置と呼出情報を記録する。

Parameters:
  • operation (str)

  • source_class (str)

  • source_method (str)

  • details (Dict[str, Any] | None)

Return type:

Dict[str, Any]

_cleanup_control_interface()[source]

RTDEControl だけを破棄する。

Return type:

None

_cleanup_interfaces()[source]

接続失敗時の掃除専用処理。

cleanup 中の失敗は最後のエラー原因を上書きしない。

Return type:

None

_cleanup_rtde_interfaces(include_control=True)[source]

RTDE interface を破棄する。Dashboard は閉じない。

Parameters:

include_control (bool)

Return type:

None

_connect_dashboard(caller)[source]

Dashboard Server へ接続する。

Dashboard は UR の管理系インターフェースであり、TP に相当する safety popup、Power On、Brake Release、Safety Restart を扱う。 RTDEControl より先に接続する。

Parameters:

caller (str)

Return type:

bool

_control()[source]

RTDEControlInterface を取得する。

未接続の場合は例外を送出する。

Return type:

Any

_create_dashboard_client()[source]

DashboardClient を取得する。

既に接続済みの DashboardClient がある場合はそれを返す。 未接続の場合は reset_error() 用に一時接続を作成する。

Returns:

temporary=True の場合、呼び出し側で disconnect する。

Return type:

(dashboard, temporary)

_dashboard_call(dashboard, caller, method_name)[source]

Dashboard コマンドを 1 つ実行してログに残す。

Parameters:
  • dashboard (Any)

  • caller (str)

  • method_name (str)

Return type:

bool

_dashboard_client()[source]

DashboardClient を取得する。

Dashboard 無効時または未接続時は例外を送出する。

Return type:

Any

static _dashboard_execute(dashboard, method_name)[source]

DashboardClient のメソッドを存在確認して実行する。

DashboardClient の戻り値は ur_rtde の版により str/None などが混在する。 例外を投げなければ「送信は成功」と扱う。UR 側で受理されたかどうかは、 直後の robotmode()/safetystatus() を読み直して判定する。

Parameters:
  • dashboard (Any)

  • method_name (str)

Return type:

Tuple[bool, Any]

static _dashboard_has(snapshot, key, words)[source]

Dashboard snapshot の指定 key に word 群のいずれかが含まれるかを返す。

Parameters:
  • snapshot (Dict[str, Any])

  • key (str)

  • words (Sequence[str])

Return type:

bool

_dashboard_recovery(caller='reset_error')[source]

Dashboard Server 経由で UR のエラー解除と起動復帰を試みる。

COBOTTA の reset_error() が ManualResetPreparation / ClearError / MotionPreparation をまとめて行うのと同じ位置付けである。UR では Dashboard Server で TP popup と safety 状態を確認し、必要な解除操作を選択する。

ここでは RTDEControlInterface に触らない。RTDE control script を開始できない 状態から復帰するための前処理であり、壊れた RTDEControlInterface に対する reuploadScript() は行わない。

Parameters:

caller (str)

Return type:

bool

_dashboard_robot_booting(snapshot)[source]

Dashboard robotmode が起動遷移中かを判定する。

Parameters:

snapshot (Dict[str, Any])

Return type:

bool

_dashboard_robot_power_off(snapshot)[source]

Dashboard robotmode が Power Off 系かを判定する。

Parameters:

snapshot (Dict[str, Any])

Return type:

bool

_dashboard_robot_ready_for_brake_release(snapshot)[source]

brakeRelease() を試せる状態かを判定する。

Parameters:

snapshot (Dict[str, Any])

Return type:

bool

_dashboard_robot_ready_for_rtde(snapshot)[source]

RTDE control script 開始を試せる候補状態かを判定する。

Parameters:

snapshot (Dict[str, Any])

Return type:

bool

_dashboard_safety_blocks_soft_reset(snapshot)[source]

ソフトだけでは解除できない安全停止かを判定する。

Parameters:

snapshot (Dict[str, Any])

Return type:

bool

_dashboard_safety_needs_fault_reset(snapshot)[source]

restartSafety() 系の復帰が必要かを Dashboard 文字列から判定する。

Parameters:

snapshot (Dict[str, Any])

Return type:

bool

_dashboard_safety_needs_protective_unlock(snapshot)[source]

unlockProtectiveStop() 系の復帰が必要かを Dashboard 文字列から判定する。

Parameters:

snapshot (Dict[str, Any])

Return type:

bool

_dashboard_snapshot(dashboard)[source]

Dashboard Server から現在状態を取得する。

TP に表示される popup 本文そのものは標準 Dashboard API から読めない。 そのため、robotmode/safetystatus/safetymode/programState/isInRemoteControl を まとめて読み、復帰判断とログ表示に使う。

Parameters:

dashboard (Any)

Return type:

Dict[str, Any]

_dashboard_status()[source]

DashboardClient から補助的な状態文字列を取得する。

Dashboard を使っていない場合は空 dict を返す。Dashboard の safetystatus は safetymode より詳細な問い合わせであるため、利用できる場合はエラー表示へ 含める。

Return type:

Dict[str, Any]

static _dashboard_text(value)[source]

DashboardClient の応答を比較しやすい大文字文字列へ変換する。

Parameters:

value (Any)

Return type:

str

_decode_robot_status_bits(status_bits)[source]

RTDE robot status bit を dict へ展開する。

Parameters:

status_bits (Any)

Return type:

Dict[str, bool]

_decode_safety_status_bits(status_bits)[source]

RTDE safety status bit を dict へ展開する。

Parameters:

status_bits (Any)

Return type:

Dict[str, bool]

classmethod _describe_flags(flags, descriptions)[source]

bit flag を name=value(日本語説明) の list へ変換する。

Parameters:
  • flags (Dict[str, bool])

  • descriptions (Dict[str, str])

Return type:

List[str]

classmethod _diagnose_robot_state(robot_mode, robot_status_flags, safety_mode, safety_status_flags)[source]

robot/safety 状態を組み合わせ、次に見るべき点を返す。

単独の数値名だけでは誤読しやすいため、robot_mode、robot_status、 safety_mode、safety_status を組み合わせる。

Parameters:
  • robot_mode (Any)

  • robot_status_flags (Dict[str, bool])

  • safety_mode (Any)

  • safety_status_flags (Dict[str, bool])

Return type:

str

_drive_core(target, *, relative=False, path_blend=None, speed=None, is_async=False, bstrOpt=None)[source]

COBOTTA 側の Drive 系 I/F に合わせて J 座標を作る。

UR には COBOTTA の DriveEX/DriveAEX 相当の命令がないため、公開 I/F と入力解釈を合わせ、最終的には J 座標の moveJ へ変換する。 target は “(1,10),(2,20)”、(1, 10)、[(1, 10), (2, 20)] を受ける。

Parameters:
  • target (str | list | tuple)

  • relative (bool)

  • path_blend (str | None)

  • speed (int | float | None)

  • is_async (bool | None)

  • bstrOpt (str | int | None)

Return type:

List[float] | bool

_error_handle(e)[source]

COBOTTA 型の内部エラー処理。

外部から呼ぶ API ではない。各メソッドの except 節から呼び、 最後の error_description を更新して False を返す。 ここでは state() や error_description を再帰的に呼ばない。

Parameters:

e (Any)

Return type:

bool

_fail(error)[source]

例外を COBOTTA 型の失敗値 False に変換する。

Parameters:

error (Any)

Return type:

bool

_finish_api_call(capture, result, *, is_async=False, false_is_failure=True)[source]

API戻り値、Primaryメッセージ、RTDE安全状態を共通判定する。

Parameters:
  • capture (Dict[str, Any])

  • result (Any)

  • is_async (bool)

  • false_is_failure (bool)

Return type:

bool

classmethod _format_active_flags(flags, descriptions)[source]

有効な flag だけを name(日本語説明) 形式で返す。

Parameters:
  • flags (Dict[str, bool])

  • descriptions (Dict[str, str])

Return type:

str

classmethod _format_robot_mode(robot_mode)[source]

robot_mode を number(NAME: 日本語説明) で返す。

Parameters:

robot_mode (Any)

Return type:

str

classmethod _format_safety_mode(safety_mode)[source]

safety_mode を number(NAME: 日本語説明) で返す。

Parameters:

safety_mode (Any)

Return type:

str

classmethod _format_state_summary(robot_mode, robot_status_flags, safety_mode, safety_status_flags)[source]

状態値を一行で確認できる要約へ変換する。

Parameters:
  • robot_mode (Any)

  • robot_status_flags (Dict[str, bool])

  • safety_mode (Any)

  • safety_status_flags (Dict[str, bool])

Return type:

str

_get_primary_errors_after(mark, timeout=0.25)[source]

指定位置以後のPrimaryエラーメッセージを返す。

Parameters:
  • mark (int | None)

  • timeout (float)

Return type:

List[Dict[str, Any]]

_interface_is_connected(interface)[source]

ur_rtde / Dashboard interface の接続状態を安全に確認する。

Parameters:

interface (Any)

Return type:

bool

_io()[source]

RTDEIOInterface を取得する。

未接続の場合は例外を送出する。

Return type:

Any

classmethod _is_error_state(state)[source]

state() の結果からエラー状態かどうかを判定する。

Parameters:

state (Dict[str, Any])

Return type:

bool

_joint_params(speed, accel)[source]

百分率指定から UR RTDE の moveJ 用速度・加速度へ変換する。

戻り値の単位は rad/s と rad/s^2 である。

Parameters:
  • speed (int | float | None)

  • accel (int | float | None)

Return type:

Tuple[float, float]

classmethod _joints_from_ur(joints)[source]

UR RTDE の関節角を公開 I/F の J 座標へ変換する。

rad から degree へ変換する。

Parameters:

joints (Sequence[int | float])

Return type:

List[float]

classmethod _joints_to_ur(joints)[source]

公開 I/F の J 座標を UR RTDE の関節角へ変換する。

degree から rad へ変換する。

Parameters:

joints (Sequence[int | float])

Return type:

List[float]

_linear_params(speed, accel)[source]

百分率指定から UR RTDE の moveL 用速度・加速度へ変換する。

戻り値の単位は m/s と m/s^2 である。

Parameters:
  • speed (int | float | None)

  • accel (int | float | None)

Return type:

Tuple[float, float]

_load_variables()[source]

RobotVarManager へ委譲して仮想ロボット変数を読み込む。

互換用の薄いラッパーである。UrRtde 自身は JSON を直接解釈しない。

Return type:

None

_log_dashboard_snapshot(caller, snapshot)[source]

Dashboard snapshot を x_logger へ出す。

Parameters:
  • caller (str)

  • snapshot (Dict[str, Any])

Return type:

None

static _mode(mode)[source]

COBOTTA 互換の motion mode 指定を MotionMode へ正規化する。

整数、文字列、MotionMode インスタンスを受け付ける。

Parameters:

mode (int | str | MotionMode)

Return type:

MotionMode

static _normalize_offset(offset)[source]

COBOTTA 側と同じ規則で offset を 6 成分へ補完する。

(0, 0, 10) は (0, 0, 10, 0, 0, 0) として扱う。 (0, 0, 0, 10) は (0, 0, 0, 10, 0, 0) として扱う。

Parameters:

offset (list | tuple)

Return type:

list

_open_rtde_control(caller)[source]

RTDEControl を開く。

Dashboard 復帰と状態監視系の確立後、最後に制御スクリプト開始を試す。

Parameters:

caller (str)

Return type:

bool

_open_rtde_monitor(caller)[source]

RTDEReceive/RTDEIO を開く。

状態監視系を先に確立する。RTDEControl はここでは作らない。

Parameters:

caller (str)

Return type:

bool

static _percent(value)[source]

COBOTTA 互換の速度・加速度百分率を検証する。

0 より大きく 100 以下の値だけを許可する。

Parameters:

value (int | float)

Return type:

float

_pose_add(base, offset)[source]

P 型ベクトルを成分ごとに加算する。

COBOTTA 側の dev()/move(offset=…) と同じく、offset は str/list/tuple を受け付ける。3 成分指定は後続の姿勢成分を 0 として補完する。

Parameters:
  • base (Sequence[int | float])

  • offset (str | List[int | float] | Tuple[int | float, ...])

Return type:

List[float]

classmethod _pose_from_ur(pose)[source]

UR RTDE の pose 表現を公開 I/F の P 座標へ変換する。

位置は m から mm、rotation-vector 成分は rad から degree へ変換する。

Parameters:

pose (Sequence[int | float])

Return type:

List[float]

classmethod _pose_to_ur(pose)[source]

公開 I/F の P 座標を UR RTDE の pose 表現へ変換する。

位置は mm から m、rotation-vector 成分は degree から rad へ変換する。

Parameters:

pose (Sequence[int | float])

Return type:

List[float]

_read_error_state()[source]

エラー判定用状態を取得する。取得失敗は状態内に保存する。

Return type:

Dict[str, Any]

_receive()[source]

RTDEReceiveInterface を取得する。

未接続の場合は例外を送出する。

Return type:

Any

_record_error(error)[source]

後方互換用。内部では最後のエラー情報だけを保存する。

Parameters:

error (Any)

Return type:

None

static _robot_mode_description(robot_mode)[source]

RTDE robot mode の意味を返す。

Parameters:

robot_mode (Any)

Return type:

str

static _robot_mode_name(robot_mode)[source]

RTDE robot mode の整数値を可読名へ変換する。

Parameters:

robot_mode (Any)

Return type:

str

_safe_call(func, default=None)[source]

状態取得用の補助関数。

エラー表示中にさらに例外を連鎖させないため、個別の RTDE/Dashboard 問い合わせ失敗は default に落とす。

Parameters:
  • func (Any)

  • default (Any)

Return type:

Any

static _safety_mode_description(safety_mode)[source]

RTDE safety mode の意味を返す。

Parameters:

safety_mode (Any)

Return type:

str

static _safety_mode_name(safety_mode)[source]

RTDE safety mode の整数値を可読名へ変換する。

Parameters:

safety_mode (Any)

Return type:

str

_save_variables()[source]

RobotVarManager へ委譲して仮想ロボット変数を保存する。

Return type:

None

_set_api_failure(capture, *, result=None, exception=None, state=None, description=None, stage='api_result', primary_timeout=0.25)[source]

各インターフェースの情報から失敗原因を一度だけ確定する。

Parameters:
  • capture (Dict[str, Any])

  • result (Any)

  • exception (BaseException | None)

  • state (Dict[str, Any] | None)

  • description (str | None)

  • stage (str)

  • primary_timeout (float)

Return type:

bool

_set_last_error(error, description=None, source_class=None, source_method=None, operation=None, stage=None, state=None, error_origin=None, detected_by=None)[source]

最後のエラー情報を保存する。

ログは出さない。エラー表示は print_error()/print_error_info() 側で行う。

Parameters:
  • error (Any)

  • description (str | None)

  • source_class (str | None)

  • source_method (str | None)

  • operation (str | None)

  • stage (str | None)

  • state (Dict[str, Any] | None)

  • error_origin (str | None)

  • detected_by (str | None)

Return type:

None

static _six(values, name)[source]

6 成分の数値列を検証し、float list に変換する。

P/J 座標の内部正規化で使う。offset の 3 成分補完とは別の厳密検証である。

Parameters:
  • values (Sequence[int | float])

  • name (str)

Return type:

List[float]

classmethod _state_error_code(state)[source]

UR 状態から互換用の疑似エラーコードを返す。

UR RTDE では RC8 のようなエラー番号列を取得できないため、CLI 側で 使えるように負数の疑似コードへ正規化する。

Parameters:

state (Dict[str, Any])

Return type:

int

classmethod _state_error_description(state)[source]

state() の結果から人間が読めるエラー説明文字列を生成する。

Parameters:

state (Dict[str, Any])

Return type:

str

static _strip_path_prefix(base)[source]

@P P1 や @0 P14 から @ ステートメントを除去する。

Parameters:

base (str)

Return type:

str

_target(target, coord_type=None)[source]

move 系に渡された目標値を P/J ベクトルへ解決する。

対応する文字列は P1, @P P1, @0 P1, P1+(0,0,10), @P P1+(0,0,10,0,0,0) である。 @P/@0 はパスブレンド指定としての名前だけ受け付け、 単点 move では軌道生成に影響させない。

Parameters:
  • target (str | Sequence[int | float])

  • coord_type (str | None)

Return type:

Tuple[List[float], str]

_to_p_string(offset)[source]

COBOTTA 側と同じ規則で offset を P 文字列へ整形する。

str はそのまま返し、list/tuple は不足分を 0 補完して P(…) へ変換する。

Parameters:

offset (str | list | tuple)

Return type:

str | bool

_unsupported(name)[source]

未対応機能を Cobotta 互換の False 戻り値へ変換する。

Parameters:

name (str)

Return type:

bool

_var_name(kind_or_combined, id_num)[source]

P1/J2/I3/F4/IO5 形式、または kind と番号の分離指定を正規化する。

内部では COBOTTA 互換の仮想変数名を (kind, index) に分解して扱う。

Parameters:
  • kind_or_combined (str)

  • id_num (int | None)

Return type:

Tuple[str, int] | bool

_wait_dashboard_state(dashboard, caller, label, predicate, timeout=10.0, interval=0.25)[source]

Dashboard 状態が predicate を満たすまで待つ。

Parameters:
  • dashboard (Any)

  • caller (str)

  • label (str)

  • predicate (Any)

  • timeout (float)

  • interval (float)

Return type:

bool

property accel: float

直交移動系の加速度百分率を返す。

acquire_control()[source]

共通ロボット I/F: モーション制御権を取得する。

UR では RTDEControlInterface の確立に対応する。

Return type:

bool

approach(lComp, vntPoseBase, vntPoseLen, bstrOpt=None)[source]

COBOTTA 互換の Approach I/F である。

基準 P 座標へ offset を加えた単点 move として扱う。

Parameters:
  • lComp (int | str | MotionMode)

  • vntPoseBase (str | Sequence[int | float])

  • vntPoseLen (Sequence[int | float])

  • bstrOpt (str | int | None)

Return type:

bool

property busy_status: bool

動作中状態を返す互換プロパティである。

change_tool(work_no)[source]

tool 番号切替の互換 I/F である。

Parameters:

work_no (int)

Return type:

bool

change_work(work_no=0)[source]

work 番号切替の互換 I/F である。

UR では work 座標系を持たないため番号だけ保持する。

Parameters:

work_no (int)

Return type:

bool

check_error()[source]

現在または直前の非同期命令に関連するURエラーを確認する。

Return type:

bool

close_popup()[source]

Low-level API: PolyScope の通常ポップアップを閉じる。

Return type:

bool

close_safety_popup()[source]

Low-level API: PolyScope の safety popup を閉じる。

Return type:

bool

connect_control()[source]

Low-level API: RTDEControl のモーション制御経路を接続する。

共通ロボット I/F では take_arm() から呼ばれる。connect() では呼ばない。

Return type:

bool

connect_dashboard()[source]

Low-level API: Dashboard Server へ接続する。

Dashboard は UR の管理系インターフェースである。TP/PolyScope の safety popup、Power On、Brake Release、Safety Restart を扱う。 この接続が失敗する場合は、IP、ネットワーク、Remote 設定、Dashboard Server の到達性に問題がある。

Return type:

bool

connect_error_receiver()[source]

Low-level API: Primary Interface のエラー受信経路を接続する。

Return type:

bool

connect_io()[source]

Low-level API: RTDEIO の IO 経路を接続する。

Return type:

bool

connect_receive()[source]

Low-level API: RTDEReceive の状態監視経路を接続する。

Return type:

bool

property coord_type: str

現在の既定座標種別を返す。

property current_angle: List[float] | bool

現在関節角を公開 I/F 単位で返す。

property current_position: List[float] | bool

現在 TCP pose を公開 I/F 単位で返す。

dashboard_recovery()[source]

UR のエラー解除と動作準備を行う。

COBOTTA 側の reset_error() と同じく、単なる状態クリアではなく、 エラー解除に必要な一連の復帰操作をまとめる API である。

UR では Dashboard Server 経由で TP popup と safety 状態を確認し、 safety fault/violation、protective stop、Power Off、Brake Release 待ちを 順に解消する。RTDEControlInterface が未接続・接続失敗状態でも使えるよう、 復帰処理は Dashboard 経路に限定する。

Return type:

bool

property decel: float

停止時の減速度百分率を返す。

dev(base, offset)[source]

base に offset を加えた P 型ベクトルを返す。

CobottaCtrl の dev()/move(offset=…) 利用に合わせ、公開 I/F 上の 6 成分を単純加算する。UR の厳密な pose 合成が必要な場合は pose_trans() を使う。

Parameters:
  • base (str | Sequence[int | float])

  • offset (str | list | tuple)

Return type:

List[float] | bool

property direct_mode: bool

UR は常時 direct mode 相当として扱う。

disconnect()[source]
Return type:

bool

disconnect_control()[source]

Low-level API: RTDEControl のモーション制御経路だけを切断する。

Return type:

bool

disconnect_error_receiver()[source]

Low-level API: Primary Interface のエラー受信経路を切断する。

Return type:

bool

download_all_files_from_cobotta(output_dir='.', skip_filenames=None)[source]

COBOTTA 全ファイル取得の互換 I/F である。

UR では未対応である。

Parameters:
  • output_dir (str)

  • skip_filenames (Sequence[str] | None)

Return type:

bool

download_file_from_cobotta(cobotta_filename, output_dir='.')[source]

COBOTTA ファイル取得の互換 I/F である。

UR では未対応である。

Parameters:
  • cobotta_filename (str)

  • output_dir (str)

Return type:

bool

drive(target, *, relative=False, path_blend=None, speed=None, is_async=False, bstrOpt=None)[source]

COBOTTA 互換の Drive 統合 I/F。

relative=True で相対移動、relative=False で絶対移動として扱う。

Parameters:
  • target (str | list | tuple | None)

  • relative (bool)

  • path_blend (str | None)

  • speed (int | float | None)

  • is_async (bool | None)

  • bstrOpt (str | int | None)

Return type:

bool

drive_a(target, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]

COBOTTA 互換の絶対 Drive 別名である。

実処理は drive_AEX() に委譲する。

Parameters:
  • target (str | list | tuple)

  • path_blend (str | None)

  • speed (int | float | None)

  • is_async (bool | None)

  • bstrOpt (str | int | None)

Return type:

bool

drive_aex(target, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]

COBOTTA 互換の絶対 Drive。

Parameters:
  • target (str | list | tuple | None)

  • path_blend (str | None)

  • speed (int | float | None)

  • is_async (bool | None)

  • bstrOpt (str | int | None)

Return type:

bool

drive_ex(target, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]

COBOTTA 互換の相対 Drive。

Parameters:
  • target (str | list | tuple)

  • path_blend (str | None)

  • speed (int | float | None)

  • is_async (bool | None)

  • bstrOpt (str | int | None)

Return type:

bool

property error_code: int

現在の互換エラーコードを返す。

property error_description: str | bool

最後の例外または現在の UR safety state を説明文字列として返す。

property extaccel: float

外部軸加速度。UR 単体では accel と同義の互換プロパティ。

property extdecel: float

外部軸減速度。UR 単体では decel と同義の互換プロパティ。

property extspeed: float

外部軸速度。UR 単体では speed と同義の互換プロパティ。

get_F(id_num)[source]

F 型仮想変数を取得する。

Parameters:

id_num (int)

Return type:

float | bool

get_I(id_num)[source]

I 型仮想変数を取得する。

Parameters:

id_num (int)

Return type:

int | bool

get_IO(id_num)[source]

デジタル入力を取得する。

COBOTTA 互換の IO 番号を UR の入力番号として扱う。

Parameters:

id_num (int)

Return type:

bool

get_J(id_num)[source]

J 型仮想変数を取得する。

戻り値の単位は degree である。

Parameters:

id_num (int)

Return type:

List[float] | bool

get_P(id_num)[source]

P 型仮想変数を取得する。

戻り値の単位は公開 I/F と同じく mm/degree である。

Parameters:

id_num (int)

Return type:

List[float] | bool

get_accel()[source]

直交移動系の加速度百分率を返す。

Return type:

float

get_all_var()[source]

保持中の仮想変数をまとめて取得する。

主にデバッグ、保存内容確認、server I/F 確認用である。

Return type:

Dict[str, Any]

get_check_ik()[source]

P座標移動前の逆運動学事前確認設定を返す。

Return type:

bool

get_cobotta_all_files_content(skip_filenames=None)[source]

COBOTTA 全ファイル内容取得の互換 I/F である。

UR では未対応である。

Parameters:

skip_filenames (Sequence[str] | None)

Return type:

Dict[str, str]

get_cobotta_file_content(cobotta_filename)[source]

COBOTTA ファイル内容取得の互換 I/F である。

UR では未対応である。

Parameters:

cobotta_filename (str)

Return type:

str

get_cobotta_file_names()[source]

COBOTTA ファイル一覧取得の互換 I/F である。

UR では対象ファイル機構がないため空 list を返す。

Return type:

List[str]

get_connection_status()[source]

接続・準備状態をまとめて返す。

サーバー側やログ出力で、どの層が失敗しているかを切り分けるために使う。

Return type:

Dict[str, bool]

get_coord_type()[source]

現在の既定座標種別を返す。

Return type:

str

get_current_angle()[source]

現在関節角を取得する。

公開 I/F として degree の 6 成分を返す。

Return type:

List[float] | bool

get_current_error_info()[source]

現在発生しているエラー情報を 1 件返す。

COBOTTA の get_current_error_info() に相当する。UR では現在の RTDE / Dashboard 状態から code / description / state を生成する。

Return type:

Dict[str, Any]

get_current_pose()[source]

get_current_position() の互換別名である。

Return type:

List[float] | bool

get_current_position()[source]

現在 TCP pose を取得する。

公開 I/F として mm/degree rotation-vector の 6 成分を返す。

Return type:

List[float] | bool

get_current_tool()[source]

現在 tool 番号を返す。

UR では互換用に保持した番号である。

Return type:

List[float] | bool

get_current_tool_no()[source]

現在 tool 番号を返す互換 I/F である。

Return type:

int

get_current_work_no()[source]

現在 work 番号を返す互換 I/F である。

Return type:

int

get_decel()[source]

停止時の減速度百分率を返す。

Return type:

float

get_digital_input(id_num)[source]

get_IO() の明示名である。

Parameters:

id_num (int)

Return type:

bool

get_direct_mode()[source]

direct_mode 互換プロパティを返す。

Return type:

bool

get_error()[source]

現在確認できる UR エラー情報を返す。

COBOTTA では controller の GetCurErrorInfo を返す。UR には同等の蓄積 エラー一覧がないため、RTDE / Dashboard から取得可能な現在状態を 1 件の 互換エラー情報として返す。

Return type:

List[Dict[str, Any]]

get_error_code()[source]

現在の互換エラーコードを返す。

Return type:

int

get_error_count()[source]

現在確認できる互換エラー数を返す。

Return type:

int

get_error_description(error_code)[source]

error_code に対応する説明文字列を返す。

COBOTTA 側と同じく、外部からエラー原因を確認するときはこの description を見る。UR では RC8 の GetErrorDescription 相当がないため、最後に記録した 例外情報または現在の safety / robot state から説明文を生成する。

Parameters:

error_code (int)

Return type:

str | bool

get_error_info(index)[source]

指定 index の互換エラー情報を返す。

Parameters:

index (int)

Return type:

Dict[str, Any]

get_extaccel()[source]

外部軸加速度の互換 getter である。

UR 単体では通常加速度を返す。

Return type:

float

get_extdecel()[source]

外部軸減速度の互換 getter である。

UR 単体では通常減速度を返す。

Return type:

float

get_extspeed()[source]

外部軸速度の互換 getter である。

UR 単体では通常速度を返す。

Return type:

float

get_file_object(filename)[source]

COBOTTA ファイルオブジェクト取得の互換 I/F である。

Parameters:

filename (str)

Return type:

bool

get_jspeed()[source]

関節移動系の速度百分率を返す。

Return type:

float

get_log_record(index)[source]

互換ログレコードを返す。

UR では専用ログを保持しないため False を返す。

Parameters:

index (int)

Return type:

Dict[str, Any]

get_motion_complete()[source]

motion_complete() の互換 getter である。

Return type:

bool

get_motion_mode()[source]

現在の既定 motion mode を返す。

Return type:

MotionMode

get_motion_preparation()[source]

モーション準備状態を返す互換 I/F である。

Return type:

Dict[str, Any]

get_path_blend()[source]

現在のパスブレンド指定を返す。

Return type:

str

get_speed()[source]

直交移動系の速度百分率を返す。

Return type:

float

get_task_status()[source]

タスク状態の互換 I/F である。

UR では RTDE/Dashboard から集約した state() を返す。

Return type:

Dict[str, Any]

get_tool(tool_no=0)[source]

指定 tool の定義を返す。

UR では現在 TCP pose を互換値として返す。

Parameters:

tool_no (int)

Return type:

List[float] | bool

get_tool_define(tool_no=0)[source]

get_tool() の互換別名である。

Parameters:

tool_no (int)

Return type:

List[float] | bool

get_var(kind_or_combined, id_num=None)[source]

COBOTTA 互換の仮想変数を取得する。

P/J/I/F は RobotVarManager が保持する仮想変数であり、IO だけは実 IO へ転送する。

Parameters:
  • kind_or_combined (str)

  • id_num (int | None)

Return type:

Any

get_version(rel_toml_path=None)[source]

実行中の ur_rtde / Polyscope 情報を文字列で返す。

Parameters:

rel_toml_path (str | TypeAliasForwardRef('pathlib.Path') | None) – CobottaCtrl 互換用の引数。UR では使用しない。

Returns:

ur_rtde または Polyscope のバージョン情報。取得不能時は空文字列。

Return type:

str

get_work(work_no=0)[source]

work 定義取得の互換 I/F である。

UR では未定義のため False を返す。

Parameters:

work_no (int)

Return type:

List[float]

halt()[source]

stop() の互換別名である。

Return type:

bool

hand(*args, **kwargs)[source]

COBOTTA ハンド制御の互換 I/F である。

UR 単体では未対応である。

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

bool

hand_open(speed=None)[source]

open_hand() の互換別名である。

Parameters:

speed (int | None)

Return type:

bool

hand_stop()[source]

ハンド停止の互換 I/F である。

UR 単体では専用ハンドを持たないため stop() へ委譲する。

Return type:

bool

has_control_interface()[source]

RTDEControl インスタンスを保持しているかを返す。

接続が切れていても、エラー発生前に制御権を取得していたかを 上位層が判断するために使用する。

Return type:

bool

init_hand()[source]

COBOTTA ハンド初期化の互換 I/F である。

UR 単体では未対応である。

Return type:

bool

is_connected()[source]

管理・監視・IO の下位通信経路がすべて接続済みかを返す。

Return type:

bool

is_control_connected()[source]

RTDEControl のモーション制御経路が生きているかを返す。

Return type:

bool

is_dashboard_connected()[source]

Dashboard Server の通信経路が生きているかを返す。

Dashboard は TP/PolyScope 相当の管理系であり、powerOn(), brakeRelease(), closeSafetyPopup(), restartSafety() などの 復帰処理の主経路である。

Return type:

bool

is_empty_position(id_num, coord_type=None, tol=None)[source]

P/J 変数が未登録かどうかを返す。

Cobotta ではコントローラ変数の空状態を調べる用途で使う。UR では ローカル JSON/メモリ上の P/J 変数登録状態を確認する。

Parameters:
  • id_num (int | str)

  • coord_type (str | None)

  • tol (float | None)

Return type:

bool

is_error_receiver_connected()[source]

Primary Interface のエラー受信状態を返す。

Return type:

bool

is_io_connected()[source]

RTDEIO の IO 経路が生きているかを返す。

Return type:

bool

is_joints_within_safety_limits(joints)[source]

指定 J 座標が UR の安全範囲内かを確認する。

Parameters:

joints (Sequence[int | float])

Return type:

bool

is_monitor_connected()[source]

RTDEReceive の状態監視経路が生きているかを返す。

Return type:

bool

is_motion_ready()[source]

moveJ/moveL などの主要制御を送れる状態かを返す。

通信が一部成功しているだけでは True にしない。安全状態が正常で、 ロボット駆動系が ON で、RTDEControl が接続済みのとき True とする。

Return type:

bool

is_pose_within_safety_limits(pose)[source]

指定 P 座標が UR の安全範囲内かを確認する。

Parameters:

pose (Sequence[int | float])

Return type:

bool

is_power_on()[source]

ロボット駆動系(サーボ電源)が ON かを返す。

TP/コントローラ本体の電源ではなく、Dashboard powerOn() の対象に なるロボット駆動系状態を表す。

Return type:

bool

is_running()[source]

UR 制御プログラムが実行中かを返す。

RTDEControlInterface の isProgramRunning() を用いる。

Return type:

bool

is_safety_normal()[source]

安全状態が motion を妨げない状態かを返す。

RTDEReceive が有効な場合は safety_status_bits を優先する。 取得不能時は False とし、未接続を安全側に倒す。

Return type:

bool

j2p(j_type_pos)[source]

J 座標から P 座標へ変換する。

Parameters:

j_type_pos (Sequence[int | float])

Return type:

List[float] | bool

property jspeed: float

関節移動系の速度百分率を返す。

property lock: bool

Cobotta 互換名。UR では明示的なロック状態を持たない。

motion_complete()[source]

モーション完了状態を返す。

UR RTDE の isSteady() を優先し、失敗時は is_running() の否定で補完する。

Return type:

bool

property motion_mode: MotionMode

現在の既定 motion mode を返す。

move(target, *, motion_mode=None, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=False, bstrOpt=None, check_ik=None)[source]

単一点移動を実行し、同期時は最終状態まで判定する。

Parameters:
  • target (str | Sequence[int | float])

  • motion_mode (int | str | MotionMode | None)

  • coord_type (str | None)

  • path_blend (str | None)

  • offset (Sequence[int | float] | None)

  • pose (int | None)

  • speed (int | float | None)

  • accel (int | float | None)

  • decel (int | float | None)

  • is_async (bool | None)

  • bstrOpt (str | int | None)

  • check_ik (bool | None)

Return type:

bool

move_circle(via, target, *, speed=None, accel=None, is_async=True, mode=1)[source]

円弧移動の互換 I/F である。

現在使用している ur-rtde Python binding では moveC が公開されないため未対応である。

Parameters:
  • via (str | Sequence[int | float])

  • target (str | Sequence[int | float])

  • speed (int | float | None)

  • accel (int | float | None)

  • is_async (bool)

  • mode (int)

Return type:

bool

move_path(targets, *, motion_mode=None, coord_type=None, speed=None, accel=None, blend=None, is_async=False)[source]

複数点をURのパスとして移動する。blend の単位は m。

Parameters:
  • targets (Sequence[str | Sequence[int | float]])

  • motion_mode (int | str | MotionMode | None)

  • coord_type (str | None)

  • speed (int | float | None)

  • accel (int | float | None)

  • blend (float | None)

  • is_async (bool)

Return type:

bool

open_hand(speed=None)[source]

COBOTTA ハンド開操作の互換 I/F である。

UR 単体では未対応である。

Parameters:

speed (int | None)

Return type:

bool

p2j(p_type_pos)[source]

P 座標から J 座標へ変換する。

Parameters:

p_type_pos (Sequence[int | float])

Return type:

List[float] | bool

property path_blend: str

現在のパスブレンド指定を返す。

pose_trans(base, offset)[source]

URScript pose_trans() 相当の姿勢合成を行う。

Parameters:
  • base (str | Sequence[int | float])

  • offset (str | list | tuple)

Return type:

List[float] | bool

print_error(e)[source]

例外、文字列、互換エラーコードをログ出力する。

Parameters:

e (Any)

Return type:

bool

print_error_info(e)[source]

COBOTTA 互換のエラー表示エイリアス。

Parameters:

e (Any)

Return type:

bool

release_control()[source]

共通ロボット I/F: モーション制御権を解放する。

UR では RTDEControlInterface の切断に対応する。

Return type:

bool

release_control_alias()[source]

共通ロボット I/F: give_arm() の別名。

Return type:

bool

rotate(plane, angle, center, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]

現在 pose から姿勢成分だけを相対回転させる互換 I/F である。

Parameters:
  • plane (str)

  • angle (float)

  • center (Sequence[int | float])

  • path_blend (str | None)

  • speed (int | float | None)

  • is_async (bool | None)

  • bstrOpt (str | int | None)

Return type:

bool

run_script()[source]

COBOTTA スクリプト実行の互換 I/F である。

UR では専用スクリプト管理を持たないため未対応である。

Return type:

bool

property servo_on: bool

サーボ/電源が動作可能かを推定して返す。

set_F(id_num, value)[source]

F 型仮想変数を設定する。

Parameters:
  • id_num (int)

  • value (float)

Return type:

bool

set_I(id_num, value)[source]

I 型仮想変数を設定する。

Parameters:
  • id_num (int)

  • value (int)

Return type:

bool

set_IO(id_num, value)[source]

0..7=standard、8..15=configurable、16..17=tool output。

Parameters:
  • id_num (int)

  • value (int | float)

Return type:

bool

set_J(id_num, value)[source]

J 型仮想変数を設定する。

値は 6 軸の degree 指定として扱う。

Parameters:
  • id_num (int)

  • value (Sequence[int | float])

Return type:

bool

set_P(id_num, value)[source]

P 型仮想変数を設定する。

値は 6 成分の公開 I/F 座標として扱う。

Parameters:
  • id_num (int)

  • value (Sequence[int | float])

Return type:

bool

set_accel(accel)[source]

直交移動系の加速度百分率を設定する。

Parameters:

accel (int | float)

Return type:

bool

set_check_ik(enabled)[source]

P座標移動前の逆運動学事前確認を設定する。

Parameters:

enabled (bool)

Return type:

bool

set_coord_type(coord_type)[source]

既定の座標種別を設定する。

P は TCP pose、J は関節角である。

Parameters:

coord_type (str)

Return type:

bool

set_decel(decel)[source]

停止時の減速度百分率を設定する。

Parameters:

decel (int | float)

Return type:

bool

set_extaccel(extaccel)[source]

外部軸加速度の互換 setter である。

UR 単体では通常加速度へ委譲する。

Parameters:

extaccel (int | float)

Return type:

bool

set_extdecel(extdecel)[source]

外部軸減速度の互換 setter である。

UR 単体では通常減速度へ委譲する。

Parameters:

extdecel (int | float)

Return type:

bool

set_extspeed(speed)[source]

外部軸速度の互換 setter である。

UR 単体では通常速度へ委譲する。

Parameters:

speed (int | float)

Return type:

bool

set_jspeed(speed)[source]

関節移動系の速度百分率を設定する。

Parameters:

speed (int | float)

Return type:

bool

set_motion_mode(mode)[source]

既定の motion mode を設定する。

Parameters:

mode (int | str | MotionMode)

Return type:

bool

set_path_blend(path_blend)[source]

パスブレンド指定を保存する。

@0 はブレンドなし、@P は既定ブレンド半径を使う互換指定である。

Parameters:

path_blend (str)

Return type:

bool

set_speed(speed)[source]

直交移動系の速度百分率を設定する。

Parameters:

speed (int | float)

Return type:

bool

set_tcp(tcp)[source]

現在 TCP を設定する。

Parameters:

tcp (Sequence[int | float])

Return type:

bool

set_tool(tool_no, tool_define)[source]

tool 番号指定の互換 I/F である。

UR では tool 番号テーブルを持たないため現在値を保持するだけである。

Parameters:
  • tool_no (int)

  • tool_define (Sequence[int | float])

Return type:

bool

set_tool_define(tool_no, tool_define)[source]

tool 定義の互換 I/F である。

UR では TCP pose を現在 TCP として設定する。

Parameters:
  • tool_no (int)

  • tool_define (Sequence[int | float])

Return type:

bool

set_var(kind_or_combined, id_or_value, value=None)[source]

COBOTTA 互換の仮想変数を設定する。

P/J は 6 成分、I は整数、F は浮動小数点へ正規化してから保存する。

Parameters:
  • kind_or_combined (str)

  • id_or_value (Any)

  • value (Any)

Return type:

bool

set_work(work_no, work_define, work_attribute=None)[source]

work 定義設定の互換 I/F である。

UR では番号と値だけを互換用に受け付ける。

Parameters:
  • work_no (int)

  • work_define (Sequence[int | float])

  • work_attribute (Any | None)

Return type:

bool

property speed: float

直交移動系の速度百分率を返す。

start_log()[source]

COBOTTA ログ開始の互換 I/F である。

UR 実装では専用ログ機能を持たないため True を返す。

Return type:

bool

state()[source]

UR の現在状態を RTDE / Dashboard から取得する。

Cobotta/RC8 の error_code と異なり、UR RTDE から取得できるのは 主に robot mode、safety mode、safety status bits である。PolyScope の ログ画面に表示される詳細なエラー本文を RTDE から直接取得する標準 API は ないため、このメソッドでは CLI 側で判断できる状態情報を集約する。

Return type:

Dict[str, Any]

stop()[source]

現在の移動種別に応じて停止命令を送る。

Return type:

bool

stop_log()[source]

COBOTTA ログ停止の互換 I/F である。

Return type:

bool

stop_script()[source]

RTDE制御スクリプトを終了する。通常終了には disconnect() を使う。

Return type:

bool

take_camera(evp_script_name='take_camera', pac_script_name='take_camera.pac')[source]

カメラ占有の互換 I/F である。

UR 単体ではカメラを持たないため False を返す。

Parameters:
  • evp_script_name (str)

  • pac_script_name (str)

Return type:

bool

take_script(script='pro1')[source]

スクリプト占有の互換 I/F である。

UR では専用スクリプト占有を持たないため True を返す。

Parameters:

script (str)

Return type:

bool

property task: str

現在の制御タスク名を返す。

UR では RTDE として扱う。

property task_state: Dict[str, Any]

現在のタスク状態を返す。

UR では state() の結果を返す。

task_stop()[source]

タスク停止の互換 I/F である。

UR では stop() へ委譲する。

Return type:

bool

teach(kind_or_combined='P', id_num=None, *, save=True)[source]

現在のロボット状態を指定変数へ教示する。

CobottaCtrl.teach() と同じ公開 I/F である。set_P() は 呼び出し側が与えた値を代入する通常の setter であり、teach() は 実機から現在状態を読み取って P10 や J1 に記録する操作である。

UR には RC8/FANUC のようなコントローラ内部位置レジスタがない。 そのため、教示値は RobotVarManager の仮想変数として保持し、 JSON ファイルへ保存する。

Parameters:
  • kind_or_combined (str) – “P”, “J”, “P10”, “J1” 形式の変数指定。

  • id_num (int | None) – 変数番号。結合済み名の場合は省略できる。

  • save (bool) – True の場合、教示後に JSON へ即保存する。

Returns:

成功時 True、失敗時 False。

Return type:

bool

turn_off_motor()[source]

モーターをOFFにする。

Return type:

bool

turn_on_motor()[source]

モーターをONにする。

Return type:

bool

upload_content_to_cobotta(file_content, cobotta_filename)[source]

COBOTTA ファイル内容アップロードの互換 I/F である。

UR では未対応である。

Parameters:
  • file_content (str)

  • cobotta_filename (str)

Return type:

bool

upload_file_to_cobotta(upload_filename, cobotta_filename=None)[source]

COBOTTA ファイルアップロードの互換 I/F である。

UR では未対応である。

Parameters:
  • upload_filename (str)

  • cobotta_filename (str | None)

Return type:

bool

wait_for_complete(timeout=None, interval=0.02)[source]

モーション完了まで待機する。

server から長時間呼び出す場合は timeout 指定を推奨する。

Parameters:
  • timeout (float | None)

  • interval (float)

Return type:

bool

ur.ur_util module

class MotionMode(*values)[source]

Bases: str, Enum

CobottaCtrl 互換名で公開する移動モード。

UR の RTDE API へ渡す直前に、PTP は moveJ / moveJ_IK、LINE は moveL、 CIRCLE は moveC 相当へ変換する。SPLINE は互換名として保持するが、UrRtde 側で未対応の場合は明示的に NotImplementedError として扱う。

CIRCLE = 'CIRCLE'
LINE = 'LINE'
PTP = 'PTP'
SPLINE = 'SPLINE'